Skip to content
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

Test push #73

Open
wants to merge 51 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
1402570
Use environment variables to set the major and minor versions
martin-g Jan 17, 2024
949ac0d
Move the environment variables to be workflow level
martin-g Jan 24, 2024
450d72e
Build and push manifests for several tags
martin-g Jan 24, 2024
5bbfdff
Temporary enable pushing
martin-g Jan 24, 2024
958672e
Use vars. context for the Quay.io username
martin-g Jan 24, 2024
ea80a8e
Convert Bash array 'tags' to JSON array
martin-g Jan 24, 2024
c1751f9
Debug bash array to json array
martin-g Jan 24, 2024
13dabbe
More debug
martin-g Jan 24, 2024
4e4cf37
Convert Bash string to JSON array.
martin-g Jan 24, 2024
17d313e
Use `docker manifest` cli instead of Noelware/docker-manifest-action
martin-g Jan 24, 2024
165af24
Go back to `secrets.QUAY_BIOCONDA_USERNAME`
martin-g Jan 24, 2024
aab49c0
Re-enable the check for push to main before pushing the manifest
martin-g Jan 24, 2024
b221546
convert to testing targets
daler Jan 27, 2024
5abfac0
Merge pull request #70 from bioconda/test-quay-push
daler Jan 27, 2024
04e6b30
add a round of comments to GH actions workflows
daler Jan 27, 2024
7388860
build build-env images similar to others
daler Jan 27, 2024
3938cd1
fix name
daler Jan 27, 2024
66efe12
version bumps
daler Jan 27, 2024
d257763
match format of others
daler Jan 27, 2024
82bd178
syntax
daler Jan 27, 2024
e9d5cf6
syntax
daler Jan 27, 2024
cfdcde2
syntax
daler Jan 28, 2024
5d0aceb
syntax
daler Jan 28, 2024
db02883
move dockerfiles to dir named after image
daler Jan 28, 2024
de684e6
echo
daler Jan 28, 2024
690e42a
separate command
daler Jan 28, 2024
2dd87a3
clone bioconda-utils inside image dir
daler Jan 28, 2024
cee5147
bump qemu action version
daler Jan 28, 2024
03f6fb7
activate env for testing
daler Jan 28, 2024
dd004ce
version bump create-env
daler Jan 28, 2024
1ea3270
rename yaml to be consistent with image name
daler Jan 28, 2024
ce01478
fix getting bioconda-utils version
daler Jan 28, 2024
2ef2354
rm labeling using bioconda-utils for now
daler Jan 28, 2024
fbff2c8
add back bioconda-utils label
daler Jan 28, 2024
19aba6b
target test-push branch
daler Jan 28, 2024
a51a5d3
Merge branch 'test-push' into test-push-quay2
daler Jan 28, 2024
4eeb784
Merge pull request #72 from bioconda/test-push-quay2
daler Jan 28, 2024
1463464
differentiate between image name and image dir
daler Jan 28, 2024
c035696
handle cases if image doesn't exist in registry yet
daler Jan 28, 2024
c0c0fb1
hard-code repo
daler Jan 28, 2024
3bed6b0
typo
daler Jan 28, 2024
3b3df34
debug
daler Jan 28, 2024
29f1500
better check
daler Jan 28, 2024
e4a0540
try pushing an image that has worked before
daler Jan 28, 2024
1164bfb
port recent changes to busybox
daler Jan 28, 2024
5fec036
comment out push
daler Jan 29, 2024
ed9a1f9
try new credentials
daler Jan 29, 2024
319b352
whitespace to trigger
daler Jan 29, 2024
1387d2d
disable push for now
daler Jan 29, 2024
8e89ac2
re-enable push
daler Jan 29, 2024
f2c528c
back to original credentials
daler Jan 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 46 additions & 17 deletions .github/workflows/base-glibc-busybox-bash.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,50 @@ jobs:
# The base image is not intended to change often and should be used with
# version tags or checksum IDs, but not via "latest".
MAJOR_VERSION: 3
MINOR_VERSION: 0
IMAGE_NAME: base-glibc-busybox-bash
MINOR_VERSION: 1
BUSYBOX_VERSION: '1.36.1'
DEBIAN_VERSION: '12.2'
# Used for testing -- set to something like 'tmp-' or 'test-' to prefix
# images with this name during testing
IMAGE_PREFIX: "tmp-"
IMAGE_NAME: base-glibc-busybox-bash

steps:
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
with:
platforms: arm64

- name: Build
id: build
run: |
set -xeu
cd 'images/${{ env.IMAGE_NAME }}'

image_name='${{ env.IMAGE_NAME }}'
image_name='${{ env.IMAGE_PREFIX }}${{ env.IMAGE_NAME }}'
image_dir='images/${{ env.IMAGE_NAME }}'
tags='
${{ env.MAJOR_VERSION }}
${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}
latest
'
# Adds image and tags to outputs which can be used in later steps.
printf %s\\n \
"image=${image_name}" \
"image_dir=${image_dir}" \
"image_name=${image_name}" \
"tags=$( echo ${tags} )" \
>> $GITHUB_OUTPUT

cd 'images/${{ env.IMAGE_NAME }}'

# Create manifest (which is considered arch-independent)
for tag in ${tags} ; do
buildah manifest create "${image_name}:${tag}"
done

# --iidfile prints the built image ID to the specified file. This is
# used so we can refer to the image in later steps.
iidfile="$( mktemp )"
buildah bud \
--iidfile="${iidfile}" \
Expand All @@ -71,6 +81,7 @@ jobs:
image_id="$( cat "${iidfile}" )"
rm "${iidfile}"

# Extract various package info and version info to store as labels
container="$( buildah from "${image_id}" )"
run() { buildah run "${container}" "${@}" ; }
deb_list="$( run cat /.deb.lst | tr '\n' '|' | sed 's/|$//' )"
Expand All @@ -80,6 +91,7 @@ jobs:
bash="$( run bash --version | sed '1!d' )"
buildah rm "${container}"

# Store package/version info as labels for the image
container="$( buildah from "${image_id}" )"
buildah config \
--label=glibc="${glibc}" \
Expand All @@ -89,8 +101,11 @@ jobs:
--label=pkg-list="${pkg_list}" \
"${container}"

# Store the new image (now with labels)
image_id="$( buildah commit "${container}" )"
buildah rm "${container}"

# image tag includes arch; then added to manifest which does not include arch
for tag in ${tags} ; do
buildah tag \
"${image_id}" \
Expand All @@ -103,7 +118,10 @@ jobs:

- name: Test
run: |
image='${{ steps.build.outputs.image }}'
image_name='${{ steps.build.outputs.image_name }}'
image_dir='${{ steps.build.outputs.image_dir }}'

# Extract image ids from manifest to test.
ids="$(
for tag in ${{ steps.build.outputs.tags }} ; do
buildah manifest inspect "${image}:${tag}" \
Expand All @@ -114,25 +132,34 @@ jobs:
done
done
)"

# See Dockerfile.test for actual tests run
ids="$( printf %s "${ids}" | sort -u )"
for id in ${ids} ; do
podman history "${id}"
buildah bud \
--build-arg=base="${id}" \
--file=Dockerfile.test \
"images/${image}"
"${image_dir}"
done
buildah rmi --prune || true

- name: Check Tags
run: |
# FIX upstream: Quay.io does not support immutable images currently.
# => Try to use the REST API to check for duplicate tags.
# => Try to use the REST API to check for duplicate tags and exit if they exist
response="$(
curl -sL \
'https://quay.io/api/v1/repository/bioconda/${{ steps.build.outputs.image }}/tag/'
'https://quay.io/api/v1/repository/bioconda/${{ steps.build.outputs.image_name }}/tag/'
)"

# This might be the first time making this image (e.g., will likely
# happen when using a test prefix), in which case there will be no
# available images.
if [ "$(echo "${response}" | jq -r '.error_message')" == "Requires authentication" ]; then
exit 0
fi

existing_tags="$(
printf %s "${response}" \
| jq -r '.tags[]|select(.end_ts == null or .end_ts >= now)|.name'
Expand All @@ -156,23 +183,25 @@ jobs:
esac
done

- if: ${{ github.ref == 'refs/heads/main' }}
- if: ${{ github.ref == 'refs/heads/test-push' }}
name: Push
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build.outputs.image }}
image: ${{ steps.build.outputs.image_name }}
tags: ${{ steps.build.outputs.tags }}
registry: ${{ secrets.QUAY_BIOCONDA_REPO }}
registry: quay.io/bioconda
username: ${{ secrets.QUAY_BIOCONDA_USERNAME }}
password: ${{ secrets.QUAY_BIOCONDA_TOKEN }}

- if: ${{ github.ref == 'refs/heads/main' }}
- if: ${{ github.ref == 'refs/heads/test-push' }}
name: Test Pushed
run: |
image='${{ env.IMAGE_NAME }}'

image_name='${{ steps.build.outputs.image_name }}'
image_dir='${{ steps.build.outputs.image_dir }}'
ids="$(
for tag in ${{ steps.build.outputs.tags }} ; do
buildah manifest inspect "${image}:${tag}" \
buildah manifest inspect "${image_name}:${tag}" \
| jq -r '.manifests[]|.digest' \
| while read id ; do
buildah images --format '{{.ID}}{{.Digest}}' \
Expand All @@ -186,6 +215,6 @@ jobs:
buildah bud \
--build-arg=base="${id}" \
--file=Dockerfile.test \
"images/${image}"
"${image_dir}"
done
buildah rmi --prune || true
65 changes: 47 additions & 18 deletions .github/workflows/base-glibc-debian-bash.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'Build & Push: base-glibc-debian-bash'
on:
push:
branches:
- main
- test-push
paths:
- images/base-glibc-debian-bash/*
- .github/workflows/base-glibc-debian-bash.yaml
Expand All @@ -19,39 +19,49 @@ jobs:
# The base image is not intended to change often and should be used with
# version tags or checksum IDs, but not via "latest".
MAJOR_VERSION: 3
MINOR_VERSION: 0
IMAGE_NAME: base-glibc-debian-bash
MINOR_VERSION: 1
DEBIAN_VERSION: '12.2'
# Used for testing -- set to something like 'tmp-' or 'test-' to prefix
# images with this name during testing
IMAGE_PREFIX: "tmp-"
IMAGE_NAME: base-glibc-debian-bash

steps:
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
with:
platforms: arm64

- name: Build
id: build
run: |
set -xeu
cd 'images/${{ env.IMAGE_NAME }}'

image_name='${{ env.IMAGE_NAME }}'
image_name='${{ env.IMAGE_PREFIX }}${{ env.IMAGE_NAME }}'
image_dir='images/${{ env.IMAGE_NAME }}'
tags='
${{ env.MAJOR_VERSION }}
${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}
latest
'
# Adds image and tags to outputs which can be used in later steps.
printf %s\\n \
"image=${image_name}" \
"image_dir=${image_dir}" \
"image_name=${image_name}" \
"tags=$( echo ${tags} )" \
>> $GITHUB_OUTPUT

cd 'images/${{ env.IMAGE_NAME }}'

# Create manifest (which is considered arch-independent)
for tag in ${tags} ; do
buildah manifest create "${image_name}:${tag}"
done

# --iidfile prints the built image ID to the specified file. This is
# used so we can refer to the image in later steps.
for arch in amd64 arm64 ; do
iidfile="$( mktemp )"
buildah bud \
Expand All @@ -61,6 +71,7 @@ jobs:
image_id="$( cat "${iidfile}" )"
rm "${iidfile}"

# Extract various package info and version info to store as labels
container="$( buildah from "${image_id}" )"
run() { buildah run "${container}" "${@}" ; }
deb_list="$( run cat /.deb.lst | tr '\n' '|' | sed 's/|$//' )"
Expand All @@ -70,6 +81,7 @@ jobs:
bash="$( run bash --version | sed '1!d' )"
buildah rm "${container}"

# Store package/version info as labels for the image
container="$( buildah from "${image_id}" )"
buildah config \
--label=glibc="${glibc}" \
Expand All @@ -79,8 +91,11 @@ jobs:
--label=pkg-list="${pkg_list}" \
"${container}"

# Store the new image (now with labels)
image_id="$( buildah commit "${container}" )"
buildah rm "${container}"

# image tag includes arch; then added to manifest which does not include arch
for tag in ${tags} ; do
buildah tag \
"${image_id}" \
Expand All @@ -93,7 +108,10 @@ jobs:

- name: Test
run: |
image='${{ steps.build.outputs.image }}'
image_name='${{ steps.build.outputs.image_name }}'
image_dir='${{ steps.build.outputs.image_dir }}'

# Extract image ids from manifest to test.
ids="$(
for tag in ${{ steps.build.outputs.tags }} ; do
buildah manifest inspect "${image}:${tag}" \
Expand All @@ -104,25 +122,34 @@ jobs:
done
done
)"

# See Dockerfile.test for actual tests run
ids="$( printf %s "${ids}" | sort -u )"
for id in ${ids} ; do
podman history "${id}"
buildah bud \
--build-arg=base="${id}" \
--file=Dockerfile.test \
"images/${image}"
"${image_dir}"
done
buildah rmi --prune || true

- name: Check Tags
run: |
# FIX upstream: Quay.io does not support immutable images currently.
# => Try to use the REST API to check for duplicate tags.
# => Try to use the REST API to check for duplicate tags and exit if they exist
response="$(
curl -sL \
'https://quay.io/api/v1/repository/bioconda/${{ steps.build.outputs.image }}/tag/'
'https://quay.io/api/v1/repository/bioconda/${{ steps.build.outputs.image_name }}/tag/'
)"

# This might be the first time making this image (e.g., will likely
# happen when using a test prefix), in which case there will be no
# available images.
if [ "$(echo "${response}" | jq -r '.error_message')" == "Requires authentication" ]; then
exit 0
fi

existing_tags="$(
printf %s "${response}" \
| jq -r '.tags[]|select(.end_ts == null or .end_ts >= now)|.name'
Expand All @@ -146,23 +173,25 @@ jobs:
esac
done

- if: ${{ github.ref == 'refs/heads/main' }}
- if: ${{ github.ref == 'refs/heads/test-push' }}
name: Push
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build.outputs.image }}
image: ${{ steps.build.outputs.image_name }}
tags: ${{ steps.build.outputs.tags }}
registry: ${{ secrets.QUAY_BIOCONDA_REPO }}
registry: quay.io/bioconda
username: ${{ secrets.QUAY_BIOCONDA_USERNAME }}
password: ${{ secrets.QUAY_BIOCONDA_TOKEN }}

- if: ${{ github.ref == 'refs/heads/main' }}
- if: ${{ github.ref == 'refs/heads/test-push' }}
name: Test Pushed
run: |
image='${{ env.IMAGE_NAME }}'

image_name='${{ steps.build.outputs.image_name }}'
image_dir='${{ steps.build.outputs.image_dir }}'
ids="$(
for tag in ${{ steps.build.outputs.tags }} ; do
buildah manifest inspect "${image}:${tag}" \
buildah manifest inspect "${image_name}:${tag}" \
| jq -r '.manifests[]|.digest' \
| while read id ; do
buildah images --format '{{.ID}}{{.Digest}}' \
Expand All @@ -176,6 +205,6 @@ jobs:
buildah bud \
--build-arg=base="${id}" \
--file=Dockerfile.test \
"images/${image}"
"${image_dir}"
done
buildah rmi --prune || true
Loading
Loading