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

Resolve "Singularity download approach doesn't work in child pipeline"

Added singularity to main pipeline

updated install.py script consistent with new repo structure.
parent 68edf863
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,8 @@ image: eicweb.phy.anl.gov:4567/containers/image_recipes/ubuntu_dind:latest ...@@ -2,7 +2,8 @@ image: eicweb.phy.anl.gov:4567/containers/image_recipes/ubuntu_dind:latest
stages: stages:
- config - config
- trigger - build
- deploy
## make note if we cannot use caching for one of the stages ## make note if we cannot use caching for one of the stages
## by touching files in .ci_env ## by touching files in .ci_env
...@@ -36,16 +37,37 @@ detect_changes:release: ...@@ -36,16 +37,37 @@ detect_changes:release:
init: init:
stage: config stage: config
script: script:
- ./gitlab-ci/configure_pipeline.sh gitlab-ci/build_and_deploy.yml.in - ./gitlab-ci/configure.sh gitlab-ci/build_and_deploy.yml.in
artifacts: artifacts:
paths: paths:
- build_and_deploy.yml - build_and_deploy.yml
## Dispatch if we ran the previous stage ## Dispatch if we ran the previous stage
run:default: run:default:
stage: trigger stage: build
trigger: trigger:
include: include:
- artifact: build_and_deploy.yml - artifact: build_and_deploy.yml
job: init job: init
strategy: depend strategy: depend
singularity:
stage: deploy
needs: ["run:default"]
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
when: on_success
- if: '$CI_COMMIT_BRANCH =~ /v[0-9]+\.[0-9]+-stable/'
when: on_success
- if: '$CI_COMMIT_TAG =~ /v[0-9]+\.[0-9]+\.[0-9]+/'
when: on_success
script:
- mkdir -p build
- cd build
- ../gitlab-ci/configure.sh ../containers/release/eic.def.in
- /bin/bash ../gitlab-ci/singularity/build.sh eic.def
artifacts:
expire_in: 90 days
paths:
- build/eic.sif
- build/eic.def
...@@ -24,8 +24,3 @@ grep export config/spack-env.sh | \ ...@@ -24,8 +24,3 @@ grep export config/spack-env.sh | \
sed '/^@ENV@/r config/eic-env.sh' containers/release/Dockerfile.in | \ sed '/^@ENV@/r config/eic-env.sh' containers/release/Dockerfile.in | \
sed '/^@ENV@/d' | \ sed '/^@ENV@/d' | \
sed "s/@TAG@/$TAG/" > config/Dockerfile sed "s/@TAG@/$TAG/" > config/Dockerfile
## And release singularity definition
sed '/^@ENV@/r config/eic-env.sh' containers/release/eic.def.in | \
sed '/^@ENV@/d' | \
sed "s/@TAG@/$TAG/" > config/eic.def
...@@ -4,7 +4,6 @@ stages: ...@@ -4,7 +4,6 @@ stages:
- build - build
- config - config
- package - package
- singularity
## variables: ## variables:
## - TARGET_XXX: docker build target (including cache modifier) ## - TARGET_XXX: docker build target (including cache modifier)
...@@ -40,12 +39,12 @@ config: ...@@ -40,12 +39,12 @@ config:
stage: config stage: config
needs: ["builder"] needs: ["builder"]
script: script:
- bash containers/release/configure_release.sh $TAG - bash containers/release/configure_dockerfile.sh $TAG
artifacts: artifacts:
paths: paths:
- config - config
release:docker: release:
stage: package stage: package
needs: ["config"] needs: ["config"]
script: script:
...@@ -61,25 +60,3 @@ release:docker: ...@@ -61,25 +60,3 @@ release:docker:
artifacts: artifacts:
paths: paths:
- config - config
release:singularity:
stage: singularity
needs: ["release:docker"]
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
when: on_success
- if: '$CI_COMMIT_BRANCH == "v@TAG@"'
when: on_success
- if: '$CI_COMMIT_TAG == "v@TAG@"'
when: on_success
script:
- cp config/eic.def eic.def
- /bin/bash gitlab-ci/singularity/build.sh eic.def
- mkdir -p build
- cp eic.sif build/.
- cp eic.def build/.
artifacts:
expire_in: 90 days
paths:
- build/eic.sif
- build/eic.def
#!/bin/bash #!/bin/bash
## Configure a CI pipeline based on a template file (first and only ## Configure a CI file based on a template file (first and only
## argument to this script). ## argument to this script).
## Known variables that will be substituted:
## @TAG@ - docker tag used for this build
## @TARGET_BUILDER@ - docker Makefile target for the builder image
## @TARGET_RELEASE@ - docker Makefile target for the release image
## @PUBLISH@ - docker push Makefile target
TEMPLATE_FILE=$1 TEMPLATE_FILE=$1
OUTPUT_FILE=`basename ${TEMPLATE_FILE} .in` OUTPUT_FILE=`basename ${TEMPLATE_FILE} .in`
echo "Configuring pipeline script: ${TEMPLATE_FILE}" echo "Configuring CI file: ${TEMPLATE_FILE}"
echo "Output will be written to: ${OUTPUT_FILE}" echo "Output will be written to: ${OUTPUT_FILE}"
VERSION=`head -n1 VERSION` VERSION=`head -n1 VERSION`
......
...@@ -15,6 +15,7 @@ Authors: ...@@ -15,6 +15,7 @@ Authors:
import os import os
import argparse import argparse
import re
import urllib.request import urllib.request
from install import make_launcher, make_modulefile from install import make_launcher, make_modulefile
from install.util import smart_mkdir, project_version, InvalidArgumentError from install.util import smart_mkdir, project_version, InvalidArgumentError
...@@ -30,7 +31,7 @@ PROGRAMS = ['eic-shell', ...@@ -30,7 +31,7 @@ PROGRAMS = ['eic-shell',
'ipython'] 'ipython']
## URL for the current container (git tag will be filled in by the script) ## URL for the current container (git tag will be filled in by the script)
CONTAINER_URL = r'https://eicweb.phy.anl.gov/api/v4/projects/290/jobs/artifacts/{version}/raw/build/{img}.sif?job=release:singularity' CONTAINER_URL = r'https://eicweb.phy.anl.gov/api/v4/projects/290/jobs/artifacts/{version}/raw/build/{img}.sif?job=singularity'
#api/v4/projects/1/jobs/artifacts/master/raw/some/release/file.pdf #api/v4/projects/1/jobs/artifacts/master/raw/some/release/file.pdf
## Singularity bind directive ## Singularity bind directive
...@@ -89,14 +90,34 @@ if __name__ == "__main__": ...@@ -89,14 +90,34 @@ if __name__ == "__main__":
raise InvalidArgumentError() raise InvalidArgumentError()
bind_directive = ' '.join([BIND_DIRECTIVE.format(path) for path in args.bind_paths]) bind_directive = ' '.join([BIND_DIRECTIVE.format(path) for path in args.bind_paths])
## We want to slightly modify our version specifier: if it leads with a 'v' drop the v ## Naming schemes:
## for everything installed, but ensure we have the leading v as well where needed ## We need to deduce both the correct git branch and an appropriate
version = '{}'.format(args.version) ## local version number from the desired version number
vversion = '{}'.format(args.version) ## by default we use whatever version number is given in VERSION, but we want
if version[0] == 'v': ## to allow users to specify either X.Y.Z or vX.Y.Z for versions (same for stable
version = version[1:] ## branches).
if vversion[0].isdigit(): ##
vversion= 'v{}'.format(args.version) ## Policy:
## numbered releases: (v)X.Y.Z --> git vX.Y.Z and local X.Y.Z
## stable branches: (v)X.Y-stable --> git vX.Y-stable and local X.Y-stable
## master branch: latest/master --> git master and local stable
## for other branches --> git <BRANCH> and local unstable
version_local = None
version_repo = None
if args.version in ('master', 'latest'):
version_local = 'latest'
version_repo = 'master'
elif re.search('[0-9]+\.[0-9]+\.[0-9]|[0-9]+\.[0-9]-stable', args.version) is not None:
version_local = args.version
version_repo = args.version
if version_local[0] == 'v':
version_local = version_local[1:]
if version_repo[0].isdigit():
version_repo = 'v{}'.format(args.version)
else:
version_local = 'unstable'
version_repo = args.version
## Create our install prefix if needed and ensure it is writable ## Create our install prefix if needed and ensure it is writable
args.prefix = os.path.abspath(args.prefix) args.prefix = os.path.abspath(args.prefix)
...@@ -125,10 +146,10 @@ if __name__ == "__main__": ...@@ -125,10 +146,10 @@ if __name__ == "__main__":
## Builder SIF is not built anymore, deprecated ## Builder SIF is not built anymore, deprecated
#if args.builder: #if args.builder:
#img += "_builder" #img += "_builder"
container = '{}/{}.sif.{}'.format(libdir, img, version) container = '{}/{}.sif.{}'.format(libdir, img, version_local)
if not os.path.exists(container) or args.force: if not os.path.exists(container) or args.force:
url = CONTAINER_URL.format(group=GROUP_NAME, project=PROJECT_NAME, url = CONTAINER_URL.format(group=GROUP_NAME, project=PROJECT_NAME,
version=vversion, img=img) version=version_repo, img=img)
print('Downloading container from:', url) print('Downloading container from:', url)
print('Destination:', container) print('Destination:', container)
urllib.request.urlretrieve(url, container) urllib.request.urlretrieve(url, container)
...@@ -137,7 +158,7 @@ if __name__ == "__main__": ...@@ -137,7 +158,7 @@ if __name__ == "__main__":
print(' ---> run with -f to force a re-download') print(' ---> run with -f to force a re-download')
if not args.local: if not args.local:
make_modulefile(PROJECT_NAME, version, moduledir, bindir) make_modulefile(PROJECT_NAME, version_local, moduledir, bindir)
## configure the application launchers ## configure the application launchers
print('Configuring applications launchers: ') print('Configuring applications launchers: ')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment