-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* DRAFT: olm testing * adding retention to artifacts * removing operatorhub.yml action * modify infra access token name * removing branch in OLM_Package_Repo and modify event triggering type * using quay instead of dockerhub * removing test branches and modify trigger * using checkout instead of git clone * reverting trigger
- Loading branch information
1 parent
03a5bdb
commit 6863bcf
Showing
2 changed files
with
202 additions
and
72 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
202 changes: 202 additions & 0 deletions
202
.github/workflows/testing_and_publishing_OLM_bundle.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,202 @@ | ||
# action to test our operator lifecycle manager bundle | ||
# See https://github.com/rabbitmq/OLM-Package-Repo for more info. | ||
name: test-and-publish-OLM-bundle | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
env: | ||
# registry information where we want to store the operator image and the operator index image | ||
DOCKER_REGISTRY_SERVER: quay.io/rabbitmqoperator | ||
OLM_IMAGE: rabbitmq-for-kubernetes-olm-messaging-topology-operator | ||
OLM_INDEX_IMAGE: rabbitmq-for-kubernetes-olm-messaging-topology-operator-index | ||
|
||
jobs: | ||
create-olm-package: | ||
name: Create the OLM Packaging | ||
runs-on: ubuntu-latest | ||
container: | ||
image: us.gcr.io/cf-rabbitmq-for-k8s-bunny/rabbitmq-for-kubernetes-ci-olm | ||
options: --privileged | ||
permissions: | ||
contents: 'write' | ||
id-token: 'write' | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Checkout OLM-Package-Repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: rabbitmq/OLM-Package-Repo | ||
path: ./OLM-Package-Repo | ||
|
||
- name: Set tag image for tagged version | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
run: | | ||
BUNDLE_VERSION=${GITHUB_REF#refs/*/} | ||
echo "BUNDLE_VERSION=${BUNDLE_VERSION:1}" >> $GITHUB_ENV | ||
- name: Set tag image for test version | ||
if: startsWith(github.ref, 'refs/tags/v') == false | ||
run: | | ||
echo "BUNDLE_VERSION=0.0.0" >> $GITHUB_ENV | ||
- name: create-olm-package | ||
env: | ||
username: ${{ secrets.QUAY_USERNAME }} | ||
password: ${{ secrets.QUAY_ROBOT_TOKEN }} | ||
DOCKER_REGISTRY_SERVER: ${{ env.DOCKER_REGISTRY_SERVER }} | ||
OLM_IMAGE: ${{ env.OLM_IMAGE }} | ||
OLM_INDEX_IMAGE: ${{ env.OLM_INDEX_IMAGE }} | ||
BUNDLE_VERSION: ${{ env.BUNDLE_VERSION }} | ||
run: | | ||
sed '/mount_program =/s/^#//' -i /etc/containers/storage.conf | ||
podman login quay.io -u $username -p $password | ||
make generate-manifests | ||
cp ./releases/messaging-topology-operator-with-certmanager.yaml ./OLM-Package-Repo/generate_OLM/generate_OLM_messaging_topology_operator/manifests_crds/ | ||
cp ./config/crd/bases/*.yaml ./OLM-Package-Repo/generate_OLM/generate_OLM_messaging_topology_operator/manifests_crds/crds | ||
cd ./OLM-Package-Repo/generate_OLM/generate_OLM_messaging_topology_operator/ | ||
cp ./generators/cluster-service-version-generator-test.yml ./generators/cluster-service-version-generator.yml | ||
python3 generate-olm-package.py ./manifests_crds/messaging-topology-operator-with-certmanager.yaml $BUNDLE_VERSION ./ | ||
opm alpha bundle build -c stable -d ./$BUNDLE_VERSION/manifests -t $DOCKER_REGISTRY_SERVER/$OLM_IMAGE:$BUNDLE_VERSION -p rabbitmq-messaging-topology-operator --image-builder podman | ||
podman push $DOCKER_REGISTRY_SERVER/$OLM_IMAGE:$BUNDLE_VERSION | ||
opm index add -b $DOCKER_REGISTRY_SERVER/$OLM_IMAGE:$BUNDLE_VERSION -t $DOCKER_REGISTRY_SERVER/$OLM_INDEX_IMAGE:$BUNDLE_VERSION -c podman | ||
podman push $DOCKER_REGISTRY_SERVER/$OLM_INDEX_IMAGE:$BUNDLE_VERSION | ||
mkdir upload | ||
mv "$BUNDLE_VERSION" ./upload | ||
cp ./generators/cluster-service-version-generator-openshift.yml ./generators/cluster-service-version-generator.yml | ||
python3 generate-olm-package.py ./manifests_crds/messaging-topology-operator-with-certmanager.yaml $BUNDLE_VERSION ./ | ||
mv "$BUNDLE_VERSION" ./upload/$BUNDLE_VERSION-openshift | ||
- name: upload-olm-package | ||
uses: actions/upload-artifact@master | ||
with: | ||
name: olm-artifact | ||
path: "/home/runner/work/messaging-topology-operator/messaging-topology-operator/OLM-Package-Repo/generate_OLM/generate_OLM_messaging_topology_operator/upload/" | ||
retention-days: 2 | ||
|
||
test-olm-package: | ||
name: Tests the OLM packaging | ||
runs-on: ubuntu-latest | ||
needs: create-olm-package | ||
container: us.gcr.io/cf-rabbitmq-for-k8s-bunny/rabbitmq-for-kubernetes-ci-olm | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Checkout infrastructure repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: rabbitmq/infrastructure | ||
token: ${{ secrets.GIT_HUB_ACCESS_INFRA_REPO_TOKEN }} | ||
path: ./infrastructure | ||
|
||
- name: Checkout OLM-Package-Repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: rabbitmq/OLM-Package-Repo | ||
path: ./OLM-Package-Repo | ||
|
||
- name: Protect access to the cluster with a mutex | ||
uses: ben-z/[email protected] | ||
with: | ||
repo-token: ${{ secrets.CLUSTER_OPERATOR_ACCESS_TOKEN }} | ||
repository: rabbitmq/cluster-operator | ||
branch: openshift-lock | ||
|
||
- name: Connect to the Openshift cluster and deploy the operators through OLM | ||
env: | ||
TOKEN: ${{ secrets.OPERATORHUB_TOKEN }} | ||
BUNDLE_VERSION: ${{ env.BUNDLE_VERSION }} | ||
run: | | ||
mkdir $HOME/.kube | ||
cp ./infrastructure/k8s/okd/admin-kubeconfig.yaml $HOME/.kube/config | ||
export KUBECONFIG=$HOME/.kube/config | ||
export ENVIRONMENT=openshift | ||
kubectl config use-context admin | ||
./OLM-Package-Repo/testfiles/install-rabbitmq-messaging-topology-operator.sh $BUNDLE_VERSION | ||
rm ./system_tests/tls_system_test.go | ||
export K8S_OPERATOR_NAMESPACE=rabbitmq-system-olm | ||
make install-tools | ||
NAMESPACE="rabbitmq-system-olm" ginkgo --randomize-all -r $(GINKGO_EXTRA) system_tests/ | ||
- name: Clean up | ||
env: | ||
OLM_INDEX_TAG: ${{ env.BUNDLE_VERSION }} | ||
if: always() | ||
run: | | ||
export KUBECONFIG=./infrastructure/k8s/okd/admin-kubeconfig.yaml | ||
kubectl config use-context admin | ||
./OLM-Package-Repo/testfiles/uninstall-rabbitmq-messaging-topology-operator.sh $BUNDLE_VERSION | ||
publish-bundle: | ||
name: Publish on OperatorHub and Openshift market-place | ||
runs-on: ubuntu-latest | ||
needs: test-olm-package | ||
container: us.gcr.io/cf-rabbitmq-for-k8s-bunny/rabbitmq-for-kubernetes-ci-olm | ||
# Create the PR to OperatorHUB | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Checkout community-operators repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: rabbitmq/community-operators | ||
path: ./community-operators | ||
token: ${{ secrets.OPERATORHUB_TOKEN }} | ||
- name: Checkout community-operators-prod repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: rabbitmq/community-operators-prod | ||
path: ./community-operators-prod | ||
token: ${{ secrets.OPERATORHUB_TOKEN }} | ||
- name: Set tag image for tagged version | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
run: | | ||
BUNDLE_VERSION=${GITHUB_REF#refs/*/} | ||
echo "BUNDLE_VERSION=${BUNDLE_VERSION:1}" >> $GITHUB_ENV | ||
- name: Set tag image for test version | ||
if: startsWith(github.ref, 'refs/tags/v') == false | ||
run: | | ||
echo "BUNDLE_VERSION=0.0.0" >> $GITHUB_ENV | ||
- name: download olm-artifact from previous step | ||
uses: actions/download-artifact@master | ||
with: | ||
name: olm-artifact | ||
- name: CreateOperatorHubPR | ||
env: | ||
TOKEN: ${{ secrets.OPERATORHUB_TOKEN }} | ||
BUNDLE_VERSION: ${{ env.BUNDLE_VERSION }} | ||
run: | | ||
git config --global user.name "DanielePalaia" | ||
git config --global user.email "[email protected]" | ||
cd community-operators/operators/rabbitmq-messaging-topology-operator/ | ||
git branch rabbitmq-messaging-topology-operator-$BUNDLE_VERSION | ||
git checkout rabbitmq-messaging-topology-operator-$BUNDLE_VERSION | ||
cp -fR ./../../../$BUNDLE_VERSION . | ||
sed -i -e "s/latest/$BUNDLE_VERSION/g" ./$BUNDLE_VERSION/manifests/rabbitmq.clusterserviceversion.yaml | ||
git add . | ||
git commit -s -m "RabbitMQ operator new release" | ||
git push https://DanielePalaia:"$TOKEN"@github.com/rabbitmq/community-operators | ||
cd ./../../.. | ||
# Create the PR to redhat openshift ecosystem | ||
- name: CreateOpenshiftEcosystemPR | ||
env: | ||
TOKEN: ${{ secrets.OPERATORHUB_TOKEN }} | ||
BUNDLE_VERSION: ${{ env.BUNDLE_VERSION }} | ||
run: | | ||
cd community-operators-prod/operators/rabbitmq-messaging-topology-operator/ | ||
git branch rabbitmq-messaging-topology-operator-$BUNDLE_VERSION | ||
git checkout rabbitmq-messaging-topology-operator-$BUNDLE_VERSION | ||
cp -fR ./../../../$BUNDLE_VERSION-openshift . | ||
mv $BUNDLE_VERSION-openshift $BUNDLE_VERSION | ||
sed -i -e "s/latest/$BUNDLE_VERSION/g" ./$BUNDLE_VERSION/manifests/rabbitmq.clusterserviceversion.yaml | ||
git add . | ||
git commit -s -m "RabbitMQ operator new release" | ||
git push https://DanielePalaia:"$TOKEN"@github.com/rabbitmq/community-operators-prod |