Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
LINC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Frits Sweijen
LINC
Commits
31b0d4a4
Commit
31b0d4a4
authored
2 years ago
by
Klaas Kliffen
Browse files
Options
Downloads
Patches
Plain Diff
Keep track of upstream version in the Docker image for reproducibility in production environments.
parent
f35c96c1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+48
-5
48 additions, 5 deletions
.gitlab-ci.yml
Docker/Dockerfile-base
+51
-41
51 additions, 41 deletions
Docker/Dockerfile-base
Docker/fetch_latest_commits.sh
+11
-0
11 additions, 0 deletions
Docker/fetch_latest_commits.sh
with
110 additions
and
46 deletions
.gitlab-ci.yml
+
48
−
5
View file @
31b0d4a4
...
...
@@ -34,8 +34,10 @@ versioning:
script
:
# Unshallowing ensures that 'git describe' works
-
git fetch --unshallow
-
echo LINC_VERSION=$(git describe --tags --dirty --always) > versions.env
-
echo INTEGRATION_BASE_IMAGE=${CI_REGISTRY_IMAGE}/integration_base:$(git log -n 1 --pretty=format:%H -- Docker/Dockerfile-base) >> versions.env
-
./Docker/fetch_latest_commits.sh | tee commits.txt > versions.env
-
echo LINC_VERSION=$(git describe --tags --always) > versions.env
# Use hash of commits to determine version of base image (and rebuild if necessary)
-
echo INTEGRATION_BASE_IMAGE=${CI_REGISTRY_IMAGE}/integration_base:$(sha256sum commits.txt | cut -d " " -f 1) >> versions.env
-
echo INTEGRATION_IMAGE=${CI_REGISTRY_IMAGE}/integration_full:$(git log -n 1 --pretty=format:%H) >> versions.env
-
cat versions.env
artifacts
:
...
...
@@ -60,7 +62,17 @@ build_base:
script
:
-
|
if ! docker manifest inspect $INTEGRATION_BASE_IMAGE > /dev/null || [ "$BUILD_DOCKER_IMAGE" = "1" ]; then
docker build --tag $INTEGRATION_BASE_IMAGE -f Docker/Dockerfile-base .
docker build --tag $INTEGRATION_BASE_IMAGE \
--build-arg LOFARSTMAN_COMMIT \
--build-arg DYSCO_COMMIT \
--build-arg IDG_COMMIT \
--build-arg SAGECAL_COMMIT \
--build-arg AOFLAGGER_COMMIT \
--build-arg LOFARBEAM_COMMIT \
--build-arg EVERYBEAM_COMMIT \
--build-arg DP3_COMMIT \
--build-arg WSCLEAN_COMMIT \
-f Docker/Dockerfile-base .
docker push $INTEGRATION_BASE_IMAGE
fi
...
...
@@ -72,7 +84,7 @@ install_linc:
script
:
-
docker build --build-arg BASE_TAG=$INTEGRATION_BASE_IMAGE --tag $INTEGRATION_IMAGE -f Docker/Dockerfile-linc .
-
docker push $INTEGRATION_IMAGE
download_data
:
needs
:
[
"
versioning"
,
"
install_linc"
]
image
:
$INTEGRATION_IMAGE
...
...
@@ -173,7 +185,7 @@ deploy_docker:
-
docker:20.10-dind
before_script
:
-
echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
-
echo $DH_REGISTRY_PASSWORD | docker login -u $DH_REGISTRY_USER --password-stdin
-
echo $DH_REGISTRY_PASSWORD | docker login -u $DH_REGISTRY_USER --password-stdin
script
:
-
docker tag $INTEGRATION_IMAGE astronrd/linc:$LINC_VERSION
-
docker tag $INTEGRATION_IMAGE astronrd/linc:latest
...
...
@@ -184,6 +196,37 @@ deploy_docker:
-
if
:
'
$CI_COMMIT_BRANCH
==
"master"'
when
:
always
# Deploy a release version
deploy_release
:
stage
:
deploy
needs
:
[
"
versioning"
,
"
download_data"
]
image
:
docker:20.10
services
:
-
docker:20.10-dind
before_script
:
-
echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
-
echo $DH_REGISTRY_PASSWORD | docker login -u $DH_REGISTRY_USER --password-stdin
-
apk update && apk add git
script
:
-
echo -n "$CI_COMMIT_BRANCH" | sed -e "s/^releases\//export RELEASE=/" > version && source version
-
docker tag $INTEGRATION_IMAGE astronrd/linc:$RELEASE
-
docker push astronrd/linc:$RELEASE
# Update docker image in cwl steps by tagged version
-
sed -i "s/astronrd\/linc/astronrd\/linc:$RELEASE/g" steps/*.cwl
# Create and push Git tag
-
git add steps/*.cwl
-
git config user.email $GITLAB_USER_EMAIL
-
git config user.name $GITLAB_USER_NAME
# Skip CI on this commit and tag
-
git commit -m "[SKIP CI] Replace latest with tag $RELEASE"
-
git tag -a $RELEASE -m "[SKIP CI] Version $RELEASE created by gitlab-ci build"
-
git push --all
rules
:
# TODO: check if pushed tag triggers Pipeline
# Only run on release branches
-
if
:
'
$CI_COMMIT_BRANCH
=~
/^releases//'
when
:
always
deploy_doc
:
stage
:
deploy
needs
:
[
"
versioning"
,
"
build_doc"
]
...
...
This diff is collapsed.
Click to expand it.
Docker/Dockerfile-base
+
51
−
41
View file @
31b0d4a4
...
...
@@ -4,7 +4,7 @@ FROM ubuntu:20.04 as builder
# It lives on the head of its dependencies.
# Install all build-time dependencies
RUN export DEBIAN_FRONTEND=noninteractive && \
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y \
bison \
...
...
@@ -13,7 +13,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
casacore-dev \
cmake \
flex \
gfortran \
gfortran \
git \
libblas-dev \
libboost-date-time-dev \
...
...
@@ -46,77 +46,86 @@ WORKDIR /src
# Build portable binaries by default
ARG PORTABLE=TRUE
ARG LOFARSTMAN_
VERSION
=master
RUN git clone --
depth 1 --branch ${LOFARSTMAN_VERSION}
\
ARG LOFARSTMAN_
COMMIT
=master
RUN git clone --
no-checkout
\
https://github.com/lofar-astron/LofarStMan && \
mkdir LofarStMan/build && \
cd LofarStMan/build && \
cd LofarStMan && git checkout ${LOFARSTMAN_COMMIT} && \
cd build && \
cmake .. -DPORTABLE=${PORTABLE} && \
make install -j`nproc`
ARG DYSCO_
VERSION
=master
RUN git clone --
depth 1 --branch ${DYSCO_VERSION}
\
ARG DYSCO_
COMMIT
=master
RUN git clone --
no-checkout
\
https://github.com/aroffringa/dysco.git && \
mkdir dysco/build && \
cd dysco/build && \
cd dysco && git checkout ${DYSCO_COMMIT} && \
cd build && \
cmake .. -DPORTABLE=${PORTABLE} && \
make install -j`nproc`
ARG IDG_
VERSION
=master
# IDG does
n'
t work with --depth 1, because it needs all branches to
ARG IDG_
COMMIT
=master
# IDG does
no
t work with --depth 1, because it needs all branches to
# determine its version :-(
RUN git clone
--branch ${IDG_VERSION}
\
RUN git clone \
https://git.astron.nl/RD/idg.git && \
mkdir idg/build && \
cd idg/build && \
cd idg && git checkout ${IDG_COMMIT} && \
cd build && \
cmake .. && \
make install -j`nproc`
ARG AOFLAGGER_
VERSION
=master
RUN git clone --
depth 1 --branch ${AOFLAGGER_VERSION}
\
ARG AOFLAGGER_
COMMIT
=master
RUN git clone --
no-checkout
\
https://gitlab.com/aroffringa/aoflagger.git && \
mkdir aoflagger/build && \
cd aoflagger/build && \
cd aoflagger && git checkout ${AOFLAGGER_COMMIT} && \
cd build && \
cmake .. -DPORTABLE=${PORTABLE} && \
make install -j`nproc`
ARG LOFARBEAM_
VERSION
=master
RUN git clone
--depth 1 --branch ${LOFARBEAM_VERSION}
\
ARG LOFARBEAM_
COMMIT
=master
RUN git clone
--no-checkout
\
https://github.com/lofar-astron/LOFARBeam.git && \
mkdir LOFARBeam/build && \
cd LOFARBeam/build && \
cd LOFARBeam && git checkout ${LOFARBEAM_COMMIT} && \
cd build && \
cmake .. && \
make install -j`nproc`
ARG EVERYBEAM_
VERSION
=master
RUN git clone --
depth 1 --branch ${EVERYBEAM_VERSION}
\
ARG EVERYBEAM_
COMMIT
=master
RUN git clone --
no-checkout
\
https://git.astron.nl/RD/EveryBeam.git && \
mkdir EveryBeam/build && \
cd EveryBeam/build && \
cd EveryBeam && git checkout ${EVERYBEAM_COMMIT} && \
cd build && \
cmake .. && \
make install -j`nproc`
ARG SAGECAL_
VERSION
=master
RUN git clone --
depth 1 --branch ${SAGECAL_VERSION}
\
ARG SAGECAL_
COMMIT
=master
RUN git clone --
no-checkout
\
https://github.com/nlesc-dirac/sagecal && \
mkdir sagecal/build && \
cd sagecal/build && \
cd sagecal && git checkout ${SAGECAL_COMMIT} && \
cd build && \
cmake .. -DLIB_ONLY=1 && \
make install -j`nproc`
ARG DP3_
VERSION
=master
RUN git clone --
depth 1 --branch ${DP3_VERSION}
\
ARG DP3_
COMMIT
=master
RUN git clone --
no-checkout
\
https://git.astron.nl/RD/DP3.git && \
mkdir DP3/build && \
cd DP3/build && \
cmake .. -DPORTABLE=${PORTABLE} -DLIBDIRAC_PREFIX=/usr/local/ && \
cd DP3 && git checkout ${DP3_COMMIT} && \
cd build && \
cmake .. -DPORTABLE=${PORTABLE} && \
make install -j`nproc`
ARG WSCLEAN_
VERSION
=master
RUN git clone --
depth 1 --branch ${WSCLEAN_VERSION}
\
ARG WSCLEAN_
COMMIT
=master
RUN git clone --
no-checkout
\
https://gitlab.com/aroffringa/wsclean.git && \
mkdir wsclean/build && \
cd wsclean/build && \
cd wsclean && git checkout ${WSCLEAN_COMMIT} && \
cd build && \
cmake .. -DPORTABLE=${PORTABLE} && \
make install -j`nproc`
...
...
@@ -152,14 +161,15 @@ RUN chmod +rx /usr/local/bin/*
SHELL ["/bin/bash", "-c"]
# Set default versions. Can be overridden from the command-line
ARG LOFARSTMAN_VERSION=master
ARG DYSCO_VERSION=master
ARG IDG_VERSION=master
ARG AOFLAGGER_VERSION=master
ARG LOFARBEAM_VERSION=master
ARG EVERYBEAM_VERSION=master
ARG DP3_VERSION=master
ARG WSCLEAN_VERSION=master
ARG LOFARSTMAN_COMMIT=master
ARG DYSCO_COMMIT=master
ARG SAGECAL_COMMIT=master
ARG IDG_COMMIT=master
ARG AOFLAGGER_COMMIT=master
ARG LOFARBEAM_COMMIT=master
ARG EVERYBEAM_COMMIT=master
ARG DP3_COMMIT=master
ARG WSCLEAN_COMMIT=master
# Add version information to the metadata of the image
LABEL \
...
...
@@ -172,7 +182,7 @@ LABEL \
nl.astron.linc.dp3.version=${DP3_VERSION} \
nl.astron.linc.wsclean.version=${WSCLEAN_VERSION}
# Only install run-time required packages
# Only install run-time required packages
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y \
...
...
This diff is collapsed.
Click to expand it.
Docker/fetch_latest_commits.sh
0 → 100755
+
11
−
0
View file @
31b0d4a4
#!/bin/sh
git ls-remote https://github.com/lofar-astron/LofarStMan HEAD |
awk
'{ print "LOFARSTMAN_COMMIT="$1 }'
git ls-remote https://github.com/aroffringa/dysco.git HEAD |
awk
'{ print "DYSCO_COMMIT="$1 }'
git ls-remote https://git.astron.nl/RD/idg.git HEAD |
awk
'{ print "IDG_COMMIT="$1 }'
git ls-remote https://gitlab.com/aroffringa/aoflagger.git HEAD |
awk
'{ print "AOFLAGGER_COMMIT="$1 }'
git ls-remote https://github.com/nlesc-dirac/sagecal HEAD |
awk
'{ print "SAGECAL_COMMIT="$1 }'
git ls-remote https://github.com/lofar-astron/LOFARBeam.git HEAD |
awk
'{ print "LOFARBEAM_COMMIT="$1 }'
git ls-remote https://git.astron.nl/RD/EveryBeam.git HEAD |
awk
'{ print "EVERYBEAM_COMMIT="$1 }'
git ls-remote https://git.astron.nl/RD/DP3.git HEAD |
awk
'{ print "DP3_COMMIT="$1 }'
git ls-remote https://gitlab.com/aroffringa/wsclean.git HEAD |
awk
'{ print "WSCLEAN_COMMIT="$1 }'
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment