Process Operator Bundle #12153
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: Process Operator Bundle | |
| run-name: Process Operator Bundle | |
| on: | |
| workflow_dispatch: | |
| push: | |
| paths: | |
| - bundle/additional-images-patch.yaml | |
| - bundle/bundle-patch.yaml | |
| - bundle/csv-patch.yaml | |
| - to-be-processed/bundle/** | |
| - to-be-processed/helm/** | |
| - helm/xks-values-patch.yaml | |
| - helm/openshift-values-patch.yaml | |
| 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: write | |
| env: | |
| GITHUB_ORG: red-hat-data-services | |
| LOG_FILE_NAME: bundle-processor.log | |
| 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_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/processors/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 }} | |
| # NOTE: LOG_FILE_DIR is set at step level (not workflow level) for container jobs. | |
| # At workflow level, ${{ github.workspace }} resolves to the HOST path (e.g., /home/runner/work/REPO/REPO), | |
| # which doesn't exist inside the container. Using '.' writes to the current working directory, | |
| # which is correctly set to the container's mounted workspace. | |
| LOG_FILE_DIR: . | |
| LOG_FILE_NAME: ${{ env.LOG_FILE_NAME }} | |
| 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} | |
| XKS_HELM_CHART_COMPONENT_NAME=rhai-on-xks-chart-${COMPONENT_SUFFIX} | |
| OPENSHIFT_HELM_CHART_COMPONENT_NAME=rhai-on-openshift-chart-${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 | |
| #copy helm raw content to tmp location | |
| HELM_RAW_INPUTS_DIR=utils/tmp/helm | |
| mkdir -p $HELM_RAW_INPUTS_DIR | |
| cp -r ${BRANCH}/to-be-processed/helm/* $HELM_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 | |
| OUTPUT_FILE_PATH=${RAW_INPUTS_DIR}/manifests/rhods-operator.clusterserviceversion.yaml | |
| ANNOTATION_YAML_PATH=${RAW_INPUTS_DIR}/metadata/annotations.yaml | |
| BUNDLE_PUSH_PIPELINE_PATH=${BRANCH}/.tekton/${OPERATOR_BUNDLE_COMPONENT_NAME}-push.yaml | |
| #Declare XKS Helm processing variables | |
| XKS_HELM_PATCH_YAML_PATH=${BRANCH}/helm/xks-values-patch.yaml | |
| XKS_HELM_VALUES_YAML_PATH=${HELM_RAW_INPUTS_DIR}/rhai-on-xks-chart/values.yaml | |
| XKS_HELM_PUSH_PIPELINE_PATH=${BRANCH}/.tekton/${XKS_HELM_CHART_COMPONENT_NAME}-push.yaml | |
| #Declare OpenShift Helm processing variables | |
| OPENSHIFT_HELM_PATCH_YAML_PATH=${BRANCH}/helm/openshift-values-patch.yaml | |
| OPENSHIFT_HELM_VALUES_YAML_PATH=${HELM_RAW_INPUTS_DIR}/rhai-on-openshift-chart/values.yaml | |
| OPENSHIFT_HELM_PUSH_PIPELINE_PATH=${BRANCH}/.tekton/${OPENSHIFT_HELM_CHART_COMPONENT_NAME}-push.yaml | |
| #Invoke Bundle processor to patch the catalog | |
| python3 utils/utils/processors/bundle-processor.py \ | |
| -op bundle-patch \ | |
| -b ${BUILD_CONFIG_PATH} \ | |
| -c ${BUNDLE_CSV_PATH} \ | |
| -p ${PATCH_YAML_PATH} \ | |
| -o ${OUTPUT_FILE_PATH} \ | |
| -v ${BRANCH} \ | |
| -a ${ANNOTATION_YAML_PATH} \ | |
| -xhp ${XKS_HELM_PATCH_YAML_PATH} \ | |
| -xhv ${XKS_HELM_VALUES_YAML_PATH} \ | |
| -xhpp ${XKS_HELM_PUSH_PIPELINE_PATH} \ | |
| -ohp ${OPENSHIFT_HELM_PATCH_YAML_PATH} \ | |
| -ohv ${OPENSHIFT_HELM_VALUES_YAML_PATH} \ | |
| -ohpp ${OPENSHIFT_HELM_PUSH_PIPELINE_PATH} \ | |
| -y ${BUNDLE_PUSH_PIPELINE_PATH} \ | |
| -x enable | |
| cp -r ${RAW_INPUTS_DIR}/* ${BRANCH}/bundle | |
| cp -r ${HELM_RAW_INPUTS_DIR}/* ${BRANCH}/helm/ | |
| - name: Print debug logs | |
| if: always() | |
| run: | | |
| if [ -f "${{ env.LOG_FILE_NAME }}" ]; then | |
| echo "=== Bundle processor log ===" | |
| cat "${{ env.LOG_FILE_NAME }}" | |
| else | |
| echo "Log file not found: ${{ env.LOG_FILE_NAME }}" | |
| fi | |
| - 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 and helm chart values 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 |