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

task CSI-2892/add community checks to operator #157

Draft
wants to merge 55 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
f2952d0
add community checks to operator
matancarmeli7 May 13, 2021
9650ea5
add code review answers
matancarmeli7 May 16, 2021
58a46c1
complete the CI
matancarmeli7 May 18, 2021
135b96f
remove triger on push
matancarmeli7 May 18, 2021
352247c
use the fork way
matancarmeli7 Jun 9, 2021
3ca3975
answer codereview comments
matancarmeli7 Jun 10, 2021
b267d6d
remove sed from create_demo_pr.sh
matancarmeli7 Jun 10, 2021
f9fdda3
move back the sed command to create_pr
matancarmeli7 Jun 10, 2021
218a95a
pass operator_image_in_branch variable
matancarmeli7 Jun 10, 2021
975fc66
passed operator_image_for_test to CI-csi-demo-pr
matancarmeli7 Jun 10, 2021
362c38f
move csv_file variable to CI-csi-demo-pr
matancarmeli7 Jun 10, 2021
3bb0c93
add check and clean stages
matancarmeli7 Jun 10, 2021
89e065e
changed files name
matancarmeli7 Jun 10, 2021
f3959c6
add debug in the ci
matancarmeli7 Jun 10, 2021
c57a0a6
remove debug
matancarmeli7 Jun 10, 2021
4181fe0
add summary check
matancarmeli7 Jun 13, 2021
466059a
add install_ci_dependencies.sh file
matancarmeli7 Jun 13, 2021
aefc113
change fail check
matancarmeli7 Jun 13, 2021
68c5583
remove underscore
matancarmeli7 Jun 13, 2021
5fd4b11
add new line in install_ci_dependencies.sh
matancarmeli7 Jun 13, 2021
f58e6f4
create are_all_tests_were_passed function
matancarmeli7 Jun 14, 2021
ca18f57
add some cache handle
matancarmeli7 Jun 14, 2021
bf9eac4
fix image field in yq
matancarmeli7 Jun 14, 2021
afdc338
move variable to stage env
matancarmeli7 Jun 14, 2021
4584130
ignore error on pr checks
matancarmeli7 Jun 14, 2021
0672ae8
remove operator_image_in_branch variable
matancarmeli7 Jun 14, 2021
7e9d305
add github_build_number env parameter
matancarmeli7 Jun 15, 2021
88bd0a3
moved scripts to community dir
matancarmeli7 Jun 16, 2021
9386785
remove wrong `
matancarmeli7 Jun 16, 2021
5eff30a
call gh_pr_checks_command as variable
matancarmeli7 Jun 16, 2021
c0140d0
changed yq stracture
matancarmeli7 Jun 20, 2021
79bf3dc
removed shell from github actions
matancarmeli7 Jun 21, 2021
c30c381
add parameters to wait_fot_checks_to_start
matancarmeli7 Jun 21, 2021
caef19d
Merge branch 'develop' into task/CSI-2892_cert_community_operator_hub
matancarmeli7 Jun 21, 2021
219b1a2
change while check
matancarmeli7 Jun 30, 2021
28777cf
remove exports
matancarmeli7 Jun 30, 2021
e52e5f9
add loop for editing the csv file
matancarmeli7 Jun 30, 2021
8bf24e1
remove exports
matancarmeli7 Jul 1, 2021
2f2a1bd
eval repo_pr
matancarmeli7 Jul 1, 2021
0b6a6b5
change repo_pr
matancarmeli7 Jul 1, 2021
5f3c8dd
Merge branch 'develop' into task/CSI-2892_cert_community_operator_hub
matancarmeli7 Jul 12, 2021
abff90b
add some tickets
matancarmeli7 Jul 12, 2021
1fcdb33
add more permmisions to edit csv_file
matancarmeli7 Jul 12, 2021
e4b57bf
change wait for checks condition
matancarmeli7 Jul 13, 2021
75f4007
add some functions
matancarmeli7 Aug 4, 2021
c0bd35d
Merge branch 'develop' into task/CSI-2892_cert_community_operator_hub
matancarmeli7 Aug 4, 2021
d40871f
support new way of community operators
matancarmeli7 Aug 4, 2021
e9da769
add cd -
matancarmeli7 Aug 4, 2021
3e2f6d2
change master branch to main
matancarmeli7 Aug 4, 2021
c79479c
Merge branch 'develop' into task/CSI-2892_cert_community_operator_hub
matancarmeli7 Oct 3, 2021
d4a0f6b
remove file from function
matancarmeli7 Oct 3, 2021
a13fab7
copy only the latest csv
matancarmeli7 Oct 3, 2021
613014a
fix image_version
matancarmeli7 Oct 3, 2021
e25ec2b
remove test directory
matancarmeli7 Oct 4, 2021
7ff7b63
change comment on redhat
matancarmeli7 Oct 4, 2021
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
226 changes: 226 additions & 0 deletions .github/workflow/csi_operator_ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
name: Operator test

env:
OP_TEST_DEBUG: 1
OP_TEST_CONTAINER_OPT: "-t"
on:
push:
pull_request:
- develop
oriyarde marked this conversation as resolved.
Show resolved Hide resolved
jobs:
operator_image_build:
name: "set env"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
outputs:
operator_image: "csiblock1/ibm-block-csi-operator-amd64:new"

prepare_env:
name: "prepare_env"
needs: operator_image_build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: python -m pip install --upgrade pip yq
- uses: FranzDiebold/github-env-vars-action@v2
- name: prepare_env
id: environment_setup
env:
operator_image: ${{ needs.operator_image_build.outputs.operator_image }}
run: |
build/ci/prepare_env.sh
outputs:
current_operator_image: "${{ steps.environment_setup.outputs.current_operator_image }}"
wanted_operator_image: "${{ steps.environment_setup.outputs.wanted_operator_image }}"
csv_file: "${{ steps.environment_setup.outputs.csv_file }}"
community_operators_path: "${{ steps.environment_setup.outputs.community_operators_path }}"
upstream_community_operators_path: "${{ steps.environment_setup.outputs.upstream_community_operators_path }}"
repository_path: "${{ steps.environment_setup.outputs.repository_path }}"

CI-csi-kiwi:
name: "kiwi / Full operator test"
needs: prepare_env
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: update_csv
run: |
build/ci/update_csv.sh
oriyarde marked this conversation as resolved.
Show resolved Hide resolved
env:
current_operator_image: ${{ needs.prepare_env.outputs.current_operator_image }}
wanted_operator_image: ${{ needs.prepare_env.outputs.wanted_operator_image }}
csv_file: ${{ needs.prepare_env.outputs.csv_file }}
repository_path: ${{ needs.prepare_env.outputs.repository_path }}
- name: Operator test
run: |
echo "kiwi ${{ needs.prepare_env.outputs.upstream_community_operators_path }}"
build/ci/op-test.sh kiwi "${{ needs.prepare_env.outputs.upstream_community_operators_path }}"

CI-csi-lemon:
name: "lemon / Deploy from scratch"
needs: prepare_env
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: update_csv
run: |
build/ci/update_csv.sh
env:
current_operator_image: ${{ needs.prepare_env.outputs.current_operator_image }}
wanted_operator_image: ${{ needs.prepare_env.outputs.wanted_operator_image }}
csv_file: ${{ needs.prepare_env.outputs.csv_file }}
repository_path: ${{ needs.prepare_env.outputs.repository_path }}
- name: Operator test
run: |
echo "lemon ${{ needs.prepare_env.outputs.upstream_community_operators_path }}"
build/ci/op-test.sh lemon "${{ needs.prepare_env.outputs.upstream_community_operators_path }}"

CI-csi-lemon-openshift_4_6:
name: "lemon / Deploy from scratch (v4.6)"
needs: prepare_env
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: update_csv
run: |
build/ci/update_csv.sh
env:
current_operator_image: ${{ needs.prepare_env.outputs.current_operator_image }}
wanted_operator_image: ${{ needs.prepare_env.outputs.wanted_operator_image }}
csv_file: ${{ needs.prepare_env.outputs.csv_file }}
repository_path: ${{ needs.prepare_env.outputs.repository_path }}
- name: Operator test
run: |
echo "lemon_v4.6 ${{ needs.prepare_env.outputs.community_operators_path }}"
build/ci/op-test.sh lemon_v4.6 "${{ needs.prepare_env.outputs.community_operators_path }}"

CI-csi-lemon-openshift_4_7:
name: "lemon / Deploy from scratch (v4.7)"
needs: prepare_env
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: update_csv
run: |
build/ci/update_csv.sh
env:
current_operator_image: ${{ needs.prepare_env.outputs.current_operator_image }}
wanted_operator_image: ${{ needs.prepare_env.outputs.wanted_operator_image }}
csv_file: ${{ needs.prepare_env.outputs.csv_file }}
repository_path: ${{ needs.prepare_env.outputs.repository_path }}
- name: Operator test
run: |
echo "lemon_v4.7 ${{ needs.prepare_env.outputs.community_operators_path }}"
build/ci/op-test.sh lemon_v4.7 "${{ needs.prepare_env.outputs.community_operators_path }}"

CI-csi-lemon-openshift_4_8:
name: "lemon / Deploy from scratch (v4.8)"
needs: prepare_env
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: update_csv
run: |
build/ci/update_csv.sh
env:
current_operator_image: ${{ needs.prepare_env.outputs.current_operator_image }}
wanted_operator_image: ${{ needs.prepare_env.outputs.wanted_operator_image }}
csv_file: ${{ needs.prepare_env.outputs.csv_file }}
repository_path: ${{ needs.prepare_env.outputs.repository_path }}
- name: Operator test
run: |
echo "lemon_v4.8 ${{ needs.prepare_env.outputs.community_operators_path }}"
build/ci/op-test.sh lemon_v4.8 "${{ needs.prepare_env.outputs.community_operators_path }}"

CI-csi-orange-k8s:
name: "orange / Deploy k8s latest"
needs: prepare_env
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: update_csv
run: |
build/ci/update_csv.sh
env:
current_operator_image: ${{ needs.prepare_env.outputs.current_operator_image }}
wanted_operator_image: ${{ needs.prepare_env.outputs.wanted_operator_image }}
csv_file: ${{ needs.prepare_env.outputs.csv_file }}
repository_path: ${{ needs.prepare_env.outputs.repository_path }}
- name: Operator test
run: |
echo "orange ${{ needs.prepare_env.outputs.upstream_community_operators_path }}"
build/ci/op-test.sh orange "${{ needs.prepare_env.outputs.upstream_community_operators_path }}"

CI-csi-orange-openshift_4_6:
name: "orange / Deploy openshift v4.6"
needs: prepare_env
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: update_csv
run: |
build/ci/update_csv.sh
env:
current_operator_image: ${{ needs.prepare_env.outputs.current_operator_image }}
wanted_operator_image: ${{ needs.prepare_env.outputs.wanted_operator_image }}
csv_file: ${{ needs.prepare_env.outputs.csv_file }}
repository_path: ${{ needs.prepare_env.outputs.repository_path }}
- name: Operator test
run: |
echo "orange_v4.6 ${{ needs.prepare_env.outputs.community_operators_path }}"
build/ci/op-test.sh orange_v4.6 "${{ needs.prepare_env.outputs.community_operators_path }}"

CI-csi-orange-openshift_4_7:
name: "orange / Deploy openshift v4.7"
needs: prepare_env
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: update_csv
run: |
build/ci/update_csv.sh
env:
current_operator_image: ${{ needs.prepare_env.outputs.current_operator_image }}
wanted_operator_image: ${{ needs.prepare_env.outputs.wanted_operator_image }}
csv_file: ${{ needs.prepare_env.outputs.csv_file }}
repository_path: ${{ needs.prepare_env.outputs.repository_path }}
- name: Operator test
run: |
echo "orange_v4.7 ${{ needs.prepare_env.outputs.community_operators_path }}"
build/ci/op-test.sh orange_v4.7 "${{ needs.prepare_env.outputs.community_operators_path }}"

CI-csi-orange-openshift_4_8:
name: "orange / Deploy openshift v4.8"
needs: prepare_env
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: update_csv
run: |
build/ci/update_csv.sh
env:
current_operator_image: ${{ needs.prepare_env.outputs.current_operator_image }}
wanted_operator_image: ${{ needs.prepare_env.outputs.wanted_operator_image }}
csv_file: ${{ needs.prepare_env.outputs.csv_file }}
repository_path: ${{ needs.prepare_env.outputs.repository_path }}
- name: Operator test
run: |
echo "orange_v4.8 ${{ needs.prepare_env.outputs.community_operators_path }}"
build/ci/op-test.sh orange_v4.8 "${{ needs.prepare_env.outputs.community_operators_path }}"
oriyarde marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 9 additions & 0 deletions build/ci/op-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
set -e

OP_TEST_SCRIPT_URL=${OP_TEST_SCRIPT_URL-"https://raw.githubusercontent.com/operator-framework/operator-test-playbooks/master/upstream/test/test.sh"}

bash <(curl -sL $OP_TEST_SCRIPT_URL) $*
rc=$?
echo "rc=$rc"
oriyarde marked this conversation as resolved.
Show resolved Hide resolved
[[ $rc -eq 0 ]] || { echo "Error: rc=$rc"; exit $rc; }
20 changes: 20 additions & 0 deletions build/ci/prepare_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash -xe
set +o pipefail

export csv_version=`yq .channels[0].currentCSV deploy/olm-catalog/ibm-block-csi-operator-community/ibm-block-csi-operator.package.yaml`
export csv_version=`echo ${csv_version//ibm-block-csi-operator.v}`
export csv_version=`echo ${csv_version//\"}`
oriyarde marked this conversation as resolved.
Show resolved Hide resolved
export repository_path=~/work/$CI_REPOSITORY_NAME/$CI_REPOSITORY_NAME
export csv_file=$repository_path/deploy/olm-catalog/ibm-block-csi-operator-community/$csv_version/ibm-block-csi-operator.v$csv_version.clusterserviceversion.yaml
export wanted_image=$operator_image
export current_image=`yq .metadata.annotations.containerImage $csv_file`
export current_image=`echo ${current_image//\"}`
export upstream_community_operators_path=upstream-community-operators/ibm-block-csi-operator-community/$csv_version
export community_operators_path=community-operators/ibm-block-csi-operator-community/$csv_version

echo "::set-output name=current_operator_image::${current_image}"
echo "::set-output name=wanted_operator_image::${wanted_image}"
echo "::set-output name=csv_file::${csv_file}"
echo "::set-output name=upstream_community_operators_path::${upstream_community_operators_path}"
echo "::set-output name=community_operators_path::${community_operators_path}"
echo "::set-output name=repository_path::${repository_path}"
oriyarde marked this conversation as resolved.
Show resolved Hide resolved
11 changes: 11 additions & 0 deletions build/ci/update_csv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash -xe
set +o pipefail

sed -i "s+$current_operator_image+$wanted_operator_image+g" $csv_file
sed -i 's/.*minKubeVersion.*/ minKubeVersion: 1.19.0/' $csv_file
matancarmeli7 marked this conversation as resolved.
Show resolved Hide resolved

mkdir $repository_path/upstream-community-operators/
mkdir $repository_path/community-operators/

cp -r $repository_path/deploy/olm-catalog/ibm-block-csi-operator-community/ $repository_path/upstream-community-operators/
cp -r $repository_path/deploy/olm-catalog/ibm-block-csi-operator-community/ $repository_path/community-operators/