@@ -199,6 +199,34 @@ jobs:
199199 - store_artifacts :
200200 path : /tmp/logs/test/integration/kind-helm
201201 working_directory : ~/kubernetes-monitor
202+ integration_tests_operator_on_k8s :
203+ machine :
204+ docker_layer_caching : true
205+ enabled : true
206+ steps :
207+ - checkout
208+ - setup_node12
209+ - install_python_requests
210+ - run :
211+ command : mkdir -p /tmp/logs/test/integration/kind-olm-operator
212+ name : Create temporary directory for logs
213+ - run :
214+ command : |
215+ export KUBERNETES_MONITOR_IMAGE_NAME_AND_TAG=$(./scripts/circleci-jobs/setup-integration-tests.py)
216+ .circleci/do-exclusively --branch staging --job ${CIRCLE_JOB} npm run test:integration:kindolm:operator
217+ name : Operator integration tests on plain k8s
218+ - run :
219+ command : |
220+ ./scripts/operator/delete-operator-from-quay.sh
221+ name : Delete Operator from Quay
222+ - run :
223+ command : |
224+ ./scripts/slack/notify_failure_on_branch.py "staging-integration-tests-operator-on-k8s-${CIRCLE_SHA1}"
225+ name : Notify Slack on failure
226+ when : on_fail
227+ - store_artifacts :
228+ path : /tmp/logs/test/integration/kind-olm-operator
229+ working_directory : ~/kubernetes-monitor
202230 integration_tests_proxy :
203231 machine :
204232 docker_layer_caching : true
@@ -214,7 +242,7 @@ jobs:
214242 command : |
215243 export KUBERNETES_MONITOR_IMAGE_NAME_AND_TAG=$(./scripts/circleci-jobs/setup-integration-tests.py)
216244 npm run test:integration:kind:proxy
217- name : Integration tests with Helm deployment
245+ name : Integration tests with proxy
218246 - run :
219247 command : |
220248 ./scripts/slack/notify_failure_on_branch.py "staging-integration-proxy-tests-${CIRCLE_SHA1}"
@@ -570,7 +598,7 @@ jobs:
570598 - 06:c3:d4:10:0d:ef:37:6c:ec:b9:fb:6e:ed:09:e7:40
571599 - run :
572600 command : |
573- python -m pip install requests pyyaml
601+ python -m pip install requests pyyaml PyGithub
574602 name : Install required packages
575603 - install_python_requests
576604 - run :
@@ -599,42 +627,85 @@ jobs:
599627 name : Package Operator
600628 - run :
601629 command : |
602- set -xeo pipefail
603-
604630 CURRENT_DIRECTORY=$(pwd)
605- COMMUNITY_OPERATORS_UPSTREAM_LOCATION="${CURRENT_DIRECTORY}/community-operators"
606- DEPLOY_LOCATION="${COMMUNITY_OPERATORS_UPSTREAM_LOCATION}/community-operators"
607- OPERATOR_LOCATION="${CURRENT_DIRECTORY}/snyk-operator/deploy/olm-catalog/snyk-operator"
608-
609- # Configure git user and gpg key
610- echo "${OPENSHIFT_OPERATOR_SIGNING_KEY_BASE64}" | base64 -d | gpg --import
611- git config --global commit.gpgsign true
612- git config --global user.signingkey "${OPENSHIFT_OPERATOR_SIGNING_KEY_ID}"
613- git config --global user.email "${OPENSHIFT_OPERATOR_GITHUB_EMAIL}"
614- git config --global user.name "${OPENSHIFT_OPERATOR_GITHUB_NAME}"
615-
616- # Clone Community Operators repo from Snyk
617- git clone https://github.com/snyk/community-operators.git $COMMUNITY_OPERATORS_UPSTREAM_LOCATION
618- cd "${COMMUNITY_OPERATORS_UPSTREAM_LOCATION}"
619- git checkout -b snyk/snyk-operator-v${NEW_OPERATOR_VERSION}
620-
621- # Copy new release to branch
622- cp -r "${OPERATOR_LOCATION}/${NEW_OPERATOR_VERSION}" "${DEPLOY_LOCATION}/snyk-operator/."
623- cp "${OPERATOR_LOCATION}/snyk-operator.package.yaml" "${DEPLOY_LOCATION}/snyk-operator/."
624-
625- # Create the signed commit and push
626- git add "${DEPLOY_LOCATION}/snyk-operator/*"
627- git commit -s -m "Upgrade snyk-operator to version ${NEW_OPERATOR_VERSION}"
628- git push --set-upstream origin --force snyk/snyk-operator-v${NEW_OPERATOR_VERSION}
631+ COMMUNITY_FOLDER_LOCATION="community-operators"
632+ ./scripts/operator/push-operator-to-snyk-upstream.sh "${CURRENT_DIRECTORY}" "${COMMUNITY_FOLDER_LOCATION}"
629633 name : Push new Operator to the fork of the community-operators repository
630634 - run :
631635 command : |
632- ./scripts/slack/notify_success_operator_push.py "${NEW_OPERATOR_VERSION}"
636+ COMMUNITY_FOLDER_LOCATION="community-operators"
637+ python ./scripts/operator/raise_pr_to_community_operators_from_our_fork.py "${COMMUNITY_FOLDER_LOCATION}" "${NEW_OPERATOR_VERSION}"
638+ name : Open a Pull Request to the operator-framework/community-operators repository for community-operators
639+ - run :
640+ command : |
641+ ./scripts/slack/notify_success_operator_push.py "${NEW_OPERATOR_VERSION}" "${COMMUNITY_FOLDER_LOCATION}"
633642 name : Notify Slack on new branch in snyk/community-operators
634643 - run :
635644 command : |
636645 if [[ "${NOTHING_TO_TEST}" != "true" ]]; then
637- ./scripts/slack/notify_failure.py "push-new-operator"
646+ ./scripts/slack/notify_failure.py "push-new-operator on community-operators"
647+ fi
648+ name : Notify Slack on failure
649+ when : on_fail
650+ working_directory : ~/kubernetes-monitor
651+ push_operator_to_upstream_community_operators :
652+ description : |
653+ Packages a new Operator and pushes it to Snyk's fork of
654+ the OpenShift upstream-community-operators.
655+ executor : redhat-openshift/default
656+ steps :
657+ - checkout
658+ - add_ssh_keys :
659+ fingerprints :
660+ - 06:c3:d4:10:0d:ef:37:6c:ec:b9:fb:6e:ed:09:e7:40
661+ - run :
662+ command : |
663+ python -m pip install requests pyyaml PyGithub
664+ name : Install required packages
665+ - install_python_requests
666+ - run :
667+ command : |
668+ set -xeo pipefail
669+ LAST_OPERATOR_VERSION=$(python ./scripts/operator/get_last_published_operator_version.py)
670+ echo "export LAST_OPERATOR_VERSION=${LAST_OPERATOR_VERSION}" >> $BASH_ENV
671+ name : Get last released Operator version
672+ - run :
673+ command : |
674+ LATEST_TAG_WITH_V=`git describe --abbrev=0 --tags ${CIRCLE_SHA1}`
675+ LATEST_TAG=${LATEST_TAG_WITH_V:1}
676+ NEW_OPERATOR_VERSION=${LATEST_TAG}
677+ echo "export NEW_OPERATOR_VERSION=${NEW_OPERATOR_VERSION}" >> $BASH_ENV
678+ name : Get new Operator version
679+ - run :
680+ command : |
681+ if [[ "${NEW_OPERATOR_VERSION}" == "${LAST_OPERATOR_VERSION}" ]]; then
682+ echo "export NOTHING_TO_TEST=true" >> $BASH_ENV
683+ exit 1
684+ fi
685+ name : End tests early if no new Operator is to be released
686+ - run :
687+ command : |
688+ ./scripts/operator/package-operator.sh "${NEW_OPERATOR_VERSION}" "${NEW_OPERATOR_VERSION}" "${NEW_OPERATOR_VERSION}" "${LAST_OPERATOR_VERSION}"
689+ name : Package Operator
690+ - run :
691+ command : |
692+ CURRENT_DIRECTORY=$(pwd)
693+ COMMUNITY_FOLDER_LOCATION="upstream-community-operators"
694+ ./scripts/operator/push-operator-to-snyk-upstream.sh "${CURRENT_DIRECTORY}" "${COMMUNITY_FOLDER_LOCATION}"
695+ name : Push new Operator to the fork of the upstream-community-operators repository
696+ - run :
697+ command : |
698+ COMMUNITY_FOLDER_LOCATION="upstream-community-operators"
699+ python ./scripts/operator/raise_pr_to_community_operators_from_our_fork.py "${COMMUNITY_FOLDER_LOCATION}" "${NEW_OPERATOR_VERSION}"
700+ name : Open a Pull Request to the operator-framework/community-operators repository for upstream-community-operators
701+ - run :
702+ command : |
703+ ./scripts/slack/notify_success_operator_push.py "${NEW_OPERATOR_VERSION}" "${COMMUNITY_FOLDER_LOCATION}"
704+ name : Notify Slack on new branch in snyk/upstream-community-operators
705+ - run :
706+ command : |
707+ if [[ "${NOTHING_TO_TEST}" != "true" ]]; then
708+ ./scripts/slack/notify_failure.py "push-new-operator on upstream-community-operators"
638709 fi
639710 name : Notify Slack on failure
640711 when : on_fail
@@ -819,6 +890,15 @@ workflows:
819890 - staging
820891 requires :
821892 - build_image
893+ - integration_tests_operator_on_k8s :
894+ filters :
895+ branches :
896+ only :
897+ - staging
898+ requires :
899+ - build_image
900+ - build_operator
901+ - upload_operator
822902 - openshift4_integration_tests :
823903 filters :
824904 branches :
@@ -848,12 +928,25 @@ workflows:
848928 - staging
849929 requires :
850930 - tag_and_push
851- NIGHTLY :
931+ MONTHLY :
852932 jobs :
853933 - operator_upgrade_tests
854934 - push_operator_to_community_operators :
855935 requires :
856936 - operator_upgrade_tests
937+ - push_operator_to_upstream_community_operators :
938+ requires :
939+ - operator_upgrade_tests
940+ triggers :
941+ - schedule :
942+ cron : 0 1 1 * *
943+ filters :
944+ branches :
945+ only :
946+ - master
947+ NIGHTLY :
948+ jobs :
949+ - operator_upgrade_tests
857950 triggers :
858951 - schedule :
859952 cron : 0 1 * * *
0 commit comments