From 29417a46ee242cdd44abcb3807c44ab420d3e9dc Mon Sep 17 00:00:00 2001 From: Leif Madsen Date: Fri, 28 Oct 2022 16:35:22 -0400 Subject: [PATCH 1/7] Lock the bundle to OCP v4.10 (#125) --- deploy/olm-catalog/smart-gateway-operator/Dockerfile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/olm-catalog/smart-gateway-operator/Dockerfile.in b/deploy/olm-catalog/smart-gateway-operator/Dockerfile.in index cad1c65..e187479 100644 --- a/deploy/olm-catalog/smart-gateway-operator/Dockerfile.in +++ b/deploy/olm-catalog/smart-gateway-operator/Dockerfile.in @@ -13,7 +13,7 @@ LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1 LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v0.19.4 LABEL operators.operatorframework.io.metrics.project_layout=ansible LABEL com.redhat.delivery.operator.bundle=true -LABEL com.redhat.openshift.versions="v4.10" +LABEL com.redhat.openshift.versions="=v4.10" LABEL com.redhat.delivery.backport=false LABEL com.redhat.component="smart-gateway-operator-bundle-container" \ From e05bd8ffe93941fb6100ff0136086efe8c646f57 Mon Sep 17 00:00:00 2001 From: Leif Madsen Date: Tue, 15 Nov 2022 09:11:36 -0500 Subject: [PATCH 2/7] Fix the valid-subscription annotation (#127) --- .../manifests/smart-gateway-operator.clusterserviceversion.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/deploy/olm-catalog/smart-gateway-operator/manifests/smart-gateway-operator.clusterserviceversion.yaml b/deploy/olm-catalog/smart-gateway-operator/manifests/smart-gateway-operator.clusterserviceversion.yaml index c859786..648c304 100644 --- a/deploy/olm-catalog/smart-gateway-operator/manifests/smart-gateway-operator.clusterserviceversion.yaml +++ b/deploy/olm-catalog/smart-gateway-operator/manifests/smart-gateway-operator.clusterserviceversion.yaml @@ -73,6 +73,8 @@ metadata: olm.skipRange: =><> <<> operators.operatorframework.io/builder: operator-sdk-v0.19.4 operators.operatorframework.io/project_layout: ansible + operators.openshift.io/valid-subscription: '["OpenStack Platform", "Cloud Infrastructure", + "Cloud Suite"]' repository: https://github.com/infrawatch/smart-gateway-operator support: Red Hat name: smart-gateway-operator.v1.99.0 From 07a2c71bfbf93baa8f6f5d3870e75b2b19868318 Mon Sep 17 00:00:00 2001 From: Leif Madsen Date: Fri, 18 Nov 2022 11:28:37 -0500 Subject: [PATCH 3/7] Expand support for OCP 4.11 (#130) --- deploy/olm-catalog/smart-gateway-operator/Dockerfile.in | 2 +- .../manifests/smart-gateway-operator.clusterserviceversion.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy/olm-catalog/smart-gateway-operator/Dockerfile.in b/deploy/olm-catalog/smart-gateway-operator/Dockerfile.in index e187479..870ebdd 100644 --- a/deploy/olm-catalog/smart-gateway-operator/Dockerfile.in +++ b/deploy/olm-catalog/smart-gateway-operator/Dockerfile.in @@ -13,7 +13,7 @@ LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1 LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v0.19.4 LABEL operators.operatorframework.io.metrics.project_layout=ansible LABEL com.redhat.delivery.operator.bundle=true -LABEL com.redhat.openshift.versions="=v4.10" +LABEL com.redhat.openshift.versions="v4.10-v4.11" LABEL com.redhat.delivery.backport=false LABEL com.redhat.component="smart-gateway-operator-bundle-container" \ diff --git a/deploy/olm-catalog/smart-gateway-operator/manifests/smart-gateway-operator.clusterserviceversion.yaml b/deploy/olm-catalog/smart-gateway-operator/manifests/smart-gateway-operator.clusterserviceversion.yaml index 648c304..ab6f62a 100644 --- a/deploy/olm-catalog/smart-gateway-operator/manifests/smart-gateway-operator.clusterserviceversion.yaml +++ b/deploy/olm-catalog/smart-gateway-operator/manifests/smart-gateway-operator.clusterserviceversion.yaml @@ -69,7 +69,7 @@ metadata: createdAt: <> description: Operator for managing the Smart Gateway Custom Resources, resulting in deployments of the Smart Gateway. - olm.properties: '[{"type": "olm.maxOpenShiftVersion", "value": "4.10"}]' + olm.properties: '[{"type": "olm.maxOpenShiftVersion", "value": "4.11"}]' olm.skipRange: =><> <<> operators.operatorframework.io/builder: operator-sdk-v0.19.4 operators.operatorframework.io/project_layout: ansible From db1fdcb9f24df6bf0c6cbf43d091490b5e33c93a Mon Sep 17 00:00:00 2001 From: Chris Sibbitt Date: Tue, 24 Jan 2023 16:54:39 -0500 Subject: [PATCH 4/7] Changes for 4.12 (#134) --- deploy/olm-catalog/smart-gateway-operator/Dockerfile.in | 2 +- .../manifests/smart-gateway-operator.clusterserviceversion.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy/olm-catalog/smart-gateway-operator/Dockerfile.in b/deploy/olm-catalog/smart-gateway-operator/Dockerfile.in index 870ebdd..ea4c487 100644 --- a/deploy/olm-catalog/smart-gateway-operator/Dockerfile.in +++ b/deploy/olm-catalog/smart-gateway-operator/Dockerfile.in @@ -13,7 +13,7 @@ LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1 LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v0.19.4 LABEL operators.operatorframework.io.metrics.project_layout=ansible LABEL com.redhat.delivery.operator.bundle=true -LABEL com.redhat.openshift.versions="v4.10-v4.11" +LABEL com.redhat.openshift.versions="v4.10-v4.12" LABEL com.redhat.delivery.backport=false LABEL com.redhat.component="smart-gateway-operator-bundle-container" \ diff --git a/deploy/olm-catalog/smart-gateway-operator/manifests/smart-gateway-operator.clusterserviceversion.yaml b/deploy/olm-catalog/smart-gateway-operator/manifests/smart-gateway-operator.clusterserviceversion.yaml index ab6f62a..ee8d5d2 100644 --- a/deploy/olm-catalog/smart-gateway-operator/manifests/smart-gateway-operator.clusterserviceversion.yaml +++ b/deploy/olm-catalog/smart-gateway-operator/manifests/smart-gateway-operator.clusterserviceversion.yaml @@ -69,7 +69,7 @@ metadata: createdAt: <> description: Operator for managing the Smart Gateway Custom Resources, resulting in deployments of the Smart Gateway. - olm.properties: '[{"type": "olm.maxOpenShiftVersion", "value": "4.11"}]' + olm.properties: '[{"type": "olm.maxOpenShiftVersion", "value": "4.12"}]' olm.skipRange: =><> <<> operators.operatorframework.io/builder: operator-sdk-v0.19.4 operators.operatorframework.io/project_layout: ansible From df23d639c878ac6b4ecdfdd38003042ee07dd208 Mon Sep 17 00:00:00 2001 From: Leif Madsen Date: Tue, 28 Feb 2023 09:11:22 -0500 Subject: [PATCH 5/7] GHA checkout action v2 is deprecated (#135) The GitHub Actions checkout action v2 is deprecated and needs to move to version 3. --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e8fe92d..9ca7c1a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install Ansible run: python -m pip install 'ansible <= 2.9' @@ -43,7 +43,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Verify image builds run: docker build --tag infrawatch/smart-gateway-operator:latest --file build/Dockerfile . @@ -54,7 +54,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Get operator-sdk image run: curl --output operator-sdk -JL https://github.com/operator-framework/operator-sdk/releases/download/$RELEASE_VERSION/operator-sdk-$RELEASE_VERSION-x86_64-linux-gnu From 1d76c82d51ae42ea064a3d1d148899860c32da50 Mon Sep 17 00:00:00 2001 From: Leif Madsen Date: Fri, 3 Mar 2023 09:56:05 -0500 Subject: [PATCH 6/7] Implement changes for operator-sdk-1.26.0 testing (#137) * Implement changes for operator-sdk-1.26.0 testing Implement changes that allow testing validation via operator-sdk-1.26.0 without bumping the entire bundle generation process from operator-sdk-0.19.4 to post-operator-sdk-1.x. These are the same tests run for validation during product pipeline verification. * Adds test to verify building of the bundle image works. * Adds KinD deployment to allow executing scorecard checks. Related: STF-1252 * Simplify use of RELEASE_VERSION variable --- .github/workflows/main.yml | 78 +++++++++++++------ build/generate_bundle.sh | 8 ++ ...ateway-operator.clusterserviceversion.yaml | 1 - .../metadata/properties.yaml | 4 + .../tests/scorecard/config.yaml | 21 +++++ 5 files changed, 89 insertions(+), 23 deletions(-) create mode 100644 deploy/olm-catalog/smart-gateway-operator/metadata/properties.yaml create mode 100644 deploy/olm-catalog/smart-gateway-operator/tests/scorecard/config.yaml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9ca7c1a..dd6f9bd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,24 +21,8 @@ jobs: - name: Lint Ansible roles/smartgateway/ directory run: ${HOME}/.local/bin/ansible-lint roles/smartgateway -# super-linting: -# name: Super Linting -# runs-on: ubuntu-20.04 -# steps: -# - name: Checkout code -# uses: actions/checkout@v2 -# -# - name: Install operator_sdk.util dependency for Ansible role linting -# run: ansible-galaxy collection install operator_sdk.util -# -# - name: Run Super-Linter -# uses: github/super-linter@v3 -# env: -# DEFAULT_BRANCH: master -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - build-check: - name: Build check + build-operator-check: + name: Build Operator check runs-on: ubuntu-20.04 steps: @@ -48,15 +32,46 @@ jobs: - name: Verify image builds run: docker build --tag infrawatch/smart-gateway-operator:latest --file build/Dockerfile . - bundle-check: - name: Bundle check + build-bundle-check: + name: Build bundle check runs-on: ubuntu-20.04 + env: + RELEASE_VERSION: v0.19.4 steps: - name: Checkout code uses: actions/checkout@v3 - - name: Get operator-sdk image + - name: Get operator-sdk image 0.19.4 + run: curl --output operator-sdk -JL https://github.com/operator-framework/operator-sdk/releases/download/$RELEASE_VERSION/operator-sdk-$RELEASE_VERSION-x86_64-linux-gnu + + - name: Make operator-sdk executable + run: chmod +x operator-sdk + + - name: Move operator-sdk binary + run: sudo mv operator-sdk /usr/local/bin + + - name: Create working directory + run: mkdir /tmp/bundle + + - name: Generate bundle + run: WORKING_DIR=/tmp/bundle ./build/generate_bundle.sh + + - name: Verify image builds + run: docker build --tag infrawatch/smart-gateway-operator:latest --file build/Dockerfile . + + check-bundle-validation-scorecard: + name: Validate the generated bundle and perform scorecard checks + runs-on: ubuntu-20.04 + env: + RELEASE_VERSION: v1.26.0 + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + # prepare environment to buld the bundle + - name: Get operator-sdk image 0.19.4 run: curl --output operator-sdk -JL https://github.com/operator-framework/operator-sdk/releases/download/$RELEASE_VERSION/operator-sdk-$RELEASE_VERSION-x86_64-linux-gnu env: RELEASE_VERSION: v0.19.4 @@ -70,8 +85,27 @@ jobs: - name: Create working directory run: mkdir /tmp/bundle + # generate the bundle using operator-sdk-0.19.4 - name: Generate bundle run: WORKING_DIR=/tmp/bundle ./build/generate_bundle.sh + # prepare the environment to run bundle validation and bundle scorecard checks + - name: Get operator-sdk image 1.26.0 + run: curl --output operator-sdk-$RELEASE_VERSION -JL https://github.com/operator-framework/operator-sdk/releases/download/$RELEASE_VERSION/operator-sdk_linux_amd64 + + - name: Make operator-sdk executable + run: chmod +x operator-sdk-$RELEASE_VERSION + + - name: Move operator-sdk binary + run: sudo mv operator-sdk-$RELEASE_VERSION /usr/local/bin + + # perform bundle validation - name: Check bundle validation - run: operator-sdk bundle validate --verbose /tmp/bundle + run: operator-sdk-$RELEASE_VERSION bundle validate --verbose /tmp/bundle + + - name: Create KinD cluster to execute scorecard tests + uses: helm/kind-action@v1.4.0 + + # perform scorecard checks against a KinD cluster + - name: Check scorecord validation + run: operator-sdk-$RELEASE_VERSION scorecard --verbose /tmp/bundle diff --git a/build/generate_bundle.sh b/build/generate_bundle.sh index 338b516..2497e7e 100755 --- a/build/generate_bundle.sh +++ b/build/generate_bundle.sh @@ -38,6 +38,13 @@ generate_bundle() { echo "---- Generated bundle complete at ${WORKING_DIR}/manifests/${OPERATOR_NAME}.clusterserviceversion.yaml" } +copy_extra_metadata() { + echo "-- Copy extra metadata in" + pushd "${REL}/../" + cp -r ./deploy/olm-catalog/smart-gateway-operator/tests/ "${WORKING_DIR}" + cp ./deploy/olm-catalog/smart-gateway-operator/metadata/properties.yaml "${WORKING_DIR}/metadata/" +} + build_bundle_instructions() { echo "-- Commands to create a bundle build" echo docker build -t "${OPERATOR_BUNDLE_IMAGE}:${OPERATOR_BUNDLE_VERSION}" -f "${WORKING_DIR}/Dockerfile" "${WORKING_DIR}" @@ -51,5 +58,6 @@ generate_version create_working_dir generate_dockerfile generate_bundle +copy_extra_metadata build_bundle_instructions echo "## End Bundle creation" diff --git a/deploy/olm-catalog/smart-gateway-operator/manifests/smart-gateway-operator.clusterserviceversion.yaml b/deploy/olm-catalog/smart-gateway-operator/manifests/smart-gateway-operator.clusterserviceversion.yaml index ee8d5d2..e964e96 100644 --- a/deploy/olm-catalog/smart-gateway-operator/manifests/smart-gateway-operator.clusterserviceversion.yaml +++ b/deploy/olm-catalog/smart-gateway-operator/manifests/smart-gateway-operator.clusterserviceversion.yaml @@ -69,7 +69,6 @@ metadata: createdAt: <> description: Operator for managing the Smart Gateway Custom Resources, resulting in deployments of the Smart Gateway. - olm.properties: '[{"type": "olm.maxOpenShiftVersion", "value": "4.12"}]' olm.skipRange: =><> <<> operators.operatorframework.io/builder: operator-sdk-v0.19.4 operators.operatorframework.io/project_layout: ansible diff --git a/deploy/olm-catalog/smart-gateway-operator/metadata/properties.yaml b/deploy/olm-catalog/smart-gateway-operator/metadata/properties.yaml new file mode 100644 index 0000000..495e66a --- /dev/null +++ b/deploy/olm-catalog/smart-gateway-operator/metadata/properties.yaml @@ -0,0 +1,4 @@ + olm.properties: '[{"type": "olm.maxOpenShiftVersion", "value": "4.10"}]' +properties: + - type: olm.maxOpenShiftVersion + value: "4.10" diff --git a/deploy/olm-catalog/smart-gateway-operator/tests/scorecard/config.yaml b/deploy/olm-catalog/smart-gateway-operator/tests/scorecard/config.yaml new file mode 100644 index 0000000..dc0bae3 --- /dev/null +++ b/deploy/olm-catalog/smart-gateway-operator/tests/scorecard/config.yaml @@ -0,0 +1,21 @@ +kind: Configuration +apiversion: scorecard.operatorframework.io/v1alpha3 +metadata: + name: config +stages: +- parallel: true + tests: + - image: quay.io/operator-framework/scorecard-test:latest + entrypoint: + - scorecard-test + - basic-check-spec + labels: + suite: basic + test: basic-check-spec-test + - image: quay.io/operator-framework/scorecard-test:latest + entrypoint: + - scorecard-test + - olm-bundle-validation + labels: + suite: olm + test: olm-bundle-validation-test From 51a3724913adf770540a4d1f1dcdf86fe746ee5b Mon Sep 17 00:00:00 2001 From: Chris Sibbitt Date: Mon, 6 Mar 2023 14:57:31 -0500 Subject: [PATCH 7/7] maxOpenShiftVersion 4.12 in OLM properties (#138) * maxOpenShiftVersion 4.12 in OLM properties * Remove invalid line from properties.yaml --------- Co-authored-by: Leif Madsen --- .../smart-gateway-operator/metadata/properties.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/deploy/olm-catalog/smart-gateway-operator/metadata/properties.yaml b/deploy/olm-catalog/smart-gateway-operator/metadata/properties.yaml index 495e66a..8edfa0d 100644 --- a/deploy/olm-catalog/smart-gateway-operator/metadata/properties.yaml +++ b/deploy/olm-catalog/smart-gateway-operator/metadata/properties.yaml @@ -1,4 +1,3 @@ - olm.properties: '[{"type": "olm.maxOpenShiftVersion", "value": "4.10"}]' properties: - type: olm.maxOpenShiftVersion - value: "4.10" + value: "4.12"