Skip to content

Commit

Permalink
STF 1.5.1 release ops (#139)
Browse files Browse the repository at this point in the history
* Lock the bundle to OCP v4.10 (#125)

* Fix the valid-subscription annotation (#127)

* Expand support for OCP 4.11 (#130)

* Changes for 4.12 (#134)

* GHA checkout action v2 is deprecated (#135)

The GitHub Actions checkout action v2 is deprecated and needs to move to
version 3.

* 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

* maxOpenShiftVersion 4.12 in OLM properties (#138)

* maxOpenShiftVersion 4.12 in OLM properties

* Remove invalid line from properties.yaml

---------

Co-authored-by: Leif Madsen <lmadsen@redhat.com>

---------

Co-authored-by: Leif Madsen <lmadsen@redhat.com>
  • Loading branch information
csibbitt and leifmadsen authored Mar 6, 2023
1 parent 7b6d580 commit 68808c3
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 24 deletions.
78 changes: 56 additions & 22 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
8 changes: 8 additions & 0 deletions build/generate_bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -51,5 +58,6 @@ generate_version
create_working_dir
generate_dockerfile
generate_bundle
copy_extra_metadata
build_bundle_instructions
echo "## End Bundle creation"
2 changes: 1 addition & 1 deletion deploy/olm-catalog/smart-gateway-operator/Dockerfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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.12"
LABEL com.redhat.delivery.backport=false

LABEL com.redhat.component="smart-gateway-operator-bundle-container" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ metadata:
createdAt: <<CREATED_DATE>>
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.skipRange: =><<BUNDLE_OLM_SKIP_RANGE_LOWER_BOUND>> <<<OPERATOR_BUNDLE_VERSION>>
operators.operatorframework.io/builder: operator-sdk-v0.19.4
operators.operatorframework.io/project_layout: ansible
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
properties:
- type: olm.maxOpenShiftVersion
value: "4.12"
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 68808c3

Please sign in to comment.