Skip to content

CI Upgrade

CI Upgrade #128

Workflow file for this run

name: "CI Upgrade"
on:
workflow_dispatch:
inputs:
commit-message:
description: 'Commit message prefix'
required: true
default: 'Upgrade CI'
repo:
description: 'Source repsitory'
required: true
default: 'https://github.com/redhat-openshift-ecosystem/community-operators-pipeline'
branch:
description: 'Source branch'
required: true
default: 'ci/latest'
playbook_branch:
description: 'Playbook branch'
required: true
default: 'upstream-community'
cluster:
description: 'Cluster type (k8s, ocp)'
required: true
default: 'k8s'
index_from:
description: 'From index (quay.io/operator_testing/index_empty:latest)'
default: ''
env:
OPP_INPUT_REPO: "${{ github.event.inputs.repo }}"
OPP_INPUT_BRANCH: "${{ github.event.inputs.branch }}"
INDEX_FROM: ${{ github.event.inputs.index_from }}
OPP_ANSIBLE_PULL_BRANCH: "${{ github.event.inputs.playbook_branch }}"
OPP_SCRIPT_UPGRADE_URL: "https://raw.githubusercontent.com/redhat-openshift-ecosystem/community-operators-pipeline/ci/latest/ci/scripts/opp-update.sh"
jobs:
upgrade:
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: python -m pip install --upgrade pip yq
- uses: actions/checkout@v3
with:
token: ${{ secrets.FRAMEWORK_MERGE }}
#persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
# fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
- name: Create local changes
env:
CLUSTER_TYPE: ${{ github.event.inputs.cluster }}
REGISTRY_RELEASE_API_TOKEN: ${{ secrets.REGISTRY_RELEASE_API_TOKEN }}
run: |
echo "$OPP_INPUT_REPO $OPP_INPUT_BRANCH"
echo "index_from=$INDEX_FROM" >> $GITHUB_OUTPUT
bash <(curl -sL $OPP_SCRIPT_UPGRADE_URL) $CLUSTER_TYPE $INDEX_FROM
if [ -f "/tmp/operators_to_recreate.yaml" ];then
echo 'Operators to be receated by manual release' > $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "operators: $(cat /tmp/operators_to_recreate.yaml)" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
fi
- name: Commit files
run: |
FAKE_RC=false
[ -n "$INDEX_FROM" ] && FAKE_RC=true || true
git config --local user.email "41898282+framework-automation[bot]@users.noreply.github.com" || $FAKE_RC
git config --local user.name "framework-automation" || $FAKE_RC
git add . || $FAKE_RC
git commit -m "${{ github.event.inputs.commit-message }} ($(date +"%d %b %Y %T"))" -a || $FAKE_RC
git push || $FAKE_RC