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

feat: simplify unify containers #959

Open
wants to merge 147 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
172ffa5
initial migration of container infra from bioconda-containers
daler Feb 9, 2024
40cee01
first draft of build script
daler Feb 9, 2024
d68171b
rename/reorganize
daler Feb 11, 2024
acb1d84
parameterize busybox image to copy from
daler Feb 11, 2024
988ee01
git checkout parameterized branch
daler Feb 11, 2024
a4801a5
parameterize busybox image
daler Feb 11, 2024
de2635b
depend on passed-in conda/mamba versions
daler Feb 11, 2024
5a00ef3
first round of refactoring build-images.yml
daler Feb 11, 2024
8fb2257
move generic build to top, and adjust workflow
daler Feb 11, 2024
e9864ba
split out base-debian into an independent job
daler Feb 12, 2024
9ffeda8
factor out archs
daler Feb 12, 2024
c7ac9b1
add build-env and create-env
daler Feb 12, 2024
8ffc3ea
try using branch name for now
daler Feb 12, 2024
a971e5d
fix path
daler Feb 13, 2024
976f350
rm redundant if clause
daler Feb 13, 2024
5d3acc7
parameterize create-env test to use local images
daler Feb 13, 2024
e368e39
check for existing tags
daler Feb 13, 2024
bbbd9d3
allow missing repository on quay.io if configured
daler Feb 13, 2024
36d2fc6
add ARG for next FROM context
daler Feb 13, 2024
03c2472
add build script for local testing (may be moved later)
daler Feb 13, 2024
b7a6f4a
add docs
daler Feb 13, 2024
3ff8d68
parameterize archs
daler Feb 13, 2024
b580a38
rm manifests by default before building locally
daler Feb 13, 2024
cfd7b85
add switches to build each container
daler Feb 13, 2024
073c3df
fix arg
daler Feb 15, 2024
33e6ff4
use python (which will come from conda-forge)
daler Feb 15, 2024
0475a92
improve comments in build.sh
daler Feb 17, 2024
fd21947
warn -> error
daler Feb 17, 2024
7399905
move test build-args closer to actual test
daler Feb 17, 2024
be2b3f0
clean up buildah inspect output
daler Feb 17, 2024
324d8ee
overhaul how tests are run, plus notes & comments
daler Feb 17, 2024
06b138c
warn -> error in workflow
daler Feb 17, 2024
3f62390
rm build docker container from prev workflow
daler Feb 17, 2024
315604e
first attempt at pushing base-debian
daler Feb 17, 2024
5f91c86
for now always try pushing
daler Feb 17, 2024
8b019bb
hard code registry like bioconda-containers
daler Feb 17, 2024
072c987
add comments and ids to workflow
daler Feb 17, 2024
8e26443
start support for logging
daler Feb 17, 2024
c545c66
attempt to control github actions via log
daler Feb 17, 2024
f8783f4
mess with conditionals
daler Feb 17, 2024
66926b4
single-quote to match others
daler Feb 17, 2024
55919a1
no env var
daler Feb 17, 2024
7b15c02
now try version bump
daler Feb 17, 2024
2aec81c
more conditional
daler Feb 17, 2024
b4d4cbf
enable builds and pushes for other containers
daler Feb 17, 2024
5298c43
swap out registry depending on if tag exists
daler Feb 17, 2024
250b47b
do registry swap for create-env
daler Feb 17, 2024
ac3d8aa
lots o' comments
daler Feb 17, 2024
daddbd4
TIL GHA expressions work in comments
daler Feb 17, 2024
bbecba3
missing will now become error
daler Feb 17, 2024
59d8b30
bump just base version to test behavior
daler Feb 17, 2024
860adc0
explicitly specify (single) tag, and add to bioconda-utils version
daler Feb 17, 2024
14c43c5
be better about tags
daler Feb 18, 2024
0d6602e
fix tags
daler Feb 18, 2024
9b62f67
add "base" to base version
daler Feb 18, 2024
f9b8720
add base prefix to upload steps
daler Feb 18, 2024
ab41890
bump version to ensure 'latest' tags get pushed
daler Feb 18, 2024
efe0154
move pushes to end
daler Feb 18, 2024
64226bf
runs-on
daler Feb 18, 2024
ece22a2
don't depend on test
daler Feb 18, 2024
1b28410
fix job outputs
daler Feb 18, 2024
9bcd6c7
better message when tag exists
daler Feb 18, 2024
bd16b6a
comments cleanup
daler Feb 18, 2024
1ffb34d
add test before push
daler Feb 18, 2024
9a02abc
typo
daler Feb 18, 2024
b39c87c
typo
daler Feb 18, 2024
b654430
keep recipes in work dir
daler Feb 18, 2024
f47c2de
activate env in test
daler Feb 18, 2024
cb8157d
eval hook
daler Feb 18, 2024
3166fbd
include output for bioconda-utils version in job
daler Feb 18, 2024
a428b4b
fix names
daler Feb 18, 2024
aedd032
bump version for end-to-end testing
daler Feb 18, 2024
26325e9
don't use "localhost" as registry for docker
daler Feb 18, 2024
ec3704c
registry includes the slash
daler Feb 18, 2024
56b1fe2
convert back to steps rather than jobs
daler Feb 19, 2024
81aca27
need to podman push images to docker-daemon so docker can use
daler Feb 19, 2024
15c1954
update build.sh for local tests
daler Feb 19, 2024
01122df
comments and cleanup
daler Feb 19, 2024
bd90014
tags need bioconda-utils version
daler Feb 19, 2024
7d6f5c8
use correct output
daler Feb 19, 2024
7ce9bd1
attempt pushing to docker-daemon
daler Feb 19, 2024
8b7b1ff
disable some jobs so we can do some container pushing tests
daler Feb 19, 2024
dc4514a
try pushing to ghcr.io
daler Feb 19, 2024
6a177d2
rm push to docker daemon
daler Feb 19, 2024
3188ea3
login to ghcr
daler Feb 19, 2024
39ab36a
test pull from ghcr
daler Feb 19, 2024
93cb439
yaml syntax
daler Feb 19, 2024
ce45345
try building everything and pushing/pulling to/from ghcr.io
daler Feb 19, 2024
9967d44
re-enable build-others job
daler Feb 19, 2024
c4554f7
get bioconda-utils version from step output
daler Feb 19, 2024
73aef1c
get bioconda-utils version from build-other job
daler Feb 20, 2024
2ce4b8c
aaaand use right output
daler Feb 20, 2024
c5eb650
push the right image
daler Feb 20, 2024
f45e2ff
add additional label to tie to bioconda-utils
daler Feb 20, 2024
e9c6b7f
fix label
daler Feb 20, 2024
c8cb13e
new version number to see if ghcr will make public
daler Feb 20, 2024
e291d36
ensure all tags are pulled
daler Feb 20, 2024
8c42d0f
ensure latest manifest is pushed in the first place
daler Feb 20, 2024
00f458e
use job-level tag
daler Feb 20, 2024
a0554c4
use jobs not steps
daler Feb 20, 2024
ce17266
typo in missing argument handling
daler Feb 22, 2024
59ef090
re-enable library tests
daler Feb 22, 2024
dbc13b7
create & store local version of locale
daler Feb 27, 2024
4c89ac7
overhaul how everything is configured
daler Feb 27, 2024
2c16506
cleanup
daler Feb 27, 2024
9b40495
copied bioconda-utils version expected to be already checked out
daler Feb 27, 2024
d5d3560
simplify creating requirements
daler Feb 27, 2024
fed48a4
first pass overhauling simplified & unified builds GH Actions
daler Feb 27, 2024
6f5cc43
Merge branch 'master' into simplify-unify-containers
daler Feb 27, 2024
fb25c5a
reenable
daler Feb 27, 2024
b3b2ccb
disable main tests
daler Feb 27, 2024
00f52a7
fix job names
daler Feb 27, 2024
f889d09
move ghcr login back to main workflow
daler Feb 27, 2024
8ff41e1
log in to and use ghcr.io, not localhost registry
daler Feb 27, 2024
4713899
don't use localhost
daler Feb 28, 2024
f9c3216
disable test for now
daler Feb 28, 2024
d6bf0e6
manifest push
daler Feb 28, 2024
1242b9a
be explicit about base vs bioconda tags
daler Feb 28, 2024
e55d5fa
still need TAG for build.sh
daler Feb 28, 2024
552488b
add function to move manifests from ghcr to quay.io
daler Mar 2, 2024
54ed243
don't use "latest"
daler Mar 2, 2024
628ab79
re-enable tests
daler Mar 2, 2024
5a959ac
back to podman
daler Mar 2, 2024
699b55f
fix path
daler Mar 2, 2024
f30738f
fix path
daler Mar 2, 2024
d4b8557
still need to clone repo for versions.sh
daler Mar 2, 2024
edeea83
now try moving from ghcr to quay
daler Mar 2, 2024
e998ce7
login to quay
daler Mar 2, 2024
0dc9242
use right creds
daler Mar 2, 2024
589df6b
re-enable orig tests
daler Mar 2, 2024
9f334e6
Merge branch 'master' into simplify-unify-containers
daler Mar 17, 2024
a0e057f
Merge branch 'master' into simplify-unify-containers
daler Mar 19, 2024
59d5325
A round of comments and documentation
daler Aug 10, 2024
9732c2b
Merge branch 'master' into simplify-unify-containers
daler Aug 10, 2024
5d534ef
fix image tag
daler Aug 11, 2024
1f97cf2
temporarily disable full tests
daler Aug 11, 2024
523acf3
first try at enabling docker tests for just-built containers
daler Aug 11, 2024
5ad8842
consider env var for build image
daler Aug 11, 2024
9195c9e
use utils, not recipes, for test
daler Aug 11, 2024
f311612
rm mamba from images
daler Aug 11, 2024
3983859
bump version to trigger container build
daler Aug 11, 2024
4a0b20d
be more clear about passing image name to mulled
daler Aug 11, 2024
cf71d12
Revert "rm mamba from images"
daler Aug 11, 2024
46cf321
try reverting truststore removal
daler Aug 11, 2024
c946860
another attempt at removing mamba
daler Aug 12, 2024
9b4c928
use new name for image sent to mulled
daler Aug 12, 2024
af16e9a
use matched branch on bioconda-common
daler Aug 13, 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
10 changes: 3 additions & 7 deletions .github/workflows/GithubActionTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ concurrency:

jobs:
test-linux:
if: ${{ false }} # FIXME
name: Linux tests
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -34,13 +35,6 @@ jobs:
conda list
python setup.py install

- name: Build docker container
run: |
docker build -t quay.io/bioconda/bioconda-utils-build-env-cos7:latest ./
docker history quay.io/bioconda/bioconda-utils-build-env-cos7:latest
docker run --rm -t quay.io/bioconda/bioconda-utils-build-env-cos7:latest sh -lec 'type -t conda && conda info --verbose && conda list'
docker build -t quay.io/bioconda/bioconda-utils-test-env-cos7:latest -f ./Dockerfile.test ./

- name: Run tests '${{ matrix.py_test_marker }}'
run: |
eval "$(conda shell.bash hook)"
Expand All @@ -51,6 +45,7 @@ jobs:
echo "Skipping pytest - only docs modified"
fi
test-macosx:
if: ${{ false }} # FIXME
name: OSX tests
runs-on: macos-13
steps:
Expand Down Expand Up @@ -83,6 +78,7 @@ jobs:
fi

autobump-test:
if: ${{ false }} # FIXME
name: autobump test
runs-on: ubuntu-latest
steps:
Expand Down
63 changes: 0 additions & 63 deletions .github/workflows/build-image.yml

This file was deleted.

285 changes: 285 additions & 0 deletions .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,285 @@
# Build all container images.
#
name: Build images
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
paths-ignore:
- '.circleci/**'
- 'docs/**'
- 'test/**'
env:
# Used to override BIOCONDA_UTILS_VERSION in images/versions.sh
BIOCONDA_UTILS_VERSION: ${{ github.event.release && github.event.release.tag_name || github.head_ref || github.ref_name }}

jobs:

# JOBS FOR BUILDING IMAGES
# ----------------------------------------------------------------------
# These jobs will build images for archs, put them into a manifest, and push
# that to GitHub Container Registry. Later, the testing jobs will test and
# push to quay.io.

build-base-debian:
name: Build base-debian
runs-on: ubuntu-22.04
outputs:
# A note on these TAG_EXISTS_* outputs: these allow subsequent jobs to
# change behavior (e.g., skip building or skip pushing to ghcr) depending
# on whether an image has already been created.
TAG_EXISTS_base-debian: ${{ steps.base-debian.outputs.TAG_EXISTS_base-debian }}
steps:

- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install qemu dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static

- name: base-debian
id: base-debian
run: |
source images/versions.sh
if [ $(tag_exists $BASE_DEBIAN_IMAGE_NAME $BASE_TAG) ]; then
echo "TAG_EXISTS_base-debian=true" >> $GITHUB_OUTPUT
else
cd images && bash build.sh base-glibc-debian-bash
fi

- name: push to ghcr
if: '${{ ! steps.base-debian.outputs.TAG_EXISTS_base-debian }}'
run: |
echo '${{ secrets.GITHUB_TOKEN }}' | podman login ghcr.io -u '${{ github.actor }}' --password-stdin
source images/versions.sh
push_to_ghcr $BASE_DEBIAN_IMAGE_NAME $BASE_TAG

build-base-busybox:
name: Build base-busybox
runs-on: ubuntu-22.04
outputs:
TAG_EXISTS_base-busybox: ${{ steps.base-busybox.outputs.TAG_EXISTS_base-busybox }}
steps:

- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install qemu dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static

- name: base-busybox
id: base-busybox
run: |
source images/versions.sh
if [ $(tag_exists $BASE_BUSYBOX_IMAGE_NAME $BASE_TAG) ]; then
echo "TAG_EXISTS_base-busybox=true" >> $GITHUB_OUTPUT
else
cd images && bash build.sh base-glibc-busybox-bash
fi

- name: push to ghcr
if: '${{ ! steps.base-busybox.outputs.TAG_EXISTS_base-busybox }}'
run: |
echo '${{ secrets.GITHUB_TOKEN }}' | podman login ghcr.io -u '${{ github.actor }}' --password-stdin
source images/versions.sh
push_to_ghcr $BASE_BUSYBOX_IMAGE_NAME $BASE_TAG

build-build-env:
name: Build build-env
outputs:
TAG_EXISTS_build-env: ${{ steps.build-env.outputs.TAG_EXISTS_build-env }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install qemu dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static

- name: build-env
id: build-env
run: |
source images/versions.sh
if [ $(tag_exists $BUILD_ENV_IMAGE_NAME $BIOCONDA_IMAGE_TAG) ]; then
echo "TAG_EXISTS_build-env=true" >> $GITHUB_OUTPUT
else
cd images && bash build.sh bioconda-utils-build-env-cos7
fi

- name: push to ghcr
if: '${{ ! steps.build-env.outputs.TAG_EXISTS_build-env }}'
run: |
echo '${{ secrets.GITHUB_TOKEN }}' | podman login ghcr.io -u '${{ github.actor }}' --password-stdin
source images/versions.sh
push_to_ghcr $BUILD_ENV_IMAGE_NAME $BIOCONDA_IMAGE_TAG

build-create-env:
name: Build create-env
needs: [build-build-env, build-base-busybox]
outputs:
TAG_EXISTS_create-env: ${{ steps.create-env.outputs.TAG_EXISTS_create-env }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install qemu dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static

- name: Build create-env
id: create-env
run: |
source images/versions.sh
echo '${{ secrets.GITHUB_TOKEN }}' | podman login ghcr.io -u '${{ github.actor }}' --password-stdin
if [ $(tag_exists $CREATE_ENV_IMAGE_NAME $BIOCONDA_IMAGE_TAG) ]; then
echo "TAG_EXISTS_create-env=true" >> $GITHUB_OUTPUT
else
cd images && bash build.sh create-env
fi

- name: push to ghcr
if: '${{ ! steps.create-env.outputs.TAG_EXISTS_create-env }}'
run: |
echo '${{ secrets.GITHUB_TOKEN }}' | podman login ghcr.io -u '${{ github.actor }}' --password-stdin
source images/versions.sh
push_to_ghcr $CREATE_ENV_IMAGE_NAME $BIOCONDA_IMAGE_TAG


# END OF BUILDING IMAGES
# ----------------------------------------------------------------------
# START TESTING
# These testing jobs will run the respective Dockerfile.test in each image
# directory.

test:
name: test bioconda-utils with images
runs-on: ubuntu-20.04
needs: [build-base-debian, build-base-busybox, build-build-env, build-create-env]
steps:

- uses: actions/checkout@v4
with:
fetch-depth: 0

# # Clone bioconda-recipes to use as part of the tests.
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0
# repository: bioconda/bioconda-recipes
# path: recipes

# - name: set path
# run: echo "/opt/mambaforge/bin" >> $GITHUB_PATH

- name: Install bioconda-utils
run: |
export BIOCONDA_DISABLE_BUILD_PREP=1
BRANCH=simplify-unify-containers
wget https://raw.githubusercontent.com/bioconda/bioconda-common/${BRANCH}/{common,install-and-set-up-conda,configure-conda}.sh
source images/versions.sh

# Ensure install-and-set-up-conda uses same version as in the container
# (which uses images/versions.sh
export BIOCONDA_UTILS_TAG=$BIOCONDA_UTILS_VERSION
bash install-and-set-up-conda.sh
eval "$(conda shell.bash hook)"
conda create -n bioconda -y --file test-requirements.txt --file bioconda_utils/bioconda_utils-requirements.txt
conda activate bioconda
python setup.py install

- name: test
run: |
eval "$(conda shell.bash hook)"
conda activate bioconda

source images/versions.sh

# Figure out which registry to use for each image, based on what was built.
[ ${{ needs.build-build-env.outputs.TAG_EXISTS_build-env }} ] && BUILD_ENV_REGISTRY='quay.io/bioconda' || BUILD_ENV_REGISTRY="ghcr.io/bioconda"
[ ${{ needs.build-create-env.outputs.TAG_EXISTS_create-env }} ] && CREATE_ENV_REGISTRY='quay.io/bioconda' || CREATE_ENV_REGISTRY="ghcr.io/bioconda"
[ ${{ needs.build-base-busybox.outputs.TAG_EXISTS_base_busybox }} ] && DEST_BASE_REGISTRY='quay.io/bioconda' || DEST_BASE_REGISTRY="ghcr.io/bioconda"
[ ${{ needs.build-base-debian.outputs.TAG_EXISTS_base_debian }} ] && DEST_EXTENDED_BASE_REGISTRY='quay.io/bioconda' || DEST_EXTENDED_BASE_REGISTRY="ghcr.io/bioconda"

# Tell mulled-build which image to use
export DEST_BASE_IMAGE="${DEST_BASE_IMAGE_REGISTRY}/${BASE_BUSYBOX_IMAGE_NAME}:${BASE_TAG}"
export DEFAULT_BASE_IMAGE="${DEST_BASE_REGISTRY}/${BASE_BUSYBOX_IMAGE_NAME}"
export DEFAULT_EXTENDED_BASE_IMAGE="${DEST_EXTENDED_BASE_REGISTRY}/${BASE_DEBIAN_IMAGE_NAME}"
export BUILD_ENV_IMAGE="${BUILD_ENV_REGISTRY}/${BUILD_ENV_IMAGE_NAME}:${BIOCONDA_IMAGE_TAG}"
export CREATE_ENV_IMAGE="${CREATE_ENV_REGISTRY}/${CREATE_ENV_IMAGE_NAME}:${BIOCONDA_IMAGE_TAG}"

# # Build a package with containers.
# cd recipes
# bioconda-utils build \
# --docker-base-image "${BUILD_ENV_REGISTRY}/${BUILD_ENV_IMAGE_NAME}:${BIOCONDA_IMAGE_TAG}" \
# --mulled-conda-image "${CREATE_ENV_REGISTRY}/${CREATE_ENV_IMAGE_NAME}:${BIOCONDA_IMAGE_TAG}" \
# --packages seqtk \
# --docker \
# --mulled-test \
# --force

py.test --durations=0 test/ -v --log-level=DEBUG -k "docker" --tb=native

# END TESTING
# ------------------------------------------------------------------------
# START PUSHING IMAGES

# For these push steps, a repository must first exist on quay.io/bioconda
# AND that repository must also be configured to allow write access for the
# appropriate service account. This must be done by a user with admin
# access to quay.io/bioconda.
#
# This uses the TAG_EXISTS_* outputs from previous jobs to determine if
# a push to quay.io should happen.

push:
name: push images
runs-on: ubuntu-20.04
needs: [build-base-debian, build-base-busybox, build-build-env, build-create-env, test]
steps:

- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: push base-debian
if: ${{ ! needs.base-debian.outputs.TAG_EXISTS_base-debian }}
run: |
echo '${{ secrets.QUAY_BIOCONDA_TOKEN }}' | podman login quay.io -u '${{ secrets.QUAY_BIOCONDA_USERNAME }}' --password-stdin
source images/versions.sh
move_from_ghcr_to_quay ${BASE_DEBIAN_IMAGE_NAME} ${BASE_TAG}


- name: push base-busybox
if: ${{ ! needs.base-busybox.outputs.TAG_EXISTS_base-busybox }}
run: |
echo '${{ secrets.QUAY_BIOCONDA_TOKEN }}' | podman login quay.io -u '${{ secrets.QUAY_BIOCONDA_USERNAME }}' --password-stdin
source images/versions.sh
move_from_ghcr_to_quay ${BASE_BUSYBOX_IMAGE_NAME} ${BASE_TAG}

- name: push create-env
if: ${{ ! needs.create-env.outputs.TAG_EXISTS_create-env }}
run: |
echo '${{ secrets.QUAY_BIOCONDA_TOKEN }}' | podman login quay.io -u '${{ secrets.QUAY_BIOCONDA_USERNAME }}' --password-stdin
source images/versions.sh
move_from_ghcr_to_quay ${CREATE_ENV_IMAGE_NAME} ${BIOCONDA_IMAGE_TAG}

- name: push build-env
if: ${{ ! needs.build-env.outputs.TAG_EXISTS_build-env }}
run: |
echo '${{ secrets.QUAY_BIOCONDA_TOKEN }}' | podman login quay.io -u '${{ secrets.QUAY_BIOCONDA_USERNAME }}' --password-stdin
source images/versions.sh
move_from_ghcr_to_quay ${BUILD_ENV_IMAGE_NAME} ${BIOCONDA_IMAGE_TAG}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ docs/source/developer/_autosummary

# Mac OS Files
.DS_Store
env
recipes/

# files created when building images
images/*/metadata.txt
images/bioconda-utils-build-env-cos7/bioconda-utils
images/bioconda-utils-build-env-cos7/C.utf8
Loading
Loading