Skip to content

Commit

Permalink
port recent changes to busybox
Browse files Browse the repository at this point in the history
  • Loading branch information
daler committed Jan 28, 2024
1 parent e4a0540 commit 1164bfb
Showing 1 changed file with 30 additions and 14 deletions.
44 changes: 30 additions & 14 deletions .github/workflows/base-glibc-busybox-bash.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ jobs:
# version tags or checksum IDs, but not via "latest".
MAJOR_VERSION: 3
MINOR_VERSION: 1
IMAGE_NAME: base-glibc-busybox-bash
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
Expand All @@ -36,20 +39,23 @@ jobs:
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}"
Expand Down Expand Up @@ -112,7 +118,8 @@ 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="$(
Expand All @@ -133,7 +140,7 @@ jobs:
buildah bud \
--build-arg=base="${id}" \
--file=Dockerfile.test \
"images/${image}"
"${image_dir}"
done
buildah rmi --prune || true
Expand All @@ -143,9 +150,16 @@ jobs:
# => 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 @@ -169,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 @@ -199,6 +215,6 @@ jobs:
buildah bud \
--build-arg=base="${id}" \
--file=Dockerfile.test \
"images/${image}"
"${image_dir}"
done
buildah rmi --prune || true

0 comments on commit 1164bfb

Please sign in to comment.