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

FIX: Containers report wrong version #1357

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ jobs:
- MRIQC_API_TAG: 1.1.0
- MRIQC_API_DOCKER_IMAGES: "nginx:latest swaggerapi/swagger-ui:latest mongo:latest
python:3.7-slim"
- DOCKER_BUILDKIT: 1
machine:
# https://discuss.circleci.com/t/linux-machine-executor-images-2021-april-q2-update/39928
# upgrade Docker version
image: ubuntu-2204:2023.02.1
image: default
docker_layer_caching: true
working_directory: /tmp/src/mriqc
steps:
Expand Down Expand Up @@ -126,10 +127,12 @@ jobs:
name: Build Docker image
no_output_timeout: 60m
command: |
python3 -m pip install hatch
pyenv local 3
pip install hatch

# Get version before making repo dirty
THISVERSION=$( python3 -m hatch version )
THISVERSION=$( hatch version )

# Inject MRIQC-WebAPI secret
if [ "${MRIQC_API_SECRET_TOKEN}" != "" ]; then
sed -i -E "s/<secret_token>/$MRIQC_API_SECRET_TOKEN/" mriqc/config.py
Expand All @@ -143,6 +146,8 @@ jobs:
echo "them to your fork with ``git push origin --tags``"
fi

echo "Building version: $THISVERSION."

# Build docker image
e=1 && for i in {1..5}; do
docker build \
Expand All @@ -153,6 +158,14 @@ jobs:
--build-arg VERSION="${CIRCLE_TAG:-$THISVERSION}" . \
&& e=0 && break || sleep 15
done && [ "$e" -eq "0" ]

TARGET_VERSION="${CIRCLE_TAG:-$THISVERSION}"
TARGET_VERSION="MRIQC v${TARGET_VERSION%+*}"
DOCKER_VERSION=$( docker run --rm nipreps/mriqc:latest --version )
oesteban marked this conversation as resolved.
Show resolved Hide resolved
DOCKER_VERSION="${DOCKER_VERSION%+*}"
echo "Target version: \"${TARGET_VERSION}\""
echo "Docker version: \"${DOCKER_VERSION}\""
test "${TARGET_VERSION}" == "$DOCKER_VERSION"
- run:
name: Docker push to local registry
no_output_timeout: 40m
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ WORKDIR /tmp/

# Run mriqc by default
ENTRYPOINT ["/opt/conda/bin/mriqc"]
ARG VERSION
ARG BUILD_DATE
ARG VCS_REF
LABEL org.label-schema.build-date=$BUILD_DATE \
Expand Down
Loading