Skip to content

Commit

Permalink
Merge pull request #70 from bioconda/test-quay-push
Browse files Browse the repository at this point in the history
Test quay push
  • Loading branch information
daler authored Jan 27, 2024
2 parents 14de74c + b221546 commit 5abfac0
Showing 1 changed file with 38 additions and 26 deletions.
64 changes: 38 additions & 26 deletions .github/workflows/build-env-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,29 @@ on:
- '.github/workflows/build-env-image.yml'
push:
branches:
- 'main'
- 'test-push'
paths:
- 'images/build-env/**'
- '.github/workflows/build-env-image.yml'

env:
MAJOR_VERSION: 3
MINOR_VERSION: 0

jobs:
build:
name: Build image - ${{ matrix.image }}
runs-on: ubuntu-22.04
outputs:
tags: ${{ steps.test.outputs.tags }}
strategy:
matrix:
include:
- arch: arm64
image: bioconda/bioconda-utils-build-env-cos7-aarch64
image: bioconda/tmp-bioconda-utils-build-env-cos7-aarch64
base_image: quay.io/condaforge/linux-anvil-aarch64
- arch: amd64
image: bioconda/bioconda-utils-build-env-cos7-x86_64
image: bioconda/tmp-bioconda-utils-build-env-cos7-x86_64
base_image: quay.io/condaforge/linux-anvil-cos7-x86_64
steps:
- name: Checkout bioconda-containers
Expand All @@ -37,16 +46,11 @@ jobs:
repository: 'bioconda/bioconda-utils'
path: 'bioconda-utils'

- id: get-tag
run: |
tag=${{ github.event.release && github.event.release.tag_name || github.sha }}
printf %s "tag=${tag#v}" >> $GITHUB_OUTPUT
- name: Install qemu dependency
if: ${{ matrix.arch == 'arm64' }}
- name: Install QEMU dependency
if: ${{ matrix.arch != 'amd64' }}
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
platforms: ${{ matrix.arch }}

- name: Build image
id: buildah-build
Expand All @@ -58,19 +62,23 @@ jobs:
BASE_IMAGE=${{ matrix.base_image }}
tags: >-
latest
${{ steps.get-tag.outputs.tag }}
${{ env.MAJOR_VERSION }}
${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}
dockerfiles: |
./images/build-env/Dockerfile
- name: Test built image
id: test
run: |
image='${{ steps.buildah-build.outputs.image }}'
for tag in ${{ steps.buildah-build.outputs.tags }} ; do
podman run --rm "${image}:${tag}" bioconda-utils --version
done
tags_json=$(echo -n "${{ steps.buildah-build.outputs.tags }}" | jq --compact-output --raw-input --slurp 'split(" ")')
echo "tags=${tags_json}" >> $GITHUB_OUTPUT
- name: Push To Quay
if: github.ref == 'refs/heads/main' && github.repository == 'bioconda/bioconda-containers'
if: github.ref == 'refs/heads/test-push' && github.repository == 'bioconda/bioconda-containers'
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.buildah-build.outputs.image }}
Expand All @@ -82,15 +90,15 @@ jobs:
build-manifest:
needs: [build]
if: github.ref == 'refs/heads/main' && github.repository == 'bioconda/bioconda-containers'
name: quay.io/bioconda/${{ matrix.cfg.DOCKER_MANIFEST }}:${{ matrix.cfg.DOCKER_TAG }}
runs-on: ubuntu-latest
name: Build and push Docker manifest
runs-on: ubuntu-22.04
env:
DOCKER_MANIFEST: bioconda-utils-build-env-cos7
DOCKER_IMAGES: "quay.io/<<USER>>/bioconda-utils-build-env-cos7:<<TAG>>,quay.io/<<USER>>/bioconda-utils-build-env-cos7-aarch64:<<TAG>>"
strategy:
fail-fast: false
fail-fast: true
matrix:
cfg:
- DOCKER_MANIFEST: bioconda-utils-build-env-cos7
DOCKER_TAG: "latest"
DOCKER_IMAGES: "quay.io/<<USER>>/bioconda-utils-build-env-cos7:<<TAG>>,quay.io/<<USER>>/bioconda-utils-build-env-cos7-aarch64:<<TAG>>"
tag: ${{ fromJson(needs.build.outputs.tags) }}

steps:
- uses: actions/checkout@v4
Expand All @@ -99,7 +107,7 @@ jobs:
id: interpolate
run: |
set -x
INTERPOLATED=`echo "${{ matrix.cfg.DOCKER_IMAGES }}" | sed "s#<<USER>>#${{ secrets.QUAY_BIOCONDA_USERNAME }}#g" | sed "s#<<TAG>>#${{ matrix.cfg.DOCKER_TAG }}#g"`
INTERPOLATED=`echo "${{ env.DOCKER_IMAGES }}" | sed "s#<<USER>>#${{ secrets.QUAY_BIOCONDA_USERNAME }}#g" | sed "s#<<TAG>>#${{ matrix.tag }}#g"`
echo "DOCKER_IMAGES=${INTERPOLATED}" >> "$GITHUB_OUTPUT"
- name: Login to Quay.io registry
Expand All @@ -110,8 +118,12 @@ jobs:
password: ${{ secrets.QUAY_BIOCONDA_TOKEN }}

- name: Push Docker manifest list for quay.io/bioconda
uses: Noelware/[email protected]
with:
inputs: quay.io/${{ secrets.QUAY_BIOCONDA_USERNAME }}/${{ matrix.cfg.DOCKER_MANIFEST }}:${{ matrix.cfg.DOCKER_TAG }}
images: ${{ steps.interpolate.outputs.DOCKER_IMAGES }}
push: true
run: |
PREFIX=${{ secrets.QUAY_BIOCONDA_REPO }}/${{ secrets.QUAY_BIOCONDA_USERNAME }}
docker manifest create ${PREFIX}/${{ env.DOCKER_MANIFEST }}:${{ matrix.tag }} \
--amend ${PREFIX}/bioconda-utils-build-env-cos7-x86_64:${{ matrix.tag }} \
--amend ${PREFIX}/bioconda-utils-build-env-cos7-aarch64:${{ matrix.tag }}
docker manifest inspect ${PREFIX}/${{ env.DOCKER_MANIFEST }}:${{ matrix.tag }}
docker manifest push ${PREFIX}/${{ env.DOCKER_MANIFEST }}:${{ matrix.tag }}

0 comments on commit 5abfac0

Please sign in to comment.