Skip to content

Commit fde4296

Browse files
authored
Add support to arm64 (#796)
1 parent 7c0d2e8 commit fde4296

File tree

8 files changed

+168
-216
lines changed

8 files changed

+168
-216
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Build Container Image
2+
description: Builds the operator container image for the given architecture
3+
inputs:
4+
platforms:
5+
description: The list of platforms for which the image will be built
6+
required: true
7+
version:
8+
description: The version of the operator will be built
9+
required: true
10+
repository:
11+
description: The name of repository to build image
12+
required: true
13+
docker_username:
14+
description: The username to access the docker registry
15+
required: true
16+
docker_password:
17+
description: The password to access the docker registry
18+
required: true
19+
push_to_quay:
20+
description: Also push image to quay.io
21+
required: false
22+
default: "false"
23+
quay_username:
24+
description: The username to access the docker registry
25+
required: false
26+
quay_password:
27+
description: The password to access the docker registry
28+
required: false
29+
forked:
30+
description: Flag to checkout source code from forked repository
31+
required: false
32+
default: "false"
33+
runs:
34+
using: "composite"
35+
steps:
36+
- name: Check out code
37+
uses: actions/[email protected]
38+
if: ${{ inputs.forked == false }}
39+
with:
40+
submodules: true
41+
fetch-depth: 0
42+
- name: Check out code for forked PR
43+
uses: actions/[email protected]
44+
if: ${{ inputs.forked == true }}
45+
with:
46+
ref: ${{github.event.pull_request.head.sha}}
47+
repository: ${{github.event.pull_request.head.repo.full_name}}
48+
submodules: true
49+
- name: "Set up QEMU"
50+
uses: docker/setup-qemu-action@v2
51+
with:
52+
platforms: ${{ inputs.platforms }}
53+
- name: "Set up Docker Buildx"
54+
uses: docker/setup-buildx-action@v2
55+
with:
56+
platforms: ${{ inputs.platforms }}
57+
- name: Login to docker registry
58+
uses: docker/login-action@v2
59+
with:
60+
username: ${{ inputs.docker_username }}
61+
password: ${{ inputs.docker_password }}
62+
- name: Build and Push Operator to Docker Registry
63+
uses: docker/build-push-action@v3
64+
with:
65+
context: .
66+
build-args: VERSION=${{ inputs.version }}
67+
platforms: ${{ inputs.platforms }}
68+
tags: ${{ inputs.repository }}:${{ inputs.version }}
69+
push: true
70+
- name: Login to quay.io registry
71+
if: ${{ inputs.push_to_quay == true }}
72+
uses: docker/login-action@v2
73+
with:
74+
registry: quay.io
75+
username: ${{ inputs.quay_username }}
76+
password: ${{ inputs.quay_password }}
77+
- name: Build and Push Operator to Docker Registry
78+
if: ${{ inputs.push_to_quay == true }}
79+
uses: docker/build-push-action@v3
80+
with:
81+
context: .
82+
build-args: VERSION=${{ inputs.version }}
83+
platforms: ${{ inputs.platforms }}
84+
tags: quay.io/${{ inputs.repository }}:${{ inputs.version }}
85+
push: true
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
FROM alpine:latest
22

3+
RUN apk update && \
4+
apk add --no-cache curl jq
5+
6+
RUN curl -LO https://github.com/redhat-openshift-ecosystem/openshift-preflight/releases/download/1.4.3/preflight-linux-amd64 && \
7+
chmod +x ./preflight-linux-amd64 && \
8+
sudo mv ./preflight-linux-amd64 /usr/local/bin/preflight
9+
310
COPY entrypoint.sh /home/entrypoint.sh
411
RUN chmod +x /home/entrypoint.sh
12+
513
# Code file to execute when the docker container starts up (`entrypoint.sh`)
614
ENTRYPOINT ["/home/entrypoint.sh"]
Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
name: 'certify-openshift-images'
2-
description: 'push image to RedHat Connect for certification'
2+
description: 'Push image to RedHat Connect for certification'
3+
inputs:
4+
repository:
5+
description: The name of repository of the image to be certified
6+
required: true
7+
version:
8+
description: The version of the image to be certified
9+
required: true
10+
quay_password:
11+
description: The password to access the quay.io registry
12+
required: true
13+
rhcc_token:
14+
description: The Redhat certification central API token
15+
required: true
16+
rhcc_project:
17+
description: The Redhat certification central project id
18+
required: true
319
runs:
420
using: 'docker'
521
image: 'Dockerfile'
22+
env:
23+
REPOSITORY: ${{ inputs.repository }}
24+
VERSION: ${{ inputs.version }}
25+
QUAY_PASSWORD: ${{ inputs.quay_password }}
26+
RHCC_TOKEN: ${{ inputs.rhcc_token }}
27+
RHCC_PROJECT: ${{ inputs.rhcc_project }}

.github/actions/certify-openshift-images/entrypoint.sh

Lines changed: 16 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,19 @@
22

33
set -eou pipefail
44

5-
if [ -z "${IMAGE+x}" ]; then
6-
echo "IMAGE is not set"
7-
exit 1
8-
fi
9-
10-
if [ -z "${VERSION+x}" ]; then
11-
echo "VERSION is not set"
12-
exit 1
13-
fi
14-
15-
if [ -z "${RH_CERTIFICATION_OSPID+x}" ]; then
16-
echo "RH_CERTIFICATION_OSPID is not set"
17-
exit 1
18-
fi
19-
20-
if [ -z "${RH_CERTIFICATION_TOKEN+x}" ]; then
21-
echo "RH_CERTIFICATION_TOKEN is not set"
22-
exit 1
23-
fi
24-
25-
if [ -z "${RH_CERTIFICATION_PYXIS_API_TOKEN+x}" ]; then
26-
echo "RH_CERTIFICATION_PYXIS_API_TOKEN is not set"
27-
exit 1
28-
fi
29-
30-
if [ -z "${CONTAINER_ENGINE+x}" ]; then
31-
echo "CONTAINER_ENGINE is not set, defaulting to podman"
32-
CONTAINER_ENGINE=podman
33-
fi
34-
35-
preflight --version
36-
${CONTAINER_ENGINE} --version
37-
38-
${CONTAINER_ENGINE} login -u unused -p "${RH_CERTIFICATION_TOKEN}" scan.connect.redhat.com --authfile ./authfile.json
39-
40-
IMG_SHA=$("${CONTAINER_ENGINE}" inspect --format='{{ index .RepoDigests 0}}' "${IMAGE}":"${VERSION}")
41-
42-
# Do the preflight check first
43-
preflight check container "${IMG_SHA}" --docker-config=./authfile.json
44-
45-
# Send results to RedHat if preflight finished without errors
46-
preflight check container "${IMG_SHA}" \
47-
--submit \
48-
--pyxis-api-token="${RH_CERTIFICATION_PYXIS_API_TOKEN}" \
49-
--certification-project-id="${RH_CERTIFICATION_OSPID}" \
50-
--docker-config=./authfile.json
5+
docker login -u unused -p "${QUAY_PASSWORD}" quay.io
6+
7+
DIGESTS=$(docker manifest inspect "${REPOSITORY}:${VERSION}" | jq -r .manifests[].digest)
8+
9+
for DIGEST in $DIGESTS; do
10+
echo "Checking image $DIGEST"
11+
# Do the preflight check first
12+
preflight check container "${DIGEST}" --docker-config="${HOME}/.docker/config.json"
13+
14+
# Send results to RedHat if preflight finished without errors
15+
preflight check container "${DIGEST}" \
16+
--submit \
17+
--pyxis-api-token="${RHCC_TOKEN}" \
18+
--certification-project-id="${RHCC_PROJECT}" \
19+
--docker-config="${HOME}/.docker/config.json"
20+
done

.github/workflows/release-certify.yaml

Lines changed: 0 additions & 52 deletions
This file was deleted.

.github/workflows/release-post-merge.yml

Lines changed: 22 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,7 @@ jobs:
1919
if: ${{ (github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/')) || github.event.inputs.version != '' }}
2020
runs-on: ubuntu-latest
2121
env:
22-
DOCKER_RELEASE_REPO: mongodb/mongodb-atlas-kubernetes-operator
23-
REDHAT_SCAN_RELEASE_REGISTRY: scan.connect.redhat.com
24-
REDHAT_SCAN_OPERATOR_REPO: ospid-4b67df2e-b2d2-42ef-994e-e35dcff33ad4/mongodb-atlas-kubernetes-operator
25-
REDHAT_SCAN_BUNDLE_REPO: ospid-c531b655-554d-4c70-b592-c64723a5b840/mongodb-atlas-kubernetes-operator-bundle
26-
REDHAT_RELEASE_REGISTRY: registry.connect.redhat.com
27-
REDHAT_OPERATOR_REPO: mongodb/mongodb-atlas-kubernetes-operator
28-
QUAY_RELEASE_REGISTRY: quay.io
29-
QUAY_OPERATOR_REPO: mongodb/mongodb-atlas-kubernetes-operator
30-
QUAY_ROBOT_NAME: mongodb+mongodb_atlas_kubernetes
22+
IMAGE_REPOSITORY: mongodb/mongodb-atlas-kubernetes-operator
3123
steps:
3224
- name: Print Env and Get version
3325
id: tag
@@ -44,7 +36,6 @@ jobs:
4436
tag="v${version}"
4537
echo "version=$version" >> $GITHUB_OUTPUT
4638
echo "tag=$tag" >> $GITHUB_OUTPUT
47-
4839
- name: Trigger helm post release workflow
4940
run: |
5041
curl \
@@ -54,61 +45,34 @@ jobs:
5445
-H "X-GitHub-Api-Version: 2022-11-28" \
5546
https://api.github.com/repos/mongodb/helm-charts/actions/workflows/post-atlas-operator-release.yaml/dispatches \
5647
-d '{"ref":"main","inputs":{"version":"'"${{ steps.tag.outputs.version }}"'"}}'
57-
58-
- name: Check out code into the Go module directory
48+
- name: Check out code
5949
uses: actions/[email protected]
6050
with:
6151
submodules: true
62-
fetch-depth: 0 #needs for tags
63-
52+
fetch-depth: 0
53+
- name: Build and Push image
54+
uses: ./.github/actions/build-push-image
55+
with:
56+
repository: ${{ env.IMAGE_REPOSITORY }}
57+
version: ${{ steps.tag.outputs.tag }}
58+
platforms: linux/amd64,linux/arm64
59+
docker_username: ${{ secrets.DOCKER_USERNAME }}
60+
docker_password: ${{ secrets.DOCKER_PASSWORD }}
61+
push_to_quay: true
62+
quay_username: mongodb+mongodb_atlas_kubernetes
63+
quay_password: ${{ secrets.QUAY_PASSWORD }}
64+
- name: Certify Openshift images
65+
uses: ./.github/actions/certify-openshift-images
66+
with:
67+
repository: ${{ env.IMAGE_REPOSITORY }}
68+
version: ${{ steps.tag.outputs.tag }}
69+
quay_password: ${{ secrets.QUAY_PASSWORD }}
70+
rhcc_token: ${{ secrets.RH_CERTIFICATION_PYXIS_API_TOKEN }}
71+
rhcc_project: ${{ secrets.RH_CERTIFICATION_OSPID }}
6472
- name: Create configuration package
6573
run: |
6674
set -x
6775
tar czvf atlas-operator-all-in-one-${{ steps.tag.outputs.version }}.tar.gz -C deploy all-in-one.yaml
68-
69-
- name: Login to docker registry
70-
uses: docker/login-action@v2
71-
with:
72-
registry: ${{ env.DOCKER_REGISTRY }}
73-
username: ${{ secrets.DOCKER_USERNAME }}
74-
password: ${{ secrets.DOCKER_PASSWORD }}
75-
- name: Prepare docker image tag
76-
id: prepare-docker-image-tag
77-
run: |
78-
REPOSITORY=${{ env.DOCKER_RELEASE_REPO }}
79-
TAG=${{ steps.tag.outputs.version }}
80-
TAGS="${REPOSITORY}:${TAG}"
81-
echo "tags=$TAGS" >> $GITHUB_OUTPUT
82-
- name: Push Atlas Operator to Registry
83-
uses: docker/build-push-action@v3
84-
with:
85-
context: .
86-
push: true
87-
tags: ${{ steps.prepare-docker-image-tag.outputs.tags }}
88-
build-args: VERSION=${{ steps.tag.outputs.tag }}
89-
90-
- name: Login to Quay registry
91-
uses: docker/login-action@v2
92-
with:
93-
registry: ${{ env.QUAY_RELEASE_REGISTRY }}
94-
username: ${{ env.QUAY_ROBOT_NAME }}
95-
password: ${{ secrets.QUAY_PASSWORD }}
96-
- name: Prepare docker Quay image tag
97-
id: prepare-quay-image-tag
98-
run: |
99-
REGISTRY=${{ env.QUAY_RELEASE_REGISTRY }}
100-
REPOSITORY=${{ env.QUAY_OPERATOR_REPO }}
101-
TAG=${{ steps.tag.outputs.version }}
102-
TAGS="${REGISTRY}/${REPOSITORY}:${TAG}"
103-
echo "tags=$TAGS" >> $GITHUB_OUTPUT
104-
- name: Push Atlas Operator to Quay Registry
105-
uses: docker/build-push-action@v3
106-
with:
107-
context: .
108-
push: true
109-
tags: ${{ steps.prepare-quay-image-tag.outputs.tags }}
110-
build-args: VERSION=${{ steps.tag.outputs.tag }}
111-
11276
- name: Create Release
11377
id: create_release
11478
uses: actions/create-release@v1
@@ -120,7 +84,6 @@ jobs:
12084
body_path: docs/release-notes/release-notes.md
12185
draft: true
12286
prerelease: false
123-
12487
- name: Upload Release Asset
12588
id: upload-release-asset
12689
uses: actions/upload-release-asset@v1

0 commit comments

Comments
 (0)