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

Reusable workflow testing #75

Closed
wants to merge 101 commits into from
Closed
Changes from 23 commits
Commits
Show all changes
101 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
a4d6bc1
rm existing workflows for testing
daler Jan 30, 2024
73f1d82
add test caller and called workflow
daler Jan 30, 2024
b2d6b7e
bump
daler Jan 30, 2024
99550cd
bump
daler Jan 30, 2024
7efe517
add version
daler Jan 30, 2024
a135954
bump
daler Jan 30, 2024
a420a4f
bump
daler Jan 30, 2024
02847d6
bump
daler Jan 30, 2024
5f45578
bump
daler Jan 30, 2024
2b029c4
bump
daler Jan 30, 2024
082cf5b
bump
daler Jan 30, 2024
a250b8f
bump
daler Jan 30, 2024
3f7ff88
bump
daler Jan 30, 2024
4f3e455
bump
daler Jan 30, 2024
6105f7b
bump
daler Jan 30, 2024
4a4d66e
bump
daler Jan 30, 2024
9cdbcec
bump
daler Jan 30, 2024
ae59451
bump
daler Jan 30, 2024
d3f9140
bump
daler Jan 30, 2024
855a94c
bump
daler Jan 30, 2024
447d5d4
bump
daler Jan 30, 2024
2372f15
bump
daler Jan 30, 2024
000e946
bump
daler Jan 30, 2024
dedefeb
now try bioconda-utils image
daler Feb 1, 2024
bc1f53d
varname
daler Feb 2, 2024
2321455
separate build arg for image
daler Feb 2, 2024
5989f1b
label fixes
daler Feb 2, 2024
033f850
bump
daler Feb 2, 2024
88ecc6f
bump
daler Feb 2, 2024
07c54d3
bump
daler Feb 2, 2024
5d5e9f1
bump
daler Feb 2, 2024
432b9a6
bump
daler Feb 2, 2024
8ef2c10
bump
daler Feb 2, 2024
8544b9a
bump
daler Feb 2, 2024
5bdc847
bump
daler Feb 2, 2024
befacb8
bump
daler Feb 2, 2024
a1fd5d2
bump
daler Feb 2, 2024
37b6e47
bump
daler Feb 2, 2024
f72e4a7
bump
daler Feb 2, 2024
1d6be82
bump
daler Feb 2, 2024
c4034c6
bump
daler Feb 2, 2024
1766609
bump
daler Feb 5, 2024
cc61158
bump
daler Feb 5, 2024
1398b8f
bump
daler Feb 5, 2024
c739426
try label fix
daler Feb 5, 2024
d85af0c
bump
daler Feb 5, 2024
5c0dc83
back to disabling labels
daler Feb 5, 2024
823ff05
test a few label quoting things
aliciaaevans Feb 5, 2024
4e130a7
remove extra double quotes
aliciaaevans Feb 5, 2024
c3bd674
remove extra logging
aliciaaevans Feb 5, 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
19 changes: 16 additions & 3 deletions .github/workflows/base-glibc-busybox-bash.yaml
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ 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
MINOR_VERSION: 1
IMAGE_NAME: base-glibc-busybox-bash
BUSYBOX_VERSION: '1.36.1'
DEBIAN_VERSION: '12.2'
@@ -28,7 +28,7 @@ jobs:
- uses: actions/checkout@v4

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

@@ -44,15 +44,19 @@ jobs:
${{ 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}" \
"tags=$( echo ${tags} )" \
>> $GITHUB_OUTPUT

# 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}" \
@@ -71,6 +75,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/|$//' )"
@@ -80,6 +85,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}" \
@@ -89,8 +95,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}" \
@@ -104,6 +113,8 @@ jobs:
- name: Test
run: |
image='${{ steps.build.outputs.image }}'

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

# See Dockerfile.test for actual tests run
ids="$( printf %s "${ids}" | sort -u )"
for id in ${ids} ; do
podman history "${id}"
@@ -127,7 +140,7 @@ jobs:
- 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/'
19 changes: 16 additions & 3 deletions .github/workflows/base-glibc-debian-bash.yaml
Original file line number Diff line number Diff line change
@@ -19,15 +19,15 @@ 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
MINOR_VERSION: 1
IMAGE_NAME: base-glibc-debian-bash
DEBIAN_VERSION: '12.2'

steps:
- uses: actions/checkout@v4

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

@@ -43,15 +43,19 @@ jobs:
${{ 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}" \
"tags=$( echo ${tags} )" \
>> $GITHUB_OUTPUT

# 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 \
@@ -61,6 +65,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/|$//' )"
@@ -70,6 +75,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}" \
@@ -79,8 +85,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}" \
@@ -94,6 +103,8 @@ jobs:
- name: Test
run: |
image='${{ steps.build.outputs.image }}'

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

# See Dockerfile.test for actual tests run
ids="$( printf %s "${ids}" | sort -u )"
for id in ${ids} ; do
podman history "${id}"
@@ -117,7 +130,7 @@ jobs:
- 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/'
212 changes: 212 additions & 0 deletions .github/workflows/bioconda-utils-build-env-cos7.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
name: 'Build & Push: bioconda-utils-build-env-cos7'
on:
push:
branches:
- test-push
paths:
- images/bioconda-utils-build-env-cos7/**
- .github/workflows/bioconda-utils-build-env-cos7.yml
pull_request:
paths:
- images/bioconda-utils-build-env-cos7/**
- .github/workflows/bioconda-utils-build-env-cos7.yml

jobs:
build:
name: Build & Push
runs-on: ubuntu-22.04
env:
# 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: 1
IMAGE_NAME: bioconda-utils-build-env-cos7

steps:
- name: Checkout bioconda-containers
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Checkout bioconda-utils
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: 'bioconda/bioconda-utils'
path: 'images/bioconda-utils-build-env-cos7/bioconda-utils'

- name: Set up QEMU
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 }}'
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}" \
"tags=$( echo ${tags} )" \
>> $GITHUB_OUTPUT

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

# Due to different nomenclature used by conda-forge and buildah, we
# need to map archs to base images.
for arch_and_image in \
"amd64=quay.io/condaforge/linux-anvil-cos7-x86_64" \
"arm64=quay.io/condaforge/linux-anvil-aarch64";
do
# Unpack archs and base images
arch=$(echo $arch_and_image | cut -f1 -d "=")
base_image=$(echo $arch_and_image | cut -f2 -d "=")

# --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 \
--arch="${arch}" \
--iidfile="${iidfile}" \
--build-arg=base_image="$base_image"
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/|$//' )"
pkg_list="$( run cat /.pkg.lst | tr '\n' '|' | sed 's/|$//' )"
glibc="$( run sh -c 'exec "$( find -xdev -name libc.so.6 -print -quit )"' | sed '1!d' )"
bash="$( run bash --version | sed '1!d' )"
bioconda_utils="$( run sh -c '. /opt/conda/etc/profile.d/conda.sh && conda activate base && bioconda-utils --version' | rev | cut -f1 -d " " | rev )"
buildah rm "${container}"

# Store package/version info as labels for the image
container="$( buildah from "${image_id}" )"
buildah config \
--label=glibc="${glibc}" \
--label=bash="${bash}" \
--label=deb-list="${deb_list}" \
--label=pkg-list="${pkg_list}" \
--label=bioconda-utils="${bioconda_utils}" \
"${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}" \
"${image_name}:${tag}-${arch}"
buildah manifest add \
"${image_name}:${tag}" \
"${image_id}"
done
done

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

# Extract image ids from manifest to test.
ids="$(
for tag in ${{ steps.build.outputs.tags }} ; do
buildah manifest inspect "${image}:${tag}" \
| jq -r '.manifests[]|.digest' \
| while read id ; do
buildah images --format '{{.ID}}{{.Digest}}' \
| sed -n "s/${id}//p"
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}"
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 and exit if they exist
response="$(
curl -sL \
'https://quay.io/api/v1/repository/bioconda/${{ steps.build.outputs.image }}/tag/'
)"

existing_tags="$(
printf %s "${response}" \
| jq -r '.tags[]|select(.end_ts == null or .end_ts >= now)|.name'
)" \
|| {
printf %s\\n \
'Could not get list of image tags.' \
'Does the repository exist on Quay.io?' \
'Quay.io REST API response was:' \
"${response}"
exit 1
}
for tag in ${{ steps.build.outputs.tags }} ; do
case "${tag}" in
latest | '${{ env.MAJOR_VERSION }}' ) ;;
* )
if printf %s "${existing_tags}" | grep -qxF "${tag}" ; then
printf 'Tag %s already exists!\n' "${tag}"
exit 1
fi
esac
done

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

- if: ${{ github.ref == 'refs/heads/test-push' }}
name: Test Pushed
run: |
image='${{ env.IMAGE_NAME }}'
ids="$(
for tag in ${{ steps.build.outputs.tags }} ; do
buildah manifest inspect "${image}:${tag}" \
| jq -r '.manifests[]|.digest' \
| while read id ; do
buildah images --format '{{.ID}}{{.Digest}}' \
| sed -n "s/${id}//p"
done
done
)"
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}"
done
buildah rmi --prune || true
129 changes: 0 additions & 129 deletions .github/workflows/build-env-image.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/create-env.yaml
Original file line number Diff line number Diff line change
@@ -17,14 +17,14 @@ jobs:
runs-on: ubuntu-22.04
env:
MAJOR_VERSION: 3
MINOR_VERSION: 0
MINOR_VERSION: 1
IMAGE_NAME: create-env

steps:
- uses: actions/checkout@v4

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

Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# Specify the base image to support multi-arch images, such as
# - 'quay.io/condaforge/linux-anvil-aarch64' for Linux aarch64
# - 'quay.io/condaforge/linux-anvil-cos7-x86_64' for Linux x86_64
ARG BASE_IMAGE=quay.io/condaforge/linux-anvil-cos7-x86_64
ARG base_image

FROM ${BASE_IMAGE} as base
FROM ${base_image} as base

# Copy over C.UTF-8 locale from our base image to make it consistently available during build.
COPY --from=quay.io/bioconda/base-glibc-busybox-bash /usr/lib/locale/C.utf8 /usr/lib/locale/C.utf8
6 changes: 6 additions & 0 deletions images/bioconda-utils-build-env-cos7/Dockerfile.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ARG base
FROM "${base}"
RUN . /opt/conda/etc/profile.d/conda.sh \
&& conda activate base \
&& bioconda-utils --version \
&& bioconda-utils --help