Skip to content

Commit

Permalink
Include HiveMQ Platform Operator and HiveMQ Platform charts
Browse files Browse the repository at this point in the history
  • Loading branch information
afalhambra-hivemq committed Jan 30, 2024
1 parent 77bdfda commit 9f8e94e
Show file tree
Hide file tree
Showing 226 changed files with 13,767 additions and 666 deletions.
1,161 changes: 1,161 additions & 0 deletions .editorconfig

Large diffs are not rendered by default.

75 changes: 75 additions & 0 deletions .github/workflows/hivemq-operator-integration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: HiveMQ Operator (Legacy) Integration Tests
on:
push:
branches:
- "**"
workflow_dispatch:
concurrency:
group: hivemq-operator-legacy-integration-test-${{ github.ref }}
cancel-in-progress: true
jobs:
legacy-integration-test:
runs-on: ubuntu-latest
timeout-minutes: 25
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
test-plan: [ K8sVersionCompatibility, Extensions, RollingUpgrades, Other ]
steps:
- uses: actions/checkout@v3
with:
path: helm-charts
- name: Set up Docker QEMU
uses: docker/setup-qemu-action@v2
- name: Login to Container Registry
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Checkout HiveMQ Operator (legacy) on the default branch
uses: actions/checkout@v3
with:
repository: hivemq/hivemq-operator
token: ${{ secrets.JENKINS_TOKEN }}
path: hivemq-operator
- name: Checkout HiveMQ Operator (legacy) on the same branch
run: |
echo "Checking if branch \"${GITHUB_REF_NAME}\" exists on hivemq-operator"
cd hivemq-operator
BRANCH=$(git ls-remote origin ${GITHUB_REF_NAME})
if [[ -n "${BRANCH}" ]]; then
echo "Checking out branch with the same name"
git fetch --all
git checkout origin/${GITHUB_REF_NAME}
fi
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Run HiveMQ Operator (legacy) integration tests
uses: gradle/gradle-build-action@v2
env:
TEST_PLAN: ${{ matrix.test-plan }}
with:
cache-disabled: true
gradle-home-cache-includes: |
caches
notifications
jdks
gradle-home-cache-cleanup: true
build-root-directory: helm-charts
arguments: |
:tests-hivemq-operator:integrationTest
- name: Upload HiveMQ Operator (legacy) test results
if: always()
uses: actions/upload-artifact@v3
with:
name: Test results HiveMQ Operator (legacy) ${{ matrix.test-plan }}
path: |
helm-charts/tests-hivemq-operator/build/reports/tests/integrationTest/
helm-charts/tests-hivemq-operator/build/test-results/integrationTest/*.xml
retention-days: 5
142 changes: 142 additions & 0 deletions .github/workflows/hivemq-platform-operator-integration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
name: HiveMQ Platform Operator Integration Tests
on:
push:
branches:
- "**"
workflow_dispatch:
concurrency:
group: hivemq-operator-platform-integration-test-${{ github.ref }}
cancel-in-progress: true
jobs:
platform-integration-test-compose:
runs-on: ubuntu-latest
timeout-minutes: 25
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
test-plan: [ Upgrade, Extensions, NonRootUser, Other ]
steps:
- name: Checkout HiveMQ Platform Helm Charts
uses: actions/checkout@v3
with:
path: helm-charts
- name: Set up Docker QEMU
uses: docker/setup-qemu-action@v2
- name: Login to Container Registry
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Checkout HiveMQ Platform Operator on the default branch
uses: actions/checkout@v3
with:
repository: hivemq/hivemq-platform-operator
token: ${{ secrets.JENKINS_TOKEN }}
path: hivemq-platform-operator
- name: Checkout HiveMQ Platform Operator on the same branch
run: |
echo "Checking if branch \"${GITHUB_REF_NAME}\" exists on hivemq-platform-operator"
cd hivemq-platform-operator
BRANCH=$(git ls-remote origin ${GITHUB_REF_NAME})
if [[ -n "${BRANCH}" ]]; then
echo "Checking out branch with the same name"
git fetch --all
git checkout origin/${GITHUB_REF_NAME}
fi
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Run HiveMQ Platform Operator integration tests
uses: gradle/gradle-build-action@v2
env:
TEST_PLAN: ${{ matrix.test-plan }}
with:
cache-disabled: true
gradle-home-cache-includes: |
caches
notifications
jdks
gradle-home-cache-cleanup: true
build-root-directory: helm-charts
arguments: |
:tests-hivemq-platform-operator:integrationTest --tests "*.compose.*"
- name: Upload HiveMQ Platform Operator test results
if: always()
uses: actions/upload-artifact@v3
with:
name: Test results HiveMQ Platform Operator - Compose ${{ matrix.test-plan }}
path: |
helm-charts/tests-hivemq-platform-operator/build/reports/tests/integrationTest/
helm-charts/tests-hivemq-platform-operator/build/test-results/integrationTest/*.xml
retention-days: 5

platform-integration-test-single:
runs-on: ubuntu-latest
timeout-minutes: 25
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
test-plan: [ CustomConfig, Services1, Services2, Platform, NonRootUser, Other ]
steps:
- uses: actions/checkout@v3
with:
path: helm-charts
- name: Set up Docker QEMU
uses: docker/setup-qemu-action@v2
- name: Login to Container Registry
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Checkout HiveMQ Platform Operator on the default branch
uses: actions/checkout@v3
with:
repository: hivemq/hivemq-platform-operator
token: ${{ secrets.JENKINS_TOKEN }}
path: hivemq-platform-operator
- name: Checkout HiveMQ Platform Operator on the same branch
run: |
echo "Checking if branch \"${GITHUB_REF_NAME}\" exists on hivemq-platform-operator"
cd hivemq-platform-operator
BRANCH=$(git ls-remote origin ${GITHUB_REF_NAME})
if [[ -n "${BRANCH}" ]]; then
echo "Checking out branch with the same name"
git fetch --all
git checkout origin/${GITHUB_REF_NAME}
fi
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Run HiveMQ Platform Operator integration tests
uses: gradle/gradle-build-action@v2
env:
TEST_PLAN: ${{ matrix.test-plan }}
with:
cache-disabled: true
gradle-home-cache-includes: |
caches
notifications
jdks
gradle-home-cache-cleanup: true
build-root-directory: helm-charts
arguments: |
:tests-hivemq-platform-operator:integrationTest --tests "*.single.*"
- name: Upload HiveMQ Platform Operator test results
if: always()
uses: actions/upload-artifact@v3
with:
name: Test results HiveMQ Platform Operator - Single ${{ matrix.test-plan }}
path: |
helm-charts/tests-hivemq-platform-operator/build/reports/tests/integrationTest/
helm-charts/tests-hivemq-platform-operator/build/test-results/integrationTest/*.xml
retention-days: 5
101 changes: 25 additions & 76 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,89 +1,38 @@
name: Release Charts

on:
push:
branches: [master]
workflow_dispatch:
jobs:
release:
permissions:
contents: write # to push chart release and create a release (helm/chart-releaser-action)

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Checkout hivemq-platform-helm-charts
uses: actions/checkout@v3
with:
repository: hivemq/hivemq-platform-helm-charts
path: platform-charts/
token: ${{ secrets.JENKINS_TOKEN }}
- name: Prepare Chart Structure
run: |
cp -r platform-charts/hivemq-platform* ./charts
tree ./charts -L 3
- name: Install chart releaser
- name: Checkout Code
uses: actions/checkout@v4

- name: Fetch history
run: git fetch --prune --unshallow

- name: Configure Git
run: |
set -e
arch="$(dpkg --print-architecture)"
curl -s https://api.github.com/repos/helm/chart-releaser/releases/latest \
| yq --indent 0 --no-colors --input-format json --unwrapScalar \
".assets[] | select(.name | test("\""^chart-releaser_.+_linux_${arch}\.tar\.gz$"\"")) | .browser_download_url" \
| xargs curl -SsL \
| tar zxf - -C /usr/local/bin
- name: Install Helm
uses: azure/setup-helm@v3
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Set up Helm
uses: azure/setup-helm@v3.5
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: List charts
id: charts
run: |
set -e
find -L charts -mindepth 2 -maxdepth 2 -type f \( -name 'Chart.yaml' -o -name 'Chart.yml' \) -exec dirname "{}" \; \
| sort -u \
| sed -E 's/^/- /' \
| yq --no-colors --indent 0 --output-format json '.' \
| sed -E 's/^/charts=/' >> $GITHUB_OUTPUT
version: v3.12.0

- name: Update Charts Helm Dependencies
run: |
set -ex
echo '${{ steps.charts.outputs.charts }}' \
| yq --indent 0 --no-colors --input-format json --unwrapScalar '.[]' \
| while read -r dir; do
helm dependency update $dir;
if [ -f "$dir/Chart.lock" ]; then
yq --indent 0 \
'.dependencies | map(["helm", "repo", "add", .name, .repository] | join(" ")) | .[]' \
"$dir/Chart.lock" \
| sh --;
fi
done
- name: Package Charts
id: package
- name: Add dependency chart repos
run: |
set -ex
packages=.cr-release-packages
find . -type f -name "Chart.yaml" -exec dirname {} \; | sort -u | while read -r dir; do
echo "$dir"
cr package "$dir" --package-path "$packages"
done
echo "dir=${packages}" >> $GITHUB_OUTPUT
- name: Upload Releases
run: |
owner=$(cut -d '/' -f 1 <<< '${{ github.repository }}')
repo=$(cut -d '/' -f 2 <<< '${{ github.repository }}')
cr upload --commit '${{ github.sha }}' --owner "$owner" --git-repo "$repo" --token '${{ github.token }}' \
--package-path '${{ steps.package.outputs.dir }}' --skip-existing
- name: Update Index
# The task has to run on a git repo
run: |
set -e
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
mkdir -p .cr-index
owner=$(cut -d '/' -f 1 <<< '${{ github.repository }}')
repo=$(cut -d '/' -f 2 <<< '${{ github.repository }}')
cr index --git-repo "$repo" --owner "$owner" .cr-index --push
if [ ! -f .cr-index/index.yaml ]; then
echo "The charts.yaml have to be increased to release new packages" && exit 1
fi
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.6.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
CR_SKIP_EXISTING: true
CR_GENERATE_RELEASE_NOTES: true
Loading

0 comments on commit 9f8e94e

Please sign in to comment.