Skip to content

Commit

Permalink
Fixed Docker build-push-image (#1229)
Browse files Browse the repository at this point in the history
Fixed Docker build-push-image
  • Loading branch information
igor-karpukhin authored Nov 13, 2023
1 parent ed2e477 commit 9421474
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 31 deletions.
33 changes: 6 additions & 27 deletions .github/actions/build-push-image/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ inputs:
description: Flag to checkout source code from forked repository
required: false
default: "false"
tags:
description: A list of tags applied to the image
required: true
runs:
using: "composite"
steps:
Expand Down Expand Up @@ -84,17 +87,9 @@ runs:
go mod download
- name: Build all platforms
shell: bash
env:
VERSION: ${{ inputs.version }}
run: make all-platforms
- name: Fail if send input flags are both unset
if: ${{ inputs.push_to_docker != 'true' && inputs.push_to_quay != 'true' }}
shell: bash
run: exit 1
- name: Compute main build tag
id: tag
shell: bash
run: |
main_tag=${{ inputs.push_to_docker == 'true' && format('{0}:{1}', inputs.repository, inputs.version) || format('quay.io/{0}:{1}', inputs.repository, inputs.version)}}
echo "main_tag=$main_tag" >> $GITHUB_OUTPUT
- name: Login to docker registry
if: ${{ inputs.push_to_docker == 'true' }}
uses: docker/login-action@v2
Expand All @@ -119,20 +114,4 @@ runs:
cache-to: type=gha,mode=max
sbom: true
push: true
tags: ${{ steps.tag.outputs.main_tag }}
- name: Push To Quay
if: ${{ inputs.push_to_quay == 'true' && inputs.push_to_docker == 'true' }}
shell: bash
run: |
docker pull ${{ steps.tag.outputs.main_tag }}
docker tag ${{ steps.tag.outputs.main_tag }} quay.io/${{ inputs.repository }}:${{ inputs.version }}
echo "PUSH: docker push quay.io/${{ inputs.repository }}:${{ inputs.version }}"
docker push quay.io/${{ inputs.repository }}:${{ inputs.version }}
- name: Push Certified to Quay
if: ${{ inputs.certified_version != '' && inputs.push_to_quay == 'true' }}
shell: bash
run: |
docker pull ${{ steps.tag.outputs.main_tag }}
docker tag ${{ steps.tag.outputs.main_tag }} quay.io/${{ inputs.repository }}:${{ inputs.certified_version }}
echo "PUSH: docker push quay.io/${{ inputs.repository }}:${{ inputs.certified_version }}"
docker push quay.io/${{ inputs.repository }}:${{ inputs.certified_version }}
tags: ${{ inputs.tags }}
2 changes: 1 addition & 1 deletion .github/actions/certify-openshift-images/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -eou pipefail

docker login -u mongodb+mongodb_atlas_kubernetes -p "${QUAY_PASSWORD}" quay.io

DIGESTS=$(docker manifest inspect "quay.io/${REPOSITORY}:${VERSION}" | jq -r .manifests[].digest)
DIGESTS=$(docker manifest inspect "quay.io/${REPOSITORY}:${VERSION}" | jq -r '.manifests[] | select(.platform.os!="unknown") | .digest')

for DIGEST in $DIGESTS; do
echo "Check and Submit result to RedHat Connect"
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/release-post-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ jobs:
if [[ "$version" == "" ]]; then
version=$(echo $BRANCH | awk -F '/' '{print $2}')
fi
echo "VERSION:$version"
tag="v${version}"
certified_version="${version}-certified"
Expand Down Expand Up @@ -101,6 +99,10 @@ jobs:
push_to_quay: true
quay_username: mongodb+mongodb_atlas_kubernetes
quay_password: ${{ secrets.QUAY_PASSWORD }}
tags: |
${{ env.IMAGE_REPOSITORY }}:${{ steps.tag.outputs.version }}
quay.io/${{ env.IMAGE_REPOSITORY }}:${{ steps.tag.outputs.version }}
quay.io/${{ env.IMAGE_REPOSITORY }}:${{ steps.tag.outputs.version }}-certified
- name: Certify Openshift images
if: ${{ env.CERTIFY == 'true' }}
uses: ./.github/actions/certify-openshift-images
Expand Down Expand Up @@ -138,4 +140,3 @@ jobs:
asset_name: atlas-operator-all-in-one-${{ steps.tag.outputs.version }}.tar.gz
asset_content_type: application/tgz

# TODO RedHad autopublish does not work. need to push bundles manually for now
2 changes: 2 additions & 0 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
with:
repository: ${{ env.DOCKER_REPO }}
version: ${{ steps.prepare.outputs.tag }}
tags: ${{ env.DOCKER_REPO }}:${{ steps.prepare.outputs.tag }}
platforms: linux/amd64
docker_username: ${{ secrets.DOCKER_USERNAME }}
docker_password: ${{ secrets.DOCKER_PASSWORD }}
Expand Down Expand Up @@ -110,6 +111,7 @@ jobs:
file: bundle.Dockerfile
repository: ${{ env.DOCKER_BUNDLES_REPO }}
version: ${{ steps.prepare.outputs.tag }}
tags: ${{ env.DOCKER_REPO }}:${{ steps.prepare.outputs.tag }}
platforms: linux/amd64
push_to_docker: false
push_to_quay: true
Expand Down

0 comments on commit 9421474

Please sign in to comment.