Skip to content

Commit

Permalink
Update Publish workflow due to changes in community-operators (#1456)
Browse files Browse the repository at this point in the history
Now, PRs to update operators in OperatorHub.io should be submitted to https://github.com/k8s-operatorhub/community-operators repository, and PRs to update community-operators index image should be submitted to https://github.com/redhat-openshift-ecosystem/community-operators-prod
This PR fixes the publisher script to accomodate that change.

Signed-off-by: orenc1 <ocohen@redhat.com>

Co-authored-by: orenc1 <ocohen@redhat.com>
  • Loading branch information
kubevirt-bot and orenc1 authored Jul 27, 2021
1 parent 751ac00 commit e507bcf
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions automation/publisher/publisher.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
set -ex

function main() {
TARGET_REPO=${TARGET_REPO:-"operator-framework/community-operators"}
TARGET_REPO_UPSTREAM=${TARGET_REPO_UPSTREAM:-"k8s-operatorhub/community-operators"}
TARGET_REPO_COMMUNITY=${TARGET_REPO_COMMUNITY:-"redhat-openshift-ecosystem/community-operators-prod"}
PACKAGE_DIR=${PACKAGE_DIR:-"deploy/olm-catalog/community-kubevirt-hyperconverged"}
PR_TEMPLATE="https://raw.githubusercontent.com/operator-framework/community-operators/master/docs/pull_request_template.md"
BOT_USERNAME="hco-bot"
Expand Down Expand Up @@ -61,33 +62,33 @@ function main() {
gh auth login --with-token < token.txt
rm -f token.txt

create_pr community-operators
create_pr upstream-community-operators
create_pr ${TARGET_REPO_UPSTREAM}
create_pr ${TARGET_REPO_COMMUNITY}
}

function create_pr() {
TARGET_FOLDER=$1
TARGET_REPO=$1

echo "Clone the community operators repo"
gh repo clone ${TARGET_REPO}

echo "Update HCO manifests in ${TARGET_FOLDER}"
BUNDLE_DIR=${TARGET_REPO##*/}/${TARGET_FOLDER}/community-kubevirt-hyperconverged/${TAGGED_VERSION}
echo "Update HCO manifests"
BUNDLE_DIR=${TARGET_REPO##*/}/operators/community-kubevirt-hyperconverged/${TAGGED_VERSION}
mkdir -p ${BUNDLE_DIR}
cp -r hco_bundle/* ${BUNDLE_DIR}

echo "Open a pull request to community operators"
echo "Open a pull request to ${TARGET_REPO}"
cd ${TARGET_REPO##*/}
git config user.name "hco-bot"
git config user.email "hco-bot@redhat.com"
git add .
BRANCH_NAME=${TARGET_FOLDER%%-*}-release_hco_v${TAGGED_VERSION}
BRANCH_NAME=${TARGET_REPO%%/*}-release_hco_v${TAGGED_VERSION}
git checkout -b ${BRANCH_NAME}
git status
git commit -asm "Release Kubevirt HCO v${TAGGED_VERSION}"
git push https://${HCO_BOT_TOKEN}@github.com/${BOT_USERNAME}/${TARGET_REPO##*/}.git
echo "Create a pull request to community operator with tagged HCO version"
gh pr create --title "[${TARGET_FOLDER%%-*}]: Release Kubevirt HCO v${TAGGED_VERSION}" --body "${PR_BODY}" \
echo "Create a pull request to ${TARGET_REPO} with tagged HCO version"
gh pr create --title "[${TARGET_REPO%%/*}]: Release Kubevirt HCO v${TAGGED_VERSION}" --body "${PR_BODY}" \
--repo ${TARGET_REPO} --head ${BOT_USERNAME}:${BRANCH_NAME}
cd ..
rm -rf ${TARGET_REPO##*/}
Expand Down

0 comments on commit e507bcf

Please sign in to comment.