-
Notifications
You must be signed in to change notification settings - Fork 94
CLOUDP-329235/release-images #2447
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
Draft
andrpac
wants to merge
1
commit into
main
Choose a base branch
from
CLOUDP-329235/release-images
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
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
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
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,204 @@ | ||
name: Release Image | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: "Release version (e.g., 1.2.3)" | ||
required: true | ||
type: string | ||
authors: | ||
description: "Comma-separated list of the release authors' emails" | ||
required: true | ||
type: string | ||
commit_sha: | ||
description: "Commit SHA to use for the image (e.g. 7c2a91 or latest)" | ||
required: false | ||
default: "latest" | ||
type: string | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
release-image: | ||
runs-on: ubuntu-latest | ||
environment: release | ||
env: | ||
VERSION: ${{ inputs.version }} | ||
AUTHORS: ${{ inputs.authors }} | ||
COMMIT_SHA: ${{ inputs.commit_sha }} | ||
|
||
DOCKER_RELEASE_REPO: docker.io/mongodb/mongodb-atlas-kubernetes-operator | ||
DOCKER_PRERELEASE_REPO: docker.io/mongodb/mongodb-atlas-kubernetes-operator-prerelease | ||
DOCKER_SIGNATURE_REPO: docker.io/mongodb/signatures | ||
QUAY_RELEASE_REPO: quay.io/mongodb/mongodb-atlas-kubernetes-operator | ||
QUAY_PRERELEASE_REPO: quay.io/mongodb/mongodb-atlas-kubernetes-operator-prerelease | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Generate GitHub App Token | ||
id: generate_token | ||
uses: mongodb/apix-action/token@v8 | ||
with: | ||
app-id: ${{ secrets.AKO_RELEASER_APP_ID }} | ||
private-key: ${{ secrets.AKO_RELEASER_RSA_KEY }} | ||
|
||
# Login in into all registries | ||
- name: Log in to Docker registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: docker.io | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.OCKER_PASSWORD }} | ||
|
||
- name: Log in to Quay registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAY_USERNAME }} | ||
password: ${{ secrets.QUAY_PASSWORD }} | ||
|
||
- name: Log in to Artifactory | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: artifactory.corp.mongodb.com | ||
username: ${{ secrets.MDB_ARTIFACTORY_USERNAME }} | ||
password: ${{ secrets.MDB_ARTIFACTORY_PASSWORD }} | ||
|
||
- name: Install devbox | ||
uses: jetify-com/[email protected] | ||
|
||
- name: Resolve commit SHA and tags | ||
id: tags | ||
run: | | ||
if [ "${{ env.COMMIT_SHA }}" = "latest" ]; then | ||
git fetch origin main | ||
sha=$(git rev-parse origin/main) | ||
else | ||
sha="${{ env.COMMIT_SHA }}" | ||
fi | ||
|
||
short_sha="${sha:0:6}" | ||
promoted_tag="promoted-${short_sha}" | ||
release_tag="${{ env.VERSION }}" | ||
certified_tag="certified-${release_tag}" | ||
|
||
docker_image_url="${{ env.DOCKER_RELEASE_REPO }}:${release_tag}" | ||
quay_image_url="${{ env.QUAY_RELEASE_REPO }}:${release_tag}" | ||
quay_certified_image_url="${{ env.QUAY_RELEASE_REPO }}:${certified_tag}" | ||
|
||
echo "promoted_tag=${promoted_tag}" >> "$GITHUB_OUTPUT" | ||
echo "release_tag=${release_tag}" >> "$GITHUB_OUTPUT" | ||
echo "certified_tag=${certified_tag}" >> "$GITHUB_OUTPUT" | ||
echo "docker_image_url=${docker_image_url}" >> "$GITHUB_OUTPUT" | ||
echo "quay_image_url=${quay_image_url}" >> "$GITHUB_OUTPUT" | ||
echo "quay_certified_image_url=${quay_certified_image_url}" >> "$GITHUB_OUTPUT" | ||
|
||
# Move prerelease images to official release registries in Docker Hub and Quay | ||
- name: Promote Docker prerelease image | ||
run: devbox run -- ./scripts/move-image.sh | ||
env: | ||
IMAGE_SRC_REPO: ${{ env.DOCKER_PRERELEASE_REPO }} | ||
IMAGE_DEST_REPO: ${{ env.DOCKER_RELEASE_REPO }} | ||
IMAGE_SRC_TAG: ${{ steps.tags.outputs.promoted_tag }} | ||
IMAGE_DEST_TAG: ${{ steps.tags.outputs.release_tag }} | ||
|
||
- name: Promote Quay prerelease image | ||
run: devbox run -- ./scripts/move-image.sh | ||
env: | ||
IMAGE_SRC_REPO: ${{ env.QUAY_PRERELEASE_REPO }} | ||
IMAGE_DEST_REPO: ${{ env.QUAY_RELEASE_REPO }} | ||
IMAGE_SRC_TAG: ${{ steps.tags.outputs.promoted_tag }} | ||
IMAGE_DEST_TAG: ${{ steps.tags.outputs.release_tag }} | ||
|
||
# Create Openshift certified images | ||
- name: Create OpenShift certified image on Quay | ||
run: devbox run -- ./scripts/move-image.sh | ||
env: | ||
IMAGE_SRC_REPO: ${{ env.QUAY_PRERELEASE_REPO }} | ||
IMAGE_DEST_REPO: ${{ env.QUAY_RELEASE_REPO }} | ||
IMAGE_SRC_TAG: ${{ steps.tags.outputs.promoted_tag }} | ||
IMAGE_DEST_TAG: ${{ steps.tags.outputs.certified_tag }} | ||
|
||
- name: Certify Openshift images | ||
uses: ./.github/actions/certify-openshift-images | ||
with: | ||
registry: quay.io | ||
version: ${{ steps.tags.outputs.certified_tag }} | ||
repository: mongodb/mongodb-atlas-kubernetes-operator | ||
registry_password: ${{ secrets.QUAY_PASSWORD }} | ||
rhcc_project: ${{ secrets.RH_CERTIFICATION_OSPID }} | ||
rhcc_token: ${{ secrets.RH_CERTIFICATION_PYXIS_API_TOKEN }} | ||
submit: true | ||
|
||
# Link updates to pr: all-in-one.yml, helm-updates, sdlc requirements | ||
- name: Generate deployment configurations | ||
uses: ./.github/actions/gen-install-scripts | ||
with: | ||
ENV: prod | ||
IMAGE_URL: ${{ steps.tags.outputs.docker_image_url }} | ||
|
||
- name: Bump Helm chart version | ||
run: devbox run -- ./scripts/bump-helm-chart-version.sh | ||
|
||
# Prepare SDLC requirement: signatures, sboms, compliance reports | ||
# Note, signed images will live in mongodb/release and mongodb/signature repos | ||
- name: Sign released images | ||
run: | | ||
devbox run -- make sign IMG="${{ steps.tags.outputs.docker_image_url }}" SIGNATURE_REPO="${{ env.DOCKER_RELEASE_REPO }}" | ||
devbox run -- make sign IMG="${{ steps.tags.outputs.quay_image_url }}" SIGNATURE_REPO="${{ env.QUAY_RELEASE_REPO }}" | ||
devbox run -- make sign IMG="${{ steps.tags.outputs.docker_image_url }}" SIGNATURE_REPO="${{ env.DOCKER_SIGNATURE_REPO }}" | ||
devbox run -- make sign IMG="${{ steps.tags.outputs.quay_certified_image_url }}" SIGNATURE_REPO="${{ env.QUAY_RELEASE_REPO }}" | ||
devbox run -- make sign IMG="${{ steps.tags.outputs.quay_certified_image_url }}" SIGNATURE_REPO="${{ env.DOCKER_SIGNATURE_REPO }}" | ||
env: | ||
PKCS11_URI: ${{ secrets.PKCS11_URI }} | ||
GRS_USERNAME: ${{ secrets.GRS_USERNAME }} | ||
GRS_PASSWORD: ${{ secrets.GRS_PASSWORD }} | ||
|
||
- name: Generate SBOMs | ||
run: devbox run -- make generate-sboms | ||
env: | ||
RELEASED_OPERATOR_IMAGE: ${{ env.DOCKER_RELEASE_REPO }} | ||
|
||
- name: Generate SDLC report | ||
run: devbox run -- make gen-sdlc-checklist | ||
|
||
# Create pr with all updates | ||
- name: Create pull request for release changes | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
token: ${{ steps.generate_token.outputs.token }} | ||
commit-message: "chore(release): updates from new release v${{ env.VERSION }}" | ||
title: "Release v${{ env.VERSION }}" | ||
body: | | ||
This PR was automatically generated by the **release-image** workflow. | ||
|
||
Version: `${{ env.VERSION }}` | ||
Authors: ${{ env.AUTHORS }} | ||
base: main | ||
branch: "new-release/${{ env.VERSION }}" # This should avoid for now running all tests till we fix cloud-test-filter.yml | ||
delete-branch: true | ||
draft: true | ||
|
||
# Create release assets on GitHub | ||
- name: Create configuration package | ||
run: | | ||
devbox run -- 'set -x' | ||
devbox run -- 'tar czvf atlas-operator-all-in-one-${{ env.VERSION }}.tar.gz -C deploy all-in-one.yaml' | ||
|
||
- name: Create GitHub Release and Upload Asset | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
draft: true | ||
prerelease: false | ||
tag_name: ${{ env.VERSION }} | ||
name: ${{ env.VERSION }} | ||
body_path: docs/release-notes/release-notes-template.md | ||
files: ./atlas-operator-all-in-one-${{ env.VERSION }}.tar.gz | ||
token: ${{ steps.generate_token.outputs.token }} |
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am guessing the idea is to use
latest
more often than not, right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes exactly.