Merge pull request #18506 from red-hat-data-services/konflux/componen… #2790
This file contains hidden or 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
| name: Bundle Sync CI | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - 'rhoai-[23].[0-9]' # e.g. rhoai-2.1, rhoai-3.1, rhoai-3.4 | |
| - 'rhoai-[23].[0-9][0-9]' # e.g. rhoai-2.10, rhoai-3.10, rhoai-3.22 | |
| - 'rhoai-[3].[0-9]-ea.[0-9]' # e.g. rhoai-3.4-ea.1, rhoai-3.5-ea.2 | |
| - 'rhoai-[3].[0-9][0-9]-ea.[0-9]' # e.g. rhoai-3.10-ea.3 | |
| permissions: | |
| contents: read | |
| packages: write | |
| id-token: write | |
| env: | |
| GITHUB_ORG: red-hat-data-services | |
| GITHUB_RKA_ORG: rhoai-rhtap | |
| jobs: | |
| sync: | |
| if: ${{ github.ref_name != 'main' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Generate github-app token | |
| id: app-token | |
| uses: getsentry/action-github-app-token@v2 | |
| with: | |
| app_id: ${{ secrets.RHOAI_DEVOPS_APP_ID }} | |
| private_key: ${{ secrets.RHOAI_DEVOPS_APP_PRIVATE_KEY }} | |
| - name: Checkout source repo | |
| uses: actions/checkout@v3 | |
| with: | |
| repository: ${{ env.GITHUB_ORG }}/rhods-operator | |
| path: source_repo | |
| ref: ${{ github.ref_name }} # Use the same branch name as in the event | |
| token: ${{ steps.app-token.outputs.token }} | |
| - name: Checkout target repo | |
| uses: actions/checkout@v3 | |
| with: | |
| repository: ${{ env.GITHUB_ORG }}/RHOAI-Build-Config | |
| path: target_repo | |
| ref: ${{ github.ref_name }} # Use the same branch name as in the event | |
| token: ${{ steps.app-token.outputs.token }} | |
| - name: Generate bundle files | |
| run: | | |
| cd source_repo | |
| ODH_PLATFORM_TYPE=rhoai make bundle | |
| - name: Sync Bundle Files | |
| run: | | |
| mkdir -p target_repo/to-be-processed/bundle | |
| echo "Updating bundle related files" | |
| rm -rf target_repo/to-be-processed/bundle/* | |
| if [ -d source_repo/rhoai-bundle ]; then | |
| cp -r source_repo/rhoai-bundle/* target_repo/to-be-processed/bundle | |
| else | |
| cp -r source_repo/bundle/* target_repo/to-be-processed/bundle | |
| fi | |
| sed -i -e "s|image: quay.io/opendatahub/opendatahub-operator:latest.*|image: REPLACE_IMAGE:latest|g" target_repo/to-be-processed/bundle/manifests/rhods-operator.clusterserviceversion.yaml | |
| # echo "Updating Dockerfile" | |
| # cp source_repo/Dockerfiles/bundle.Dockerfile target_repo/to-be-processed/bundle/Dockerfile | |
| - name: Check for bundle changes | |
| id: bundle-change-check | |
| run: | | |
| cd target_repo | |
| git add to-be-processed/bundle | |
| if [ -z "$(git diff --staged | grep -P '^[-+]' | grep -v createdAt | grep -v -P '^(\+\+\+|---)')" ]; then | |
| echo "bundle_changes=empty" >> $GITHUB_OUTPUT | |
| else | |
| echo "bundle_changes=present" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit and push the changes to release branch | |
| uses: actions-js/push@master | |
| if: ${{ steps.bundle-change-check.outputs.bundle_changes == 'present' }} | |
| with: | |
| github_token: ${{ steps.app-token.outputs.token }} | |
| branch: ${{ github.ref_name }} | |
| message: "Sync changes from source repo" | |
| repository: ${{ env.GITHUB_ORG }}/RHOAI-Build-Config | |
| directory: target_repo | |
| author_name: Openshift-AI DevOps | |
| author_email: openshift-ai-devops@redhat.com |