-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc: Procedure to Publish Operator on OperatorHub
Add a procedure and script to publish an operator release to the upstream k8s community operators OperatorHub. The script requires the user to fork the upstream k8s operators repsository and afterwards submit a pull request by hand. In the future this procedure/script can be added to our release automation so when an operator release is published, we initiate the process to update the upstream OperatorHub catalog. Signed-off-by: Adam Kaplan <[email protected]>
- Loading branch information
1 parent
ebc4b09
commit 70d8acb
Showing
2 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
|
||
set -eu -o pipefail | ||
|
||
# This script generates a pull request to add the release to operatorhub.io | ||
# Prerequisites: | ||
# - The user has cloned and forked https://github.com/k8s-operatorhub/community-operators | ||
# - The machine running this script has crane installed: https://github.com/google/go-containerregistry/blob/main/cmd/crane/README.md | ||
|
||
OPERATORHUB_DIR=${OPERATORHUB_DIR:-$HOME/go/src/github.com/k8s-operatorhub/community-operators} | ||
VERSION=${VERSION:-latest} | ||
# Regular expression match [https://github.com/|[email protected]:] | ||
hubRegEx="(https:\/\/github\.com\/|git@github\.com:)k8s-operatorhub" | ||
|
||
echo "Preparing to release Shipwright Operator ${VERSION} to OperatorHub" | ||
|
||
if [[ ! -d "$OPERATORHUB_DIR" ]]; then | ||
echo "Please clone the community-operators repository to $OPERATORHUB_DIR" | ||
exit 1 | ||
fi | ||
|
||
pushd "$OPERATORHUB_DIR" | ||
|
||
originURL=$(git remote get-url origin) | ||
if [[ "$originURL" =~ ${hubRegEx} ]]; then | ||
echo "Please set the origin remote to your fork of the operator hub repository" | ||
exit 1 | ||
fi | ||
|
||
upstreamURL=$(git remote get-url upstream) | ||
if [[ ! "$upstreamURL" =~ ${hubRegEx} ]]; then | ||
echo "Please set the upstream remote ${upstreamURL} to the operator hub repository" | ||
exit 1 | ||
fi | ||
|
||
git fetch | ||
git switch main | ||
git pull upstream main | ||
git checkout -b "shipwright-${VERSION}" | ||
|
||
mkdir -p "operators/shipwright-operator/${VERSION}" | ||
pushd "operators/shipwright-operator/${VERSION}" | ||
|
||
crane export "ghcr.io/shipwright-io/operator/operator-bundle:v${VERSION}" - | tar -xv | ||
|
||
popd | ||
|
||
# Commit and push changes to our GitHub fork | ||
git add "operators/shipwright-operator/${VERSION}" | ||
git commit -m "Update Shipwright Operator to ${VERSION}" | ||
git commit --amend --no-edit -s | ||
git push --set-upstream origin "shipwright-${VERSION}" | ||
|
||
popd |