Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate release push to OLM in tempo-operator #583

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,25 @@ jobs:
-F RELEASE_NOTES.md \
"v${OPERATOR_VERSION}" \
'dist/tempo-operator.yaml#Installation manifest for Kubernetes' \

operator-hub-prod-release:
needs: release
uses: ./.github/workflows/reusable-operator-hub-release.yaml
with:
org: redhat-openshift-ecosystem
repo: community-operators-prod
branch: ${{ github.event.pull_request.head.ref }}
oprepo: ${{ github.repository }}
secrets:
TEMPOOPERATORBOT_GITHUB_TOKEN: ${{ secrets.TEMPOOPERATORBOT_GITHUB_TOKEN }}

operator-hub-community-release:
needs: release
uses: ./.github/workflows/reusable-operator-hub-release.yaml
with:
org: k8s-operatorhub
repo: community-operators
branch: ${{ github.event.pull_request.head.ref }}
oprepo: ${{ github.repository }}
secrets:
TEMPOOPERATORBOT_GITHUB_TOKEN: ${{ secrets.TEMPOOPERATORBOT_GITHUB_TOKEN }}
92 changes: 92 additions & 0 deletions .github/workflows/reusable-operator-hub-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Reusable - Create operator hub pull request

on:
workflow_call:
inputs:
org:
type: string
required: true
repo:
type: string
required: true
branch:
type: string
required: true
oprepo:
type: string
required: true
secrets:
TEMPOOPERATORBOT_GITHUB_TOKEN:
required: true
jobs:
create-operator-pull-request:
runs-on: ubuntu-latest
steps:
- name: Sync fork
env:
GH_TOKEN: ${{ secrets.TEMPOOPERATORBOT_GITHUB_TOKEN }}
run: |
# synchronizing the fork is fast, and avoids the need to fetch the full upstream repo
# (fetching the upstream repo with "--depth 1" would lead to "shallow update not allowed"
# error when pushing back to the origin repo)
gh repo sync tempooperatorbot/${{ inputs.repo }} \
--source ${{ inputs.org }}/${{ inputs.repo }} \
--force

- name: Determine operator version to release
id: operator-version
run: echo "version=${BRANCH#"releases/"}" >> "$GITHUB_OUTPUT"
env:
BRANCH: ${{ inputs.branch }}


- name: Checkout operatorhub repo
uses: actions/checkout@v3
with:
repository: tempooperatorbot/${{ inputs.repo }}
token: ${{ secrets.TEMPOOPERATORBOT_GITHUB_TOKEN }}

- name: Checkout tempo-operator to tmp/ directory
uses: actions/checkout@v3
with:
repository: ${{ inputs.oprepo }}
token: ${{ secrets.TEMPOOPERATORBOT_GITHUB_TOKEN }}
path: tmp/

- name: Update version
env:
VERSION: ${{ steps.operator-version.outputs.version }}
run: |
mkdir operators/tempo-operator/${VERSION}
cp -R ./tmp/bundle/* operators/tempo-operator/${VERSION}
rm -rf ./tmp

- name: Use CLA approved github bot
run: |
git config user.name tempobot
git config user.email [email protected]

- name: Create pull request against ${{ inputs.org }}/${{ inputs.repo }}
env:
VERSION: ${{ steps.operator-version.outputs.version }}
GH_TOKEN: ${{ secrets.TEMPOOPERATORBOT_GITHUB_TOKEN }}
run: |
message="Update the tempo to $VERSION"
body="Release tempo-operator \`$VERSION\`.

cc @pavolloffay @frzifus @andreasgerstmayr @rubenvp8510 @iblancasa
"
branch="update-tempo-operator-to-${VERSION}"

# gh pr create doesn't have a way to explicitly specify different head and base
# repositories currently, but it will implicitly pick up the head from a different
# repository if you set up a tracking branch

git checkout -b $branch
git add -A
git commit -s -m "$message"
git push -f --set-upstream origin $branch
gh pr create --title "$message" \
--body "$body" \
--repo ${{ inputs.org }}/${{ inputs.repo }} \
--base main
Loading