Skip to content

Commit

Permalink
WIP - fix OLM publish
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
Zerpet committed Aug 27, 2024
1 parent 2f05c6a commit b6b187f
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions .github/workflows/testing_and_publishing_OLM_bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,21 @@ jobs:
repository: rabbitmq/OLM-Package-Repo
path: ./OLM-Package-Repo

- name: Set tag image for tagged version
- name: Set image tag to tagged release
if: startsWith(github.ref, 'refs/tags/v')
run: |
BUNDLE_VERSION=${GITHUB_REF#refs/*/}
echo "BUNDLE_VERSION=${BUNDLE_VERSION:1}" >> $GITHUB_ENV
shell: bash

- name: Set tag image for test version
- name: Set image tag to DEV version
if: startsWith(github.ref, 'refs/tags/v') == false
run: |
echo "BUNDLE_VERSION=0.0.0" >> $GITHUB_ENV
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.4.2
virtualenvs-create: true
virtualenvs-in-project: false

Expand All @@ -76,6 +75,7 @@ jobs:
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}

# TODO: Set auto-expiry in DEV images: https://idbs-engineering.com/containers/2019/08/27/auto-expiry-quayio-tags.html
- name: Create OLM Package
env:
DOCKER_REGISTRY_SERVER: ${{ env.DOCKER_REGISTRY_SERVER }}
Expand Down Expand Up @@ -162,7 +162,6 @@ jobs:
- name: Connect to the Openshift cluster and deploy the operators through OLM
id: connect-and-deploy
env:
TOKEN: ${{ secrets.OPERATORHUB_TOKEN }}
BUNDLE_VERSION: ${{ env.BUNDLE_VERSION }}
run: |
mkdir $HOME/.kube
Expand All @@ -171,10 +170,12 @@ jobs:
export ENVIRONMENT=openshift
kubectl config use-context admin
./OLM-Package-Repo/testfiles/install-rabbitmq-cluster-operator.sh $BUNDLE_VERSION
export K8S_OPERATOR_NAMESPACE=rabbitmq-system-olm
export SYSTEM_TEST_NAMESPACE=rabbitmq-system-olm
touch install-tools
make system-tests
- name: Run Operator System Tests
env:
K8S_OPERATOR_NAMESPACE: rabbitmq-system-olm
SYSTEM_TEST_NAMESPACE: rabbitmq-system-olm
run: make system-tests

- name: Clean up Openshift environment
env:
Expand All @@ -189,74 +190,73 @@ jobs:
name: Publish on OperatorHub and Openshift marketplace
runs-on: ubuntu-latest
needs: test-olm-package
if: false
# if: ${{ startsWith(github.ref, 'refs/tags/v') }}
container: us.gcr.io/cf-rabbitmq-for-k8s-bunny/rabbitmq-for-kubernetes-ci-olm
# Create the PR to OperatorHUB
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Checkout community-operators repo
- name: Checkout community-operators fork (OperatorHub)
uses: actions/checkout@v4
with:
repository: rabbitmq/community-operators
path: ./community-operators
token: ${{ secrets.OPERATORHUB_TOKEN }}

- name: Checkout community-operators-prod repo
- name: Checkout community-operators-prod fork (Openshift Ecosystem)
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: |
run: |
BUNDLE_VERSION=${GITHUB_REF#refs/*/}
echo "BUNDLE_VERSION=${BUNDLE_VERSION:1}" >> $GITHUB_ENV
echo "BUNDLE_VERSION=${BUNDLE_VERSION:-0.0.0}" >> $GITHUB_ENV
shell: bash

- name: Download OLM artifact
uses: actions/download-artifact@v4
with:
name: olm-artifact

- name: Create OperatorHub PR
- name: Create branch for OperatorHub PR
env:
TOKEN: ${{ secrets.OPERATORHUB_TOKEN }}
BUNDLE_VERSION: ${{ env.BUNDLE_VERSION }}
# RABBITMQ_CI_EMAIL: https://tpe-vault-rock.eng.vmware.com/ui/vault/secrets/secret_rabbitmq/kv/Shared-Shared-RabbitMQ%2Frabbitmq-ci/details
# RABBITMQ_CI_TOKEN: https://tpe-vault-rock.eng.vmware.com/ui/vault/secrets/secret_rabbitmq/kv/Shared-Shared-RabbitMQ%2Frabbitmq-ci/details
run: |
git config --global user.name "DanielePalaia"
git config --global user.email "[email protected]"
mkdir -p community-operators/operators/rabbitmq-cluster-operator
cd community-operators/operators/rabbitmq-cluster-operator
pushd community-operators/operators/rabbitmq-cluster-operator || exit 1
git config --local user.name "rabbitmq-ci"
git config --local user.email ${{ secrets.RABBITMQ_CI_EMAIL }}
git branch rabbitmq-cluster-operator-$BUNDLE_VERSION
git checkout rabbitmq-cluster-operator-$BUNDLE_VERSION
REPLACE_VERSION=$(ls -1v | tail -2 | head -1)
cp -fR ./../../../$BUNDLE_VERSION .
sed -i -e "s/replaces: null/replaces: rabbitmq-cluster-operator.v$REPLACE_VERSION/g" ./$BUNDLE_VERSION/manifests/rabbitmq.clusterserviceversion.yaml
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 ./../../..
git push https://rabbitmq-ci:"${{ secrets.RABBITMQ_CI_TOKEN }}"@github.com/rabbitmq/community-operators
popd
# Create the PR to redhat openshift ecosystem
- name: Create Openshift Ecosystem PR
- name: Create branch for Openshift Ecosystem PR
env:
TOKEN: ${{ secrets.OPERATORHUB_TOKEN }}
BUNDLE_VERSION: ${{ env.BUNDLE_VERSION }}
# RABBITMQ_CI_EMAIL: https://tpe-vault-rock.eng.vmware.com/ui/vault/secrets/secret_rabbitmq/kv/Shared-Shared-RabbitMQ%2Frabbitmq-ci/details
# RABBITMQ_CI_TOKEN: https://tpe-vault-rock.eng.vmware.com/ui/vault/secrets/secret_rabbitmq/kv/Shared-Shared-RabbitMQ%2Frabbitmq-ci/details
run: |
cd community-operators-prod/operators/rabbitmq-cluster-operator
git config --local user.name "rabbitmq-ci"
git config --local user.email ${{ secrets.RABBITMQ_CI_EMAIL }}
git branch rabbitmq-cluster-operator-$BUNDLE_VERSION
git checkout rabbitmq-cluster-operator-$BUNDLE_VERSION
REPLACE_VERSION=$(ls -1v | tail -2 | head -1)
cp -fR ./../../../$BUNDLE_VERSION-openshift .
mv $BUNDLE_VERSION-openshift $BUNDLE_VERSION
sed -i -e "s/replaces: null/replaces: rabbitmq-cluster-operator.v$REPLACE_VERSION/g" ./$BUNDLE_VERSION/manifests/rabbitmq.clusterserviceversion.yaml
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
git push https://rabbitmq-ci:"${{ secrets.RABBITMQ_CI_TOKEN }}"@github.com/rabbitmq/community-operators-prod

0 comments on commit b6b187f

Please sign in to comment.