Skip to content

Commit

Permalink
github action to keep our helm chart in sync
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielePalaia committed Jul 2, 2024
1 parent 80f55b4 commit ca22bf0
Showing 1 changed file with 32 additions and 18 deletions.
50 changes: 32 additions & 18 deletions .github/workflows/update_helm_chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
name: update_helm_chart

on:
release:
types: [published]
push:
branches:
- action_to_sync_helm_chart

workflow_dispatch:

env:


jobs:
create-chart-pr:
name: Create pull request to char repo
Expand All @@ -21,27 +20,42 @@ jobs:
uses: actions/checkout@v4
with:
repository: rabbitmq-pro/tanzu-rabbitmq-operator-chart
ref: adding_sync_operators_action_scripts
token: ${{ secrets.GIT_HUB_INFRA_REPO_ACCESS_TOKEN }}
path: ./tanzu-rabbitmq-operator-chart

- name: Update helm released version and CRD
run: |
- name: Set tag image for tagged version
if: startsWith(github.ref, 'refs/tags/v')
run: |
BUNDLE_VERSION=${GITHUB_REF#refs/*/}
BUNDLE_VERSION=${BUNDLE_VERSION:1}
echo "BUNDLE_VERSION=${BUNDLE_VERSION:1}" >> $GITHUB_ENV
# For manual testing
- name: Set tag image for test version
if: startsWith(github.ref, 'refs/tags/v') == false
run: |
echo "BUNDLE_VERSION=2.9.0" >> $GITHUB_ENV
- name: Update helm released version and CRD
env:
GH_TOKEN: ${{ secrets.GIT_HUB_INFRA_REPO_ACCESS_TOKEN }}
BUNDLE_VERSION: ${{ env.BUNDLE_VERSION }}
run: |
cd ./tanzu-rabbitmq-operator-chart
git branch update_crd_and_version
git checkout update_crd_and_version
cp ./../config/crd/bases/rabbitmq.com_rabbitmqclusters.yaml ./tanzu-rabbitmq-operator-chart/crds/rabbitmq-cluster/
sed -i '' 's/cluster-operator:.*/cluster-operator:$BUNDLE_VERSION/' ./Chart.yaml
python3 ./scripts/update_cluster_operator_clusterrole.py ./scripts/generators/rabbitmq-cluster-operator/clusterrole.yml ./scripts/generators/rabbitmq-cluster-operator/clusterrole-generator.yml
cp ./scripts/generators/rabbitmq-cluster-operator/clusterrole-generator.yml ./../templates/cluster-operator/clusterrole.yaml
git config --global user.name "rabbitmq-ci"
git config --global user.email rabbitmq-ci@vmware.com
git branch rabbitmq_cluster_operator_update_crd_and_versions_$BUNDLE_VERSION
git checkout rabbitmq_cluster_operator_update_crd_and_versions_$BUNDLE_VERSION
cp ./../config/crd/bases/rabbitmq.com_rabbitmqclusters.yaml ./crds/rabbitmq-cluster/
sed -i -e "s/cluster-operator:.*/cluster-operator:$BUNDLE_VERSION/" ./Chart.yaml
python3 ./scripts/update_cluster_operator_clusterrole.py ./../config/rbac/role.yaml ./scripts/generators/rabbitmq-cluster-operator/clusterrole-generator.yml
python3 ./scripts/update_cluster_operator_value_version.py ./values.yaml "rabbitmqoperator/cluster-operator" $BUNDLE_VERSION
cp ./scripts/generators/rabbitmq-cluster-operator/clusterrole-generator.yml ./templates/cluster-operator/clusterrole.yaml
git checkout ./scripts/generators/rabbitmq-cluster-operator/clusterrole-generator.yml
git add .
git commit -m "Updating RabbitMQ cluster operator version and CRD"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6

git push --force origin rabbitmq_cluster_operator_update_crd_and_versions_$BUNDLE_VERSION
#gh pr create --title "RabbitMQ cluster operator: Update versions, CRD and clusterrole" --body "RabbitMQ cluster operator: Update image versions, CRD and clusterrole" --base main



Expand Down

0 comments on commit ca22bf0

Please sign in to comment.