Skip to content

New Bundle Processor #123

New Bundle Processor

New Bundle Processor #123

name: New Bundle Processor
run-name: New Bundle Processor
on:
workflow_dispatch:
push:
paths:
- bundle/additional-images-patch.yaml
- bundle/bundle-patch.yaml
- bundle/csv-patch.yaml
- to-be-processed/bundle/**
branches:
- 'rhoai-2.1[6-9]+'
- 'rhoai-2.2[0-9]+' # Trigger the workflow on pushes to any rhoai-2.20 branch and above
- 'rhoai-3.[0-9]+' # Trigger the workflow on pushes to any rhoai-3.x branch
permissions:
contents: write
env:
GITHUB_ORG: red-hat-data-services
GITHUB_RKA_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_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/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}
#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
OUTPUT_FILE_PATH=${RAW_INPUTS_DIR}/manifests/rhods-operator.clusterserviceversion.yaml
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/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} \
-y ${PUSH_PIPELINE_PATH} \
-x enable
cp -r ${RAW_INPUTS_DIR}/* ${BRANCH}/bundle
- name: Print debug logs
if: always()
run: |
if [ -f "${{ env.LOG_FILE_NAME }}" ]; then
cat "${{ env.LOG_FILE_NAME }}"
else
echo "Log file not found: ${{ env.LOG_FILE_NAME }}"
fi
- name: Upload processed output files
if: always()
uses: actions/upload-artifact@v4
with:
name: bundle-processor-output
path: |
${{ steps.get_branch.outputs.branch }}/bundle/manifests/rhods-operator.clusterserviceversion.yaml
${{ steps.get_branch.outputs.branch }}/bundle/metadata/annotations.yaml
${{ steps.get_branch.outputs.branch }}/bundle/bundle_build_args.map
${{ steps.get_branch.outputs.branch }}/.tekton/*-push.yaml
${{ env.LOG_FILE_NAME }}
if-no-files-found: warn
retention-days: 30