Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STF 1.5.1 release ops #139

Merged
merged 8 commits into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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