Skip to content

Commit

Permalink
explicitly specify (single) tag, and add to bioconda-utils version
Browse files Browse the repository at this point in the history
  • Loading branch information
daler committed Feb 17, 2024
1 parent 59d8b30 commit 860adc0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ env:
BIOCONDA_UTILS_FOLDER: bioconda-utils
DEBIAN_VERSION: "12.2"
BUSYBOX_VERSION: "1.36.1"
BASE_TAGS: "0.1.3 latest"
BASE_TAG: "0.1.3" # "latest" will always be added during the build.
BUILD_ENV_IMAGE_NAME: tmp-build-env
CREATE_ENV_IMAGE_NAME: tmp-create-env
BASE_DEBIAN_IMAGE_NAME: tmp-debian
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
TYPE="base-debian" \
DEBIAN_VERSION=$DEBIAN_VERSION \
ARCHS=$ARCHS \
TAGS=$BASE_TAGS \
TAG=$BASE_TAG \
./generic_build.bash || [ $? == 64 ]
# generic_build.bash will write key=val lines to the log ($TYPE.log);
Expand Down Expand Up @@ -103,6 +103,7 @@ jobs:
tag=${{ github.event.release && github.event.release.tag_name || github.sha }}
printf %s "tag=${tag#v}" >> $GITHUB_OUTPUT
- name: Install qemu dependency
run: |
sudo apt-get update
Expand All @@ -117,7 +118,7 @@ jobs:
ARCHS=$ARCHS \
DEBIAN_VERSION=$DEBIAN_VERSION \
BUSYBOX_VERSION=$BUSYBOX_VERSION \
TAGS=$BASE_TAGS \
TAG=$BASE_TAG \
./generic_build.bash || [ $? == 64 ]
cat "base-busybox.log" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -154,12 +155,15 @@ jobs:
REGISTRY="quay.io/bioconda"
fi
BIOCONDA_UTILS_VERSION='${{ steps.get-tag.outputs.tag }}'
IMAGE_NAME=$BUILD_ENV_IMAGE_NAME \
IMAGE_DIR=images/bioconda-utils-build-env-cos7 \
ARCHS=$ARCHS \
TYPE="build-env" \
BIOCONDA_UTILS_VERSION='${{ github.head_ref || github.ref_name }}' \
BUSYBOX_IMAGE=$REGISTRY/$BASE_BUSYBOX_IMAGE_NAME \
BIOCONDA_UTILS_VERSION=$BIOCONDA_UTILS_VERSION \
TAG=$BIOCONDA_UTILS_VERSION-$BASE_TAG \
BUSYBOX_IMAGE=$REGISTRY/$BASE_BUSYBOX_IMAGE_NAME:$BASE_TAG \
./generic_build.bash || [ $? == 64 ]
cat "build-env.log" >> $GITHUB_OUTPUT
Expand All @@ -178,7 +182,7 @@ jobs:
- name: Build create-env
id: create-env
run: |
BIOCONDA_UTILS_VERSION='${{ github.head_ref || github.ref_name }}' \
BIOCONDA_UTILS_VERSION='${{ steps.get-tag.outputs.tag }}'
# Here we extract the conda and mamba versions from the just-created
# build-env container (or, if it was not created in this CI run because
Expand Down Expand Up @@ -211,8 +215,9 @@ jobs:
IMAGE_DIR=images/create-env \
ARCHS=$ARCHS \
TYPE="create-env" \
BUSYBOX_IMAGE=$REGISTRY/$BASE_BUSYBOX_IMAGE_NAME \
BIOCONDA_UTILS_VERSION=$BIOCONDA_UTILS_VERSION \
TAG=$BIOCONDA_UTILS_VERSION-$BASE_TAG \
BUSYBOX_IMAGE=$REGISTRY/$BASE_BUSYBOX_IMAGE_NAME:$BASE_TAG \
./generic_build.bash || [ $? == 64 ]
cat "create-env.log" >> $GITHUB_OUTPUT
Expand Down
10 changes: 5 additions & 5 deletions generic_build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@ REQUIRED ARGS FOR ALL TYPES
IMAGE_DIR: Location of Dockerfile.
IMAGE_NAME: Image name to upload.
ARCHS: Space-separated architectures e.g. "amd64 arm64"
TAG: image tag
REQUIRED for base-busybox
-------------------------
TAGS: Space-separated tags.
DEBIAN_VERSION
BUSYBOX_VERSION
REQUIRED for base-debian
------------------------
TAGS: Space-separated tags.
DEBIAN_VERSION
REQUIRED for build-env
Expand Down Expand Up @@ -82,13 +81,11 @@ EXAMPLE USAGE
[ -z "$IMAGE_DIR" ] && echo "error: please set IMAGE_DIR, where Dockerfile is found." && exit 1
[ -z "$TYPE" ] && echo "error: please set TYPE: [ base-debian | base-busybox | build-env | create-env ]" && exit 1
[ -z "$ARCHS" ] && echo "error: please set ARCHS" && exit 1
[ -z "$TAG" ] && echo "error: please set TAG" && exit 1

if [ "$TYPE" == "build-env" ] || [ "$TYPE" == "create-env" ]; then
[ -n "$TAGS" ] && echo "error: TAGS should not be set for build-env or create-env; use BIOCONDA_UTILS_VERSION instead" && exit 1
[ -z "$BIOCONDA_UTILS_VERSION" ] && echo "error: please set BIOCONDA_UTILS_VERSION for build-env and create-env" && exit 1

TAGS="$BIOCONDA_UTILS_VERSION" # Set TAGS to BIOCONDA_UTILS_VERSION from here on

if [ "$TYPE" == "build-env" ]; then
[ -z "$BIOCONDA_UTILS_FOLDER" ] && echo "error: please set BIOCONDA_UTILS_FOLDER for build-env" && exit 1
[ -z "$BUSYBOX_IMAGE" ] && echo "error: please set BUSYBOX_IMAGE for create-env" && exit 1
Expand All @@ -112,6 +109,9 @@ fi
LOG=${LOG:="${TYPE}.log"}
touch $LOG

# Also add "latest" tag.
TAGS="$TAG latest"

# ------------------------------------------------------------------------------


Expand Down

0 comments on commit 860adc0

Please sign in to comment.