Trigger Nightly Bundle Build #707
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: Trigger Nightly Bundle Build | |
| run-name: Trigger Nightly Bundle Build | |
| on: | |
| workflow_dispatch: | |
| push: | |
| paths: | |
| - schedule/bundle-github-trigger.txt | |
| branches: | |
| - 'rhoai-2.1[6-9]+' | |
| - 'rhoai-2.2[0-9]+' # Trigger the workflow on pushes to any rhoai-2.20 branch | |
| permissions: | |
| contents: write | |
| env: | |
| GITHUB_ORG: red-hat-data-services | |
| GITHUB_RKA_ORG: rhoai-rhtap | |
| jobs: | |
| process-bundle: | |
| if: ${{ github.ref_name != 'main' }} | |
| runs-on: ubuntu-latest | |
| container: | |
| image: quay.io/rhoai/rhoai-task-toolset:latest | |
| steps: | |
| - name: Get Current branch name | |
| shell: bash | |
| run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | |
| id: get_branch | |
| - name: Git checkout RBC release | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ steps.get_branch.outputs.branch }} | |
| path: ${{ steps.get_branch.outputs.branch }} | |
| - name: Git checkout utils | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ env.GITHUB_RKA_ORG }}/RHOAI-Konflux-Automation | |
| ref: main | |
| path: utils | |
| - name: Install dependencies | |
| run: | | |
| os="$(uname -s | tr '[:upper:]' '[:lower:]')" | |
| arch="$(uname -m | sed 's/x86_64/amd64/')" | |
| yq_version="v4.44.3" | |
| yq_filename="yq-$yq_version" | |
| echo "-> Downloading yq" >&2 | |
| curl -sSfLo "$yq_filename" "https://github.com/mikefarah/yq/releases/download/$yq_version/yq_${os}_${arch}" | |
| chmod +x $yq_filename | |
| ln -s $yq_filename yq | |
| cp $yq_filename /usr/local/bin/yq | |
| pip install --default-timeout=100 -r utils/utils/bundle-processor/requirements.txt | |
| - name: Process Operator Bundle | |
| env: | |
| BRANCH: ${{ steps.get_branch.outputs.branch }} | |
| OC_TOKEN: ${{ secrets.KONFLUX_INTERNAL_OC_TOKEN }} | |
| CLUSTER: p02 | |
| RHOAI_QUAY_API_TOKEN: ${{ secrets.RHOAI_QUAY_API_TOKEN }} | |
| run: | | |
| #Declare basic variables | |
| OPENSHIFT_VERSION=v4.13 | |
| RHOAI_VERSION=v${BRANCH/rhoai-/} | |
| COMPONENT_SUFFIX=${RHOAI_VERSION/./-} | |
| OPERATOR_BUNDLE_COMPONENT_NAME=odh-operator-bundle-${COMPONENT_SUFFIX} | |
| #copy all the raw content to tmp location | |
| RAW_INPUTS_DIR=utils/tmp/bundle | |
| mkdir -p $RAW_INPUTS_DIR | |
| cp -r ${BRANCH}/to-be-processed/bundle/* $RAW_INPUTS_DIR | |
| #Declare Bundle processing variables | |
| BUILD_CONFIG_PATH=${BRANCH}/config/build-config.yaml | |
| BUNDLE_CSV_PATH=${RAW_INPUTS_DIR}/manifests/rhods-operator.clusterserviceversion.yaml | |
| PATCH_YAML_PATH=${BRANCH}/bundle/bundle-patch.yaml | |
| SINGLE_BUNDLE_PATH=utils/utils/single_bundle_catalog_semver.yaml | |
| OUTPUT_FILE_PATH=${RAW_INPUTS_DIR}/manifests/rhods-operator.clusterserviceversion.yaml | |
| SNAPSHOT_JSON_PATH=${BRANCH}/config/snapshot.json | |
| ANNOTATION_YAML_PATH=${RAW_INPUTS_DIR}/metadata/annotations.yaml | |
| PUSH_PIPELINE_PATH=${BRANCH}/.tekton/${OPERATOR_BUNDLE_COMPONENT_NAME}-push.yaml | |
| #Invoke Bundle processor to patch the catalog | |
| python3 utils/utils/bundle-processor/bundle-processor.py -op bundle-patch -b ${BUILD_CONFIG_PATH} -c ${BUNDLE_CSV_PATH} -p ${PATCH_YAML_PATH} -sn ${SNAPSHOT_JSON_PATH} -o ${OUTPUT_FILE_PATH} -v ${BRANCH} -a ${ANNOTATION_YAML_PATH} --push-pipeline-yaml-path ${PUSH_PIPELINE_PATH} --push-pipeline-operation disable --build-type nightly | |
| cp -r ${RAW_INPUTS_DIR}/* ${BRANCH}/bundle | |
| # Update the schedule file to trigger the nightly build | |
| echo $(date +'%d-%m-%Y %H:%M:%S:%3N') > ${BRANCH}/schedule/bundle-tekton-trigger.txt | |
| #disable CI builds while nightly runs | |
| - name: Commit and push the changes to release branch | |
| uses: actions-js/push@master | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: ${{ steps.get_branch.outputs.branch }} | |
| message: "Updating the bundle-csv with latest images" | |
| repository: ${{ env.GITHUB_ORG }}/RHOAI-Build-Config | |
| directory: ${{ steps.get_branch.outputs.branch }} | |
| author_name: Openshift-AI DevOps | |
| author_email: openshift-ai-devops@redhat.com |