From 70f82f32d342de6d4e14ad28986a36aadd2f093d Mon Sep 17 00:00:00 2001 From: Diogo Recharte Date: Tue, 21 Jan 2025 19:01:10 +0000 Subject: [PATCH 1/7] EVEREST-107 require catalog branch for FB workflow --- .github/workflows/feature-build.yaml | 59 +++------------------------- 1 file changed, 6 insertions(+), 53 deletions(-) diff --git a/.github/workflows/feature-build.yaml b/.github/workflows/feature-build.yaml index c81360843..609c5cf55 100644 --- a/.github/workflows/feature-build.yaml +++ b/.github/workflows/feature-build.yaml @@ -11,6 +11,10 @@ on: required: false default: main description: "Everest operator branch with the feature to checkout" + everest_catalog_branch: + required: false + default: main + description: "Everest catalog branch with the feature to checkout" vs_branch: required: false default: production @@ -19,18 +23,6 @@ on: required: false default: main description: "Helm charts branch with the feature to checkout" - upstream_operator: - type: choice - description: "The upstream operator to upgrade" - required: false - options: - - "" - - percona-xtradb-cluster-operator - - percona-server-mongodb-operator - - percona-postgresql-operator - upstream_operator_bundle_image: - required: false - description: "Full name of the upstream bundle image to test" artifacts_retention_days: required: false description: "How many days the artifacts will be stored in GitHub" @@ -63,8 +55,7 @@ jobs: HELM_BRANCH: ${{ github.event.inputs.helm_branch }} EVEREST_BRANCH: ${{ github.event.inputs.everest_branch }} EVEREST_OPERATOR_BRANCH: ${{ github.event.inputs.everest_operator_branch }} - UPSTREAM_OPERATOR_IMAGE: ${{ github.event.inputs.upstream_operator_bundle_image }} - UPSTREAM_OPERATOR: ${{ github.event.inputs.upstream_operator }} + EVEREST_CATALOG_BRANCH: ${{ github.event.inputs.everest_catalog_branch }} VS_PORT: 8081 ARCH: "" @@ -82,11 +73,6 @@ jobs: exit 1 fi - if [[ -z "$UPSTREAM_OPERATOR" && ! -z "$UPSTREAM_OPERATOR_IMAGE" ]] || [[ ! -z "$UPSTREAM_OPERATOR" && -z "$UPSTREAM_OPERATOR_IMAGE" ]]; then - echo "upstream_operator and upstream_operator_bundle_image should both be either empty or non-empty." - exit 1 - fi - - name: Set environment variables run: | echo "ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')" >> $GITHUB_ENV @@ -266,43 +252,10 @@ jobs: uses: actions/checkout@v4 with: repository: percona/everest-catalog + ref: ${{ env.EVEREST_CATALOG_BRANCH }} path: everest-catalog token: ${{ secrets.ROBOT_TOKEN }} - - name: Catalog - update veneer file - run: | - cd everest-catalog/tools - go run . \ - --veneer-file ../veneer/everest-operator.yaml \ - --channel fast-v0 \ - --new-version ${{ env.VERSION }} \ - - cd .. - curl -Lo /tmp/opm https://github.com/operator-framework/operator-registry/releases/download/v1.48.0/${OS}-${ARCH}-opm - chmod +x /tmp/opm - /tmp/opm alpha render-template basic --skip-tls -o yaml < veneer/everest-operator.yaml > catalog/everest-operator/catalog.yaml - - # Check if catalog has the new version listed - if ! grep -q "$VERSION$" catalog/everest-operator/catalog.yaml; then - echo "catalog/everest-operator/catalog.yaml does not include the version $VERSION" - exit 1 - fi - - # If the feature build contains upstream upgrades - if [ -n "$UPSTREAM_OPERATOR" ]; then - # Add a new record to the upstream veneer - yq e ".Stable.Bundles += {\"Image\": \"$UPSTREAM_OPERATOR_IMAGE\"}" veneer/${UPSTREAM_OPERATOR}.yaml > temp.yaml && mv temp.yaml veneer/${UPSTREAM_OPERATOR}.yaml - - # Generate upstream catalog - /tmp/opm alpha render-template semver --skip-tls -o yaml < veneer/${UPSTREAM_OPERATOR}.yaml > catalog/${UPSTREAM_OPERATOR}/catalog.yaml - - # Check if upstream catalog has the new image listed - if ! grep -q "$UPSTREAM_OPERATOR_IMAGE$" catalog/${UPSTREAM_OPERATOR}/catalog.yaml; then - echo "catalog/${UPSTREAM_OPERATOR}/catalog.yaml does not include the version $UPSTREAM_OPERATOR_IMAGE" - exit 1 - fi - fi - - name: Catalog - setup Docker meta for everest-catalog id: catalog_meta uses: docker/metadata-action@v5 From 423641121964ea206f16153aa910f7d7508d1e32 Mon Sep 17 00:00:00 2001 From: Diogo Recharte Date: Tue, 21 Jan 2025 22:10:47 +0000 Subject: [PATCH 2/7] EVEREST-107 allow feature build to be called from another workflow --- .github/workflows/feature-build.yaml | 45 ++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/.github/workflows/feature-build.yaml b/.github/workflows/feature-build.yaml index 609c5cf55..9cbc9f1f4 100644 --- a/.github/workflows/feature-build.yaml +++ b/.github/workflows/feature-build.yaml @@ -27,6 +27,39 @@ on: required: false description: "How many days the artifacts will be stored in GitHub" default: 30 + workflow_call: + inputs: + everest_branch: + required: false + type: string + default: main + description: "Everest branch with the feature to checkout" + everest_operator_branch: + required: false + type: string + default: main + description: "Everest operator branch with the feature to checkout" + everest_catalog_branch: + required: false + type: string + default: main + description: "Everest catalog branch with the feature to checkout" + vs_branch: + required: false + type: string + default: production + description: "Version Service branch with the feature to checkout" + helm_branch: + required: false + type: string + default: main + description: "Helm charts branch with the feature to checkout" + artifacts_retention_days: + required: false + type: number + description: "How many days the artifacts will be stored in GitHub" + default: 30 + permissions: contents: read @@ -50,12 +83,12 @@ jobs: env: TOOLS_PATH: "/opt/tools/bin" - ARTIFACTS_RETENTION_DAYS: ${{ github.event.inputs.artifacts_retention_days }} - VS_BRANCH: ${{ github.event.inputs.vs_branch }} - HELM_BRANCH: ${{ github.event.inputs.helm_branch }} - EVEREST_BRANCH: ${{ github.event.inputs.everest_branch }} - EVEREST_OPERATOR_BRANCH: ${{ github.event.inputs.everest_operator_branch }} - EVEREST_CATALOG_BRANCH: ${{ github.event.inputs.everest_catalog_branch }} + ARTIFACTS_RETENTION_DAYS: ${{ inputs.artifacts_retention_days }} + VS_BRANCH: ${{ inputs.vs_branch }} + HELM_BRANCH: ${{ inputs.helm_branch }} + EVEREST_BRANCH: ${{ inputs.everest_branch }} + EVEREST_OPERATOR_BRANCH: ${{ inputs.everest_operator_branch }} + EVEREST_CATALOG_BRANCH: ${{ inputs.everest_catalog_branch }} VS_PORT: 8081 ARCH: "" From af2a4912937febc9b81fb70bfdc723307fa08b55 Mon Sep 17 00:00:00 2001 From: Diogo Recharte Date: Tue, 21 Jan 2025 22:11:35 +0000 Subject: [PATCH 3/7] EVEREST-107 feature build fallback to default branches --- .github/workflows/feature-build.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/feature-build.yaml b/.github/workflows/feature-build.yaml index 9cbc9f1f4..8640ccdb3 100644 --- a/.github/workflows/feature-build.yaml +++ b/.github/workflows/feature-build.yaml @@ -118,6 +118,13 @@ jobs: echo "VERSION_TAG=v$V" >> $GITHUB_ENV echo "VS_TAG=everest-test$TIMESTAMP" >> $GITHUB_ENV + # Fall back to default branch if the specified branch does not exist + git ls-remote --heads --exit-code --quiet https://github.com/Percona-Lab/percona-version-service.git $VS_BRANCH > /dev/null || echo "VS_BRANCH=production" >> $GITHUB_ENV + git ls-remote --heads --exit-code --quiet https://github.com/percona/percona-helm-charts.git $HELM_BRANCH > /dev/null || echo "HELM_BRANCH=main" >> $GITHUB_ENV + git ls-remote --heads --exit-code --quiet https://github.com/percona/everest.git $EVEREST_BRANCH > /dev/null || echo "EVEREST_BRANCH=main" >> $GITHUB_ENV + git ls-remote --heads --exit-code --quiet https://github.com/percona/everest-operator.git $EVEREST_OPERATOR_BRANCH > /dev/null || echo "EVEREST_OPERATOR_BRANCH=main" >> $GITHUB_ENV + git ls-remote --heads --exit-code --quiet https://github.com/percona/everest-catalog.git $EVEREST_CATALOG_BRANCH > /dev/null || echo "EVEREST_CATALOG_BRANCH=main" >> $GITHUB_ENV + - name: Create temporary directory for storing artifacts run: | mkdir -p /tmp/${VERSION} From 97e5007a18da4cbb522ef27ca576f5c840562763 Mon Sep 17 00:00:00 2001 From: Diogo Recharte Date: Tue, 21 Jan 2025 22:12:04 +0000 Subject: [PATCH 4/7] EVEREST-107 trigger feature build on PRs if label is set --- .github/workflows/feature-build-pr.yaml | 19 +++++++++++++++++++ .github/workflows/feature-build.yaml | 1 + 2 files changed, 20 insertions(+) create mode 100644 .github/workflows/feature-build-pr.yaml diff --git a/.github/workflows/feature-build-pr.yaml b/.github/workflows/feature-build-pr.yaml new file mode 100644 index 000000000..5b5cdfc53 --- /dev/null +++ b/.github/workflows/feature-build-pr.yaml @@ -0,0 +1,19 @@ +--- +name: Feature build (PR) +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review, labeled] + +jobs: + feature-build: + name: Feature build + if: contains(github.event.pull_request.labels.*.name, 'feature-build') + uses: ./.github/workflows/feature-build.yaml + with: + vs_branch: ${{ github.event.pull_request.head.ref }} + helm_branch: ${{ github.event.pull_request.head.ref }} + everest_branch: ${{ github.event.pull_request.head.ref }} + everest_operator_branch: ${{ github.event.pull_request.head.ref }} + everest_catalog_branch: ${{ github.event.pull_request.head.ref }} + artifacts_retention_days: 30 + secrets: inherit diff --git a/.github/workflows/feature-build.yaml b/.github/workflows/feature-build.yaml index 8640ccdb3..2104fc6ff 100644 --- a/.github/workflows/feature-build.yaml +++ b/.github/workflows/feature-build.yaml @@ -101,6 +101,7 @@ jobs: steps: - name: Input validation run: | + echo "ARTIFACTS_RETENTION_DAYS=$ARTIFACTS_RETENTION_DAYS" if [[ ! "$ARTIFACTS_RETENTION_DAYS" =~ ^[0-9]+$ ]]; then echo "Wrong artifacts_retention_days format. Use an integer number. 0 means default GitHub repo settings." exit 1 From c18a57921b11279580d409bf4a874ef9834ea402 Mon Sep 17 00:00:00 2001 From: Diogo Recharte Date: Tue, 21 Jan 2025 22:58:49 +0000 Subject: [PATCH 5/7] EVEREST-107 feature build print changed env vars to stdout This helps to understand with which params the FB was created --- .github/workflows/feature-build.yaml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/feature-build.yaml b/.github/workflows/feature-build.yaml index 2104fc6ff..f547c8ec3 100644 --- a/.github/workflows/feature-build.yaml +++ b/.github/workflows/feature-build.yaml @@ -109,22 +109,22 @@ jobs: - name: Set environment variables run: | - echo "ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')" >> $GITHUB_ENV - echo "OS=$(uname | awk '{print tolower($0)}')" >> $GITHUB_ENV - echo "VS_URL=http://localhost:$VS_PORT" >> $GITHUB_ENV + echo "ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')" | tee -a $GITHUB_ENV + echo "OS=$(uname | awk '{print tolower($0)}')" | tee -a $GITHUB_ENV + echo "VS_URL=http://localhost:$VS_PORT" | tee -a $GITHUB_ENV TIMESTAMP=$(date +'%Y%m%d%H%M%S') V="1.10000.0-rc$TIMESTAMP" - echo "VERSION=$V" >> $GITHUB_ENV - echo "VERSION_TAG=v$V" >> $GITHUB_ENV - echo "VS_TAG=everest-test$TIMESTAMP" >> $GITHUB_ENV + echo "VERSION=$V" | tee -a $GITHUB_ENV + echo "VERSION_TAG=v$V" | tee -a $GITHUB_ENV + echo "VS_TAG=everest-test$TIMESTAMP" | tee -a $GITHUB_ENV # Fall back to default branch if the specified branch does not exist - git ls-remote --heads --exit-code --quiet https://github.com/Percona-Lab/percona-version-service.git $VS_BRANCH > /dev/null || echo "VS_BRANCH=production" >> $GITHUB_ENV - git ls-remote --heads --exit-code --quiet https://github.com/percona/percona-helm-charts.git $HELM_BRANCH > /dev/null || echo "HELM_BRANCH=main" >> $GITHUB_ENV - git ls-remote --heads --exit-code --quiet https://github.com/percona/everest.git $EVEREST_BRANCH > /dev/null || echo "EVEREST_BRANCH=main" >> $GITHUB_ENV - git ls-remote --heads --exit-code --quiet https://github.com/percona/everest-operator.git $EVEREST_OPERATOR_BRANCH > /dev/null || echo "EVEREST_OPERATOR_BRANCH=main" >> $GITHUB_ENV - git ls-remote --heads --exit-code --quiet https://github.com/percona/everest-catalog.git $EVEREST_CATALOG_BRANCH > /dev/null || echo "EVEREST_CATALOG_BRANCH=main" >> $GITHUB_ENV + git ls-remote --heads --exit-code --quiet https://github.com/Percona-Lab/percona-version-service.git $VS_BRANCH > /dev/null || echo "VS_BRANCH=production" | tee -a $GITHUB_ENV + git ls-remote --heads --exit-code --quiet https://github.com/percona/percona-helm-charts.git $HELM_BRANCH > /dev/null || echo "HELM_BRANCH=main" | tee -a $GITHUB_ENV + git ls-remote --heads --exit-code --quiet https://github.com/percona/everest.git $EVEREST_BRANCH > /dev/null || echo "EVEREST_BRANCH=main" | tee -a $GITHUB_ENV + git ls-remote --heads --exit-code --quiet https://github.com/percona/everest-operator.git $EVEREST_OPERATOR_BRANCH > /dev/null || echo "EVEREST_OPERATOR_BRANCH=main" | tee -a $GITHUB_ENV + git ls-remote --heads --exit-code --quiet https://github.com/percona/everest-catalog.git $EVEREST_CATALOG_BRANCH > /dev/null || echo "EVEREST_CATALOG_BRANCH=main" | tee -a $GITHUB_ENV - name: Create temporary directory for storing artifacts run: | From 9b12257e639aef419ffe4b3d6010b11ebcf96ec1 Mon Sep 17 00:00:00 2001 From: Diogo Recharte Date: Tue, 21 Jan 2025 23:57:18 +0000 Subject: [PATCH 6/7] Update .github/workflows/feature-build.yaml --- .github/workflows/feature-build.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/feature-build.yaml b/.github/workflows/feature-build.yaml index f547c8ec3..e97c29656 100644 --- a/.github/workflows/feature-build.yaml +++ b/.github/workflows/feature-build.yaml @@ -101,7 +101,6 @@ jobs: steps: - name: Input validation run: | - echo "ARTIFACTS_RETENTION_DAYS=$ARTIFACTS_RETENTION_DAYS" if [[ ! "$ARTIFACTS_RETENTION_DAYS" =~ ^[0-9]+$ ]]; then echo "Wrong artifacts_retention_days format. Use an integer number. 0 means default GitHub repo settings." exit 1 From 0b25f3a071189d040ecb9ed3b17867baaac4e94e Mon Sep 17 00:00:00 2001 From: Diogo Recharte Date: Wed, 22 Jan 2025 13:16:16 +0000 Subject: [PATCH 7/7] EVEREST-107 update helm chart dep --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 0e3078677..12f3524cc 100644 --- a/go.mod +++ b/go.mod @@ -38,7 +38,7 @@ require ( github.com/operator-framework/api v0.27.0 github.com/operator-framework/operator-lifecycle-manager v0.27.0 github.com/percona/everest-operator v0.6.0-dev1.0.20250113063626-b38e7d1b3932 - github.com/percona/percona-helm-charts/charts/everest v0.0.0-20250117110506-e038d85918c5 + github.com/percona/percona-helm-charts/charts/everest v0.0.0-20250121193034-147d57a451a2 github.com/rodaine/table v1.3.0 github.com/spf13/cobra v1.8.1 github.com/spf13/viper v1.18.2 diff --git a/go.sum b/go.sum index 29a5c95f2..18fd339af 100644 --- a/go.sum +++ b/go.sum @@ -2228,8 +2228,8 @@ github.com/percona/everest-operator v0.6.0-dev1.0.20250113063626-b38e7d1b3932 h1 github.com/percona/everest-operator v0.6.0-dev1.0.20250113063626-b38e7d1b3932/go.mod h1:76ol+aF1CAkDey7kNkqmgtcjdTzJdEMFegfUiGS3q7M= github.com/percona/percona-backup-mongodb v1.8.1-0.20241002124601-957ac501f939 h1:OggdqSzqe9pO3A4GaRlrLwZXS3zEQ84O4+7Jm9cg74s= github.com/percona/percona-backup-mongodb v1.8.1-0.20241002124601-957ac501f939/go.mod h1:KhIlTT4wR2mIkMvDtEFerr9zaADJorL7UThSztzxBaY= -github.com/percona/percona-helm-charts/charts/everest v0.0.0-20250117110506-e038d85918c5 h1:+cv7z5tYacTjX7qaya5HYfIp3FB16zmChFKmJTVFLOY= -github.com/percona/percona-helm-charts/charts/everest v0.0.0-20250117110506-e038d85918c5/go.mod h1:j5Ci48Azwb4Xs4XvZQNfleWCn2uyiZywazklxNH1ut4= +github.com/percona/percona-helm-charts/charts/everest v0.0.0-20250121193034-147d57a451a2 h1:TZmpFfIXmF6FWT9DcyUXsGbSI0dYU3XPlHV+wDcCILg= +github.com/percona/percona-helm-charts/charts/everest v0.0.0-20250121193034-147d57a451a2/go.mod h1:j5Ci48Azwb4Xs4XvZQNfleWCn2uyiZywazklxNH1ut4= github.com/percona/percona-postgresql-operator v0.0.0-20241007204305-35d61aa5aebd h1:9RCUfPUxbdXuL/247r77DJmRSowDzA2xzZC9FpuLuUw= github.com/percona/percona-postgresql-operator v0.0.0-20241007204305-35d61aa5aebd/go.mod h1:ICbLstSO4zhYo+SFSciIWO9rLHQg29GJ1335L0tfhR0= github.com/percona/percona-server-mongodb-operator v1.18.0 h1:inRWonCOTacD++D/tvyFXVUqKx7f2OQzz8w1NyT3cAI=