-
Notifications
You must be signed in to change notification settings - Fork 106
CLOUDP-143633: Automate Openshift release #824
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
4acf13c
Add GH action that handle community release
helderjs 7d4cd3f
Add workflow to do openshift release
helderjs 3a3e672
add trigger to enable test
helderjs 1e7de27
add exec permission to entrypoint
helderjs 56dae21
rename workflow
helderjs d1108fc
add line break
helderjs d225259
fail when version was already created
helderjs 76c26d3
non-certified release
helderjs 6d0c8af
remove and revoke token
helderjs 9c28a2f
refactor the job into multiple steps
helderjs 39fd45b
finalize process
helderjs 384a0d6
remove test data
helderjs 0080b83
adjust for multi-arch support
helderjs 8064e5d
use repo digest to refer image version
helderjs f4b7287
fix container image
helderjs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,106 @@ | ||
| name: Release Openshift | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: "Release version:" | ||
| required: true | ||
| jobs: | ||
| release-openshift: | ||
| name: "Create Pull request for openshift release" | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
| REPO_PATH: "operators/mongodb-atlas-kubernetes" | ||
| strategy: | ||
| matrix: | ||
| repository: ["mongodb-forks/community-operators", "mongodb-forks/community-operators-prod", "mongodb-forks/certified-operators"] | ||
| include: | ||
| - repository: "mongodb-forks/certified-operators" | ||
| certified: true | ||
| steps: | ||
| - name: Clone/Checkout Atlas Operator | ||
| uses: actions/checkout@v3.1.0 | ||
| with: | ||
| ref: main | ||
| path: "mongodb-atlas-kubernetes" | ||
| fetch-depth: 0 | ||
| - name: Clone/Checkout releases repositories | ||
| uses: actions/checkout@v3.1.0 | ||
| with: | ||
| repository: ${{ matrix.repository }} | ||
| ref: main | ||
| path: ${{ matrix.repository }} | ||
| token: ${{ github.token }} | ||
| - name: Prepare version | ||
| env: | ||
| VERSION: ${{ github.event.inputs.version }} | ||
| REPOSITORY: ${{ matrix.repository }} | ||
| run: | | ||
| cd $REPOSITORY | ||
| mkdir -p "${REPO_PATH}/${VERSION}" | ||
|
|
||
| cd ../../mongodb-atlas-kubernetes | ||
| cp -r bundle.Dockerfile bundle/manifests bundle/metadata bundle/tests "../${REPOSITORY}/${REPO_PATH}/${VERSION}" | ||
| - name: Configure non-certified release | ||
| if: ${{ ! matrix.certified }} | ||
| env: | ||
| VERSION: ${{ github.event.inputs.version }} | ||
| REPOSITORY: ${{ matrix.repository }} | ||
| run: | | ||
| echo "Configure non-certified release" | ||
| cd "$REPOSITORY/$REPO_PATH" | ||
| sed -i.bak 's/COPY bundle\/manifests/COPY manifests/' "${VERSION}/bundle.Dockerfile" | ||
| sed -i.bak 's/COPY bundle\/metadata/COPY metadata/' "${VERSION}/bundle.Dockerfile" | ||
| sed -i.bak 's/COPY bundle\/tests\/scorecard/COPY tests\/scorecard/' "${VERSION}/bundle.Dockerfile" | ||
| rm "${VERSION}/bundle.Dockerfile.bak" | ||
| - name: Certify Openshift images | ||
| uses: ./.github/actions/certify-openshift-images | ||
| with: | ||
| repository: quay.io/mongodb/mongodb-atlas-kubernetes-operator | ||
| version: ${{ github.event.inputs.version }} | ||
| quay_password: ${{ secrets.QUAY_PASSWORD }} | ||
| rhcc_token: ${{ secrets.RH_CERTIFICATION_PYXIS_API_TOKEN }} | ||
| rhcc_project: ${{ secrets.RH_CERTIFICATION_OSPID }} | ||
| - name: Configure certified release | ||
| if: ${{ matrix.certified }} | ||
| env: | ||
| VERSION: ${{ github.event.inputs.version }} | ||
| REPOSITORY: ${{ matrix.repository }} | ||
| IMAGE: quay.io/mongodb/mongodb-atlas-kubernetes-operator | ||
| run: | | ||
| # Reference to image | ||
| REPO_DIGEST=$(docker inspect --format='{{ index .RepoDigests 0}}' "${IMAGE}":"${VERSION}") | ||
| containerImage="quay.io/${REPO_DIGEST}" | ||
| yq e -i '.metadata.annotations.containerImage = env(containerImage)' "${VERSION}"/manifests/mongodb-atlas-kubernetes.clusterserviceversion.yaml | ||
| yq e -i '.spec.install.spec.deployments[0].spec.template.spec.containers[0].image = env(containerImage)' "${VERSION}"/manifests/mongodb-atlas-kubernetes.clusterserviceversion.yaml | ||
|
|
||
| # Add skip range | ||
| value='">=0.8.0"' yq e -i '.spec.skipRange = env(value)' "${VERSION}"/manifests/mongodb-atlas-kubernetes.clusterserviceversion.yaml | ||
| - name: Push Changes & Open PR | ||
| env: | ||
| VERSION: ${{ github.event.inputs.version }} | ||
| REPOSITORY: ${{ matrix.repository }} | ||
| ASSIGNEES: priyolahiri,fabritsius,igor-karpukhin,sugar-pack,helderjs | ||
| run: | | ||
| cd "$REPOSITORY/$REPO_PATH" | ||
|
|
||
| # Sync fork | ||
| gh auth setup-git | ||
| gh repo sync -b main | ||
|
|
||
| # configure git user | ||
| git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
| git config --global user.name "github-actions[bot]" | ||
|
|
||
| # commit, push | ||
| git checkout -b "mongodb-atlas-operator-community-${VERSION}" | ||
| git add "${VERSION}" | ||
| git status | ||
| git commit -m "MongoDB Atlas Operator ${VERSION}" --signoff | ||
| git push origin "mongodb-atlas-operator-community-${VERSION}" | ||
|
|
||
| # open PR | ||
| gh pr create \ | ||
| --title "operator mongodb-atlas-kubernetes (${VERSION})" \ | ||
| --assignee "${ASSIGNEES}" | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.