Skip to content
Snippets Groups Projects
Commit ab31a770 authored by Sylvester Joosten's avatar Sylvester Joosten
Browse files

Update CI setup based on new upstream container

parent 28bc8386
Branches
Tags
1 merge request!16Merge in upstream changes and update CI
Pipeline #7159 passed
Showing
with 245 additions and 298 deletions
FROM eicweb.phy.anl.gov:4567/containers/image_recipes/root_spack:@CONTAINER_TAG@
LABEL maintainer "Sylvester Joosten <sjoosten@anl.gov>"
RUN cd /tmp \
&& git clone https://eicweb.phy.anl.gov/jlab/hallc/analyzer_software/hallac_evio.git \
&& mkdir hallac_evio/build && cd hallac_evio/build \
&& cmake ../. && make -j20 && make install \
&& cd /tmp && rm -rf hallac_evio \
&& git clone https://eicweb.phy.anl.gov/jlab/hallc/analyzer_software/analyzer.git \
&& mkdir analyzer/build && cd analyzer/build && git pull && git checkout v1.8.3 \
&& cmake ../. && make -j20 VERBOSE=1 && make install \
&& cd /tmp && rm -rf analyzer
## 2 layers so we can isolate hcana from the rest of the stack
RUN cd /tmp \
&& git clone https://eicweb.phy.anl.gov/jlab/hallc/analyzer_software/hcana.git \
&& mkdir hcana/build && cd hcana/build \
&& git pull \
&& cmake ../. && make -j20 VERBOSE=1 && make install \
&& cd /tmp && rm -rf hcana
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
# exports variables in config.env as environment variables
export $(shell sed 's/=.*//' $(cnf))
SHELL = bash
# grep the version from the mix file
VERSION=$(shell bash version.sh)
TAG_VERSION=$(VERSION)
LONG_TAG=$(VERSION)-$(PUBLISH_TAG)
# help will output the help for each task
# thanks to https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY: help
help: ## This help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.DEFAULT_GOAL := help
# ==========================================================================
#
build: ## build the image
docker build -t $(APP_NAME):$(LONG_TAG) .
build-nc: ## Build the container without caching (from scratch)
docker build --no-cache -t $(APP_NAME):$(LONG_TAG) .
# ==========================================================================
#
login: ## Auto login to AWS-ECR unsing aws-cli
@docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
echo "Login COMPLETE"
# ==========================================================================
#
publish: login ## Publish a tagged container to ECR
@echo 'publish $(PUBLISH_TAG) to $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME)'
docker tag $(APP_NAME):$(LONG_TAG) $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):$(PUBLISH_TAG)
docker push $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):$(PUBLISH_TAG)
docker rmi $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):$(PUBLISH_TAG)
publish-version: login ## Publish the `{version}` taged container to ECR
@echo 'publish $(VERSION) to $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):$(VERSION)'
docker tag $(APP_NAME):$(LONG_TAG) $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):$(VERSION)
docker push $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):$(VERSION)
docker rmi $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):$(VERSION)
# ==========================================================================
# remove container from registry
unpublish: login
@echo 'removing $(PUBLISH_TAG)'
curl --request DELETE --header "PRIVATE-TOKEN: $(CI_JOB_TOKEN)" "$(REG_API_URL)/$(PUBLISH_TAG)"
# ==========================================================================
# cleanup docker registry on system used by runner
cleanup:
@echo 'removing $(REG_NAME):$(LONG_TAG)'
docker rmi $(REG_NAME):$(LONG_TAG)
# Port to run the container # Port to run the container
PORT=4000
REG_TOKEN ?= ${CI_IMAGE_BUILD_PAT}
REG_USER ?= whit
REG_NAME ?= eicweb.phy.anl.gov:4567
REG_HOST ?= eicweb.phy.anl.gov:4567
# name of alternate build:
# Dockerfile.$(ALT_NAME) --> $(APP_NAME)_${ALT_NAME}
ALT_NAME ?= broadwell
APP_NAME = hcana APP_NAME = hcana
REPO_NAME = hcana REPO_NAME = hcana
DH_ORG = hallac
GL_GROUP = jlab/hallc/analyzer_software
GL_REG_GROUP = jlab/hallc/analyzer_software
GL_REG_NAME = hcana
REPO = hcana
TAG_VERSION = latest
REG_HOST ?= eicweb.phy.anl.gov
REG_NAME ?= eicweb.phy.anl.gov:4567
REG_PORT ?= 4567
REG_URL ?= https://$(REG_HOST)
GL_GROUP = jlab/hallc/analyzer_software
GL_REG_GROUP = jlab/hallc/analyzer_software/hcana
GL_REG_NAME = $(REG_NAME)
PUBLISH_TAG = $(HCANA_TAG)
REG_API_URL = $(REG_URL)/api/v4/projects/$(CI_PROJECT_ID)/registry/repositories/49/tags
File moved
Bootstrap: docker
From: eicweb.phy.anl.gov:4567/jlab/hallc/analyzer_software/hcana:@HCANA_TAG@
%help
singularity container for hcana development
%labels
Maintainer "Whitney Armstrong, Sylvester Joosten"
Version v1-dev
%post -c /bin/bash
echo " -------------------------------------------------"
echo " ===> Image setup complete"
echo " -------------------------------------------------"
#!/bin/bash #!/bin/bash
echo "0.1" cat ../VERSION
image: eicweb.phy.anl.gov:4567/containers/image_recipes/root_base:latest variables:
CONTAINER_TAG: "1.4.0"
default:
image: eicweb.phy.anl.gov:4567/containers/image_recipes/ubuntu_dind:latest
tags:
- silicon
stages: stages:
- config
- build - build
- build_docker - push
- build_sing_img - deploy
- data_replays - cleanup
- data_tests
hcana_build: workflow:
stage: build rules:
tags: - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- sodium - if: '$CI_COMMIT_BRANCH == "master"'
script: - if: '$CI_COMMIT_TAG'
- ls -lrth /usr/local/bin
- bash bin/compile
hcana_docker:
stage: build_docker
only:
- tags
tags:
- eic0 docker
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- cd containers/docker && make release
hcana_singularity: env:
tags: stage: config
- singularity
stage: build_sing_img
when: manual
dependencies:
- hcana_docker
script: script:
- /bin/bash .gitlabci/setup.sh - export HCANA_TAG="latest"
- mkdir -p build - |
- pwd if [ "x${CI_PIPELINE_SOURCE}" == "xmerge_request_event" ]; then
- cp containers/singularity/Singularity Singularity.hcana export HCANA_TAG="testing-mr-${CI_MERGE_REQUEST_IID}"
- cp Singularity.hcana build/. fi
- /bin/bash .gitlabci/build.sh Singularity.hcana - echo "CI HCANA_TAG for this pipeline set to ${HCANA_TAG}"
- cp Singularity.hcana.simg build/. - echo "HCANA_TAG=$HCANA_TAG" >> hcana.env
artifacts: artifacts:
paths: reports:
- build/Singularity.hcana dotenv: hcana.env
- build/Singularity.hcana.simg
elastic_replay: docker:
when: manual stage: build
tags: needs:
- eic0 docker - env
stage: data_replays
dependencies:
- hcana_singularity
script: script:
- bash tests/replay_elastic_data.sh - echo $HCANA_TAG
artifacts: - ./.gitlabci/configure.sh .containers/Dockerfile.in
paths: - cd .containers
- ROOTfiles/* - make build-nc
- build/Singularity.hcana
- build/Singularity.hcana.simg
elastic_test1: ## for now only publish the stable versions to the registry.
when: manual ## if we change this down the line for some CI-time testing
tags: ## make sure to also enable the cleanup job
- eic0 docker publish:
stage: data_tests stage: push
dependencies: rules:
- elastic_replay - if: '$CI_COMMIT_BRANCH == "master"'
when: manual
- if: '$CI_COMMIT_TAG'
when: manual
needs:
- env
- docker
script: script:
- bash tests/elastic_test.sh - cd .containers
- |
if [ "x$CI_COMMIT_TAG" != "x" ]; then
make publish publish-version
else
make publish
fi
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure
elastic_test2: .singularity:
when: manual stage: deploy
tags: needs:
- eic0 docker - env
stage: data_tests - publish
dependencies:
- elastic_replay
script: script:
- bash tests/elastic_test2.sh - ./.gitlabci/configure.sh .containers/hcana.def.in
- mkdir -p build
- mv .containers/hcana.def build
- singularity build build/hcana.sif build/hcana.def
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure
singularity:latest:
extends: .singularity
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
when: manual
- if: '$CI_COMMIT_TAG'
when: manual
artifacts:
expire_in: 90 days
paths:
- build/hcana.sif
- build/hcana.def
purge_image:
stage: cleanup
needs:
- env
- publish
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
script:
- cd .containers
- make cleanup || true
- make unpublish || true
File mode changed from 100644 to 100755
#!/bin/bash
## Configure a CI file based on a template file (first and only
## argument to this script).
## Known variables that will be substituted:
## @CONTAINER_TAG@ - docker tag for the ROOT container
## @HCANA_TAG@ - output tag for the hcana version
## @HCANA_BRANCH@ - hcana git branch for build
TEMPLATE_FILE=$1
OUTPUT_FILE=${TEMPLATE_FILE%.*}
HCANA_BRANCH="master"
if [ -n "${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}" ] ; then
HCANA_BRANCH=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
fi
echo "Configuring CI file: ${TEMPLATE_FILE}"
echo "Output will be written to: ${OUTPUT_FILE}"
sed "s/@CONTAINER_TAG@/$CONTAINER_TAG/g" $TEMPLATE_FILE | \
sed "s/@HCANA_TAG@/$HCANA_TAG/g" | \
sed "s/@HCANA_BRANCH@/$HCANA_BRANCH/g" > ${OUTPUT_FILE}
echo "Done"
#!/bin/bash
apt-get update && apt-get install -y wget git \
build-essential \
squashfs-tools \
libtool \
autotools-dev \
libarchive-dev \
automake \
autoconf \
uuid-dev \
python3 \
libssl-dev
sed -i -e 's/^Defaults\tsecure_path.*$//' /etc/sudoers
# Check Python
echo "Python Version:"
which python
python --version
pip install sregistry[all]
sregistry version
echo "sregistry Version:"
# Install Singularity
cd /tmp && \
git clone -b vault/release-2.5 https://www.github.com/sylabs/singularity.git
cd singularity && \
./autogen.sh && \
./configure --prefix=/usr/local && \
make -j8 && make install
.gitlabci/sregistry-gitlab.png

37.4 KiB

File deleted
1.4.0
#!/bin/bash
#set -o nounset
set -o errexit
startdir=$(pwd)
export PYTHONPATH=/usr/local/lib:$PYTHONPATH
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export PATH=/usr/local/bin:$PATH
source /usr/local/bin/thisroot.sh
cd /tmp
git clone https://github.com/fmtlib/fmt.git && cd fmt
git checkout 6.2.1 && mkdir /tmp/build && cd /tmp/build
cmake -DBUILD_SHARED_LIBS=TRUE ../fmt
make -j20 install
cd /tmp && rm -r /tmp/build && rm -r /tmp/fmt
cd /tmp
git clone https://eicweb.phy.anl.gov/jlab/hallc/analyzer_software/hallac_evio.git
mkdir hallac_evio/build && cd hallac_evio/build
cmake ../. && make -j20 && make install
cd /tmp && rm -rf hallac_evio
cd /tmp
export PYTHONPATH=/usr/local/lib:$PYTHONPATH
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export PATH=/usr/local/bin:$PATH
git clone --depth 1 https://eicweb.phy.anl.gov/jlab/hallc/analyzer_software/analyzer.git
mkdir analyzer/build && cd analyzer/build
cmake ../. && make -j20 VERBOSE=1 && make install
cd /tmp && rm -rf analyzer
export PYTHONPATH=/usr/local/lib:$PYTHONPATH
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export PATH=/usr/local/bin:$PATH
source /usr/local/bin/thisroot.sh
cd $startdir
mkdir build && cd build
cmake ../. && make -j20 VERBOSE=1 && make install
FROM eicweb.phy.anl.gov:4567/containers/image_recipes/root_base:latest
LABEL maintainer "Whitney Armstrong <warmstrong@anl.gov>"
#
RUN ls -lrth /usr/local/lib/lib*.so \
&& export PYTHONPATH=/usr/local/lib:$PYTHONPATH \
&& export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH \
&& export PATH=/usr/local/bin:$PATH \
&& source /usr/local/bin/thisroot.sh \
&& cd /tmp \
&& git clone https://github.com/fmtlib/fmt.git && cd fmt \
&& git checkout 6.2.1 && mkdir /tmp/build && cd /tmp/build \
&& cmake -DBUILD_SHARED_LIBS=TRUE ../fmt \
&& make -j20 install \
&& cd /tmp && rm -r /tmp/build && rm -r /tmp/fmt \
&& cd /tmp \
&& git clone https://eicweb.phy.anl.gov/jlab/hallc/analyzer_software/hallac_evio.git \
&& mkdir hallac_evio/build && cd hallac_evio/build \
&& cmake ../. && make -j20 && make install \
&& cd /tmp && rm -rf hallac_evio \
&& cd /tmp \
&& export PYTHONPATH=/usr/local/lib:$PYTHONPATH \
&& export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH \
&& export PATH=/usr/local/bin:$PATH \
&& git clone https://eicweb.phy.anl.gov/jlab/hallc/analyzer_software/analyzer.git \
&& mkdir analyzer/build && cd analyzer/build && git pull && git checkout v1.8.2 \
&& cmake ../. && make -j20 VERBOSE=1 && make install \
&& cd /tmp && rm -rf analyzer \
&& export PYTHONPATH=/usr/local/lib:$PYTHONPATH \
&& export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH \
&& export PATH=/usr/local/bin:$PATH \
&& source /usr/local/bin/thisroot.sh \
&& git clone https://eicweb.phy.anl.gov/jlab/hallc/analyzer_software/hcana.git \
&& mkdir hcana/build && cd hcana/build \
&& git pull \
&& cmake ../. && make -j20 VERBOSE=1 && make install \
&& cd /tmp && rm -rf hcana
#-DCMAKE_CXX_FLAGS=" -march=haswell -O3 -mfma -malign-data=cacheline -finline-functions "
#&& wget -O- https://root.cern.ch/download/root_v6.14.06.source.tar.gz | tar -zxvf - \
#&& mv root-6.14.06 root_master \
#RUN which c++ && ls -lrth /usr/bin/c++ && cd /tmp/builds/root_build && make -j38 VERBOSE=1 && make install \
# && cd /tmp && rm -rf /tmp/root_master && rm -rf /tmp/builds/root_build
#RUN useradd -ms /bin/bash -d /opt/user user
#USER user
#WORKDIR /opt/bubble_user
##CMD ["-c" ]
#ENTRYPOINT ["/bin/bash"]
# ROOT base
#
# A container for the latest root
#
FROM whit/image_recipes/ubuntu_base:latest
LABEL maintainer "Whitney Armstrong <warmstrong@anl.gov>"
#
RUN cd /tmp \
&& wget http://bitbucket.org/eigen/eigen/get/3.3.4.tar.bz2 \
&& tar -xvf 3.3.4.tar.bz2 \
&& cd eigen-* \
&& mkdir build && cd build \
&& cmake ../. -DCMAKE_CXX_FLAGS=" -march=haswell -O3 -mfma -malign-data=cacheline -finline-functions " \
&& make -j10 > /tmp/eigen_build.log && make install
RUN cd /tmp \
&& git clone --depth=1 https://gitlab.cern.ch/CLHEP/CLHEP.git \
&& mkdir -p builds/clhep_build \
&& cd builds/clhep_build \
&& cmake /tmp/CLHEP/. -DCMAKE_CXX_FLAGS=" -march=haswell -O3 -mfma -malign-data=cacheline -finline-functions "\
&& make -j38 install > /tmp/clhep_build.log \
&& cd /tmp && rm -rf /tmp/CLHEP && rm -rf /tmp/builds/clhep_build
RUN cd /tmp \
&& git clone https://github.com/VcDevel/Vc.git \
&& cd Vc \
&& git submodule update --init \
&& mkdir build && cd build \
&& cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_TESTING=OFF -DTARGET_ARCHITECTURE=broadwell ../. \
&& make -j30 > /tmp/vc_build.log \
&& make install
# Build root from the repo master
RUN cd /tmp \
&& pwd \
&& git clone --depth=1 https://github.com/root-project/root.git root_master \
&& cd /tmp && mkdir -p builds/root_build \
&& cd builds/root_build \
&& cmake ../../root_master/. -Droot7:BOOL=ON -Dcxx17:BOOL=ON -Dfortran:BOOL=ON \
-Dgdml:BOOL=ON -Dmathmore:BOOL=ON -Dminuit2:BOOL=ON -Dbuiltin_vdt:BOOL=ON -Dbuiltin_veccore:BOOL=ON \
-Dvc:BOOL=ON -Dbuiltin_vecgeom:BOOL=ON -Dunuran:BOOL=ON \
&& cd /tmp/builds/root_build && make -j38 > /tmp/root_build.log && make install \
&& cd /tmp && rm -rf /tmp/root_master && rm -rf /tmp/builds/root_build
#-DCMAKE_CXX_FLAGS=" -march=haswell -O3 -mfma -malign-data=cacheline -finline-functions "
#&& wget -O- https://root.cern.ch/download/root_v6.14.06.source.tar.gz | tar -zxvf - \
#&& mv root-6.14.06 root_master \
#RUN which c++ && ls -lrth /usr/bin/c++ && cd /tmp/builds/root_build && make -j38 VERBOSE=1 && make install \
# && cd /tmp && rm -rf /tmp/root_master && rm -rf /tmp/builds/root_build
#RUN useradd -ms /bin/bash -d /opt/user user
#USER user
#WORKDIR /opt/bubble_user
##CMD ["-c" ]
#ENTRYPOINT ["/bin/bash"]
Hall A/C Software
=================
Images for running containers for all aspects of the SANE experimental
analysis.
The starting point is a pre-built image for the ROOT libraries. (ubuntu + ROOT)
Main software libraries:
- `evio`: Built from https://github.com/whit2333/hallac_evio
- `analyzer`: Hall A analyzer (podd)from https://github.com/whit2333/analyzer
- `hcana`: Hall C analyzer from https://github.com/whit2333/hcana
These are all built using the super build project `cool_halls` (https://github.com/whit2333/cool_halls)
# You have to define the values in {}
#DOCKER_REPO={account-nr}.dkr.ecr.{region}.amazonaws.com
## optional aws-cli options
#AWS_CLI_PROFILE={aws-cli-profile}
#AWS_CLI_REGION={aws-cli-region}
# INSTALL
# - copy the files deploy.env, config.env, version.sh and Makefile to your repo
# - replace the vars in deploy.env
# - define the version script
# Build the container
make build
# Build and publish the container
make release
# Publish a container to AWS-ECR.
# This includes the login to the repo
make publish
# Run the container
make run
# Build an run the container
make up
# Stop the running container
make stop
# Build the container with differnt config and deploy file
make cnf=another_config.env dpl=another_deploy.env build
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment