Commit 18a9d9d3 authored by David Moxey's avatar David Moxey

Reenable dockerhub builds and deployment

parent 1d79d663
Pipeline #2133 failed with stages
in 44 minutes and 7 seconds
......@@ -3,6 +3,11 @@ stages:
- build-env-full
- build-and-test
- compiler-warnings
- package-env
- package-build
- package-build-dev
- package-test
- package-deploy
.execution-conditions: &execution-conditions
only:
......@@ -103,8 +108,7 @@ stages:
.build-env-debian-template-default: &build-env-debian-template-default
<<: *build-env-template
stage:
build-env-default
stage: build-env-default
variables:
OS_DISTRO: debian
script:
......@@ -119,8 +123,7 @@ stages:
.build-env-debian-template-full: &build-env-debian-template-full
<<: *build-env-debian-template-default
stage:
build-env-full
stage: build-env-full
buster-default-build-env:
<<: *build-env-debian-template-default
......@@ -177,8 +180,7 @@ stretch-full-warnings:
buster-documentation-build-env:
<<: *execution-conditions
image: docker:19.03.6
stage:
build-env-full
stage: build-env-full
script:
- export IMAGE=$CI_REGISTRY_IMAGE:env-documentation
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
......@@ -241,8 +243,7 @@ tutorials-build:
.build-env-ubuntu-template-full: &build-env-ubuntu-template-full
<<: *build-env-ubuntu-template-default
stage:
build-env-full
stage: build-env-full
focal-default-build-env:
<<: *build-env-ubuntu-template-default
......@@ -328,8 +329,7 @@ xenial-full-warnings:
.build-env-centos-template-full: &build-env-centos-template-full
<<: *build-env-centos-template-default
stage:
build-env-full
stage: build-env-full
centos7-default-build-env:
<<: *build-env-centos-template-default
......@@ -399,21 +399,6 @@ osx-full-warnings:
# ################# WINDOWS ####################
# ################################################
#win7-default-build-and-test:
# <<: *build-and-test-template
# tags:
# - win7
# script:
# - $Env:path = "$CI_PROJECT_DIR\build\dist\bin;$CI_PROJECT_DIR\ThirdParty;" + $Env:path
# - echo $Env:path
# - mkdir build
# - cd build
# - cmake.exe -G "Visual Studio 12 2013 Win64" --config Debug ..
# - cmake.exe --build . --target ALL_BUILD --config Debug
# - cmake.exe --build . --target INSTALL --config Debug
# - ctest --output-on-failure -C Debug -j3
win10-default-build-and-test:
<<: *build-and-test-template
tags:
......@@ -447,3 +432,141 @@ win10-mpi-default-build-and-test:
after_script:
- Remove-Item -Recurse -Force build
needs: []
# ##################################################
# ################# DOCKERHUB ####################
# ##################################################
# Docker Hub build template. We build images and push them into the gitlab
# container registry first; this way, we can test the images before they are
# deployed, modify images or test adjustments to the CI by using docker/*
# branches on gitlab, and test the images before they are deployed.
#
# Images are tagged with both :latest and the short SHA commit, so that the
# correct image version can be grabbed from the container registry.
.dockerhub_build_template: &dockerhub_build_template
image: docker:stable
only:
- master@nektar/nektar
- /^docker\/.*$/@nektar/nektar
- tags@nektar/nektar
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- IMAGE=$CI_REGISTRY_IMAGE/${image_name}
- docker pull $IMAGE || true
- docker build ${args} --pull -t $IMAGE -f ${dockerfile} .
- docker tag $IMAGE $IMAGE:$CI_COMMIT_SHORT_SHA
- docker tag $IMAGE $IMAGE:latest
- docker push $IMAGE:$CI_COMMIT_SHORT_SHA
- docker push $IMAGE:latest
# Docker Hub test template, which runs an image from the gitlab container
# registry on a particular SHA commit.
.dockerhub-test-template: &dockerhub_test_template
image: ${CI_REGISTRY_IMAGE}/${image_name}:$CI_COMMIT_SHORT_SHA
stage: package-test
only:
- master@nektar/nektar
- /^docker\/.*$/@nektar/nektar
- tags@nektar/nektar
# Docker Hub deployment template. Only builds for master or tags on the main
# Nektar repository. The strategy is to login to the container registry and pull
# an image onto the runner; we then tag the image as appropriate (with :latest
# and SHA commit, as well as the git tag if this happens to be a tagged commit),
# then push the image up to Docker Hub. Note that cleanup of images on the
# runners can be difficult if they are tagged multiple times, so we also perform
# a quick rmi to make sure we only keep the images from the registry.
.dockerhub-deploy-template: &dockerhub_deploy_template
image: docker:stable
stage: package-deploy
only:
- master@nektar/nektar
- tags@nektar/nektar
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- CI_IMAGE=$CI_REGISTRY_IMAGE/${image_name}:$CI_COMMIT_SHORT_SHA
- DH_IMAGE=${DOCKERIO_REGISTRY}/nektarpp/${image_name}
- docker pull $CI_IMAGE
- docker logout
- docker login -u "$DOCKERIO_REGISTRY_USER" -p "$DOCKERIO_REGISTRY_PASSWORD" $DOCKERIO_REGISTRY
- if [ ! -z $CI_COMMIT_TAG ]; then docker tag $CI_IMAGE $DH_IMAGE:$CI_COMMIT_TAG; docker push $DH_IMAGE:$CI_COMMIT_TAG; docker rmi $DH_IMAGE:$CI_COMMIT_TAG; fi
- docker tag $CI_IMAGE $DH_IMAGE:$CI_COMMIT_SHORT_SHA
- docker tag $CI_IMAGE $DH_IMAGE:latest
- docker push $DH_IMAGE:$CI_COMMIT_SHORT_SHA
- docker push $DH_IMAGE:latest
- docker rmi $DH_IMAGE:$CI_COMMIT_SHORT_SHA $DH_IMAGE:latest
# nektarpp/nektar-env image
dockerhub-build-env:
<<: *dockerhub_build_template
stage: package-env
variables:
image_name: nektar-env
dockerfile: docker/nektar-env/Dockerfile
# nektarpp/nektar image
dockerhub-build-nektar:
<<: *dockerhub_build_template
stage: package-build
needs: [ "dockerhub-build-env" ]
variables:
image_name: nektar
dockerfile: docker/nektar/Dockerfile
args: --build-arg ENV_IMAGE=$CI_REGISTRY_IMAGE/nektar-env:$CI_COMMIT_SHORT_SHA
GIT_SUBMODULE_STRATEGY: normal
# nektarpp/nektar image
dockerhub-build-workbook:
<<: *dockerhub_build_template
stage: package-build
needs: []
variables:
image_name: nektar-workbook
dockerfile: docker/nektar-workbook/Dockerfile
# nektarpp/nektar-dev image
dockerhub-build-dev:
<<: *dockerhub_build_template
stage: package-build-dev
needs: [ "dockerhub-build-nektar" ]
variables:
image_name: nektar-dev
args: --build-arg ENV_IMAGE=$CI_REGISTRY_IMAGE/nektar-env:$CI_COMMIT_SHORT_SHA --build-arg NEKTAR_IMAGE=$CI_REGISTRY_IMAGE/nektar:$CI_COMMIT_SHORT_SHA
dockerfile: docker/nektar-dev/Dockerfile
# Test the dockerhub images
dockerhub-test-nektar:
<<: *dockerhub_test_template
needs: [ "dockerhub-build-nektar" ]
variables:
image_name: nektar
script:
- mpirun -n 3 IncNavierStokesSolver $CI_PROJECT_DIR/solvers/IncNavierStokesSolver/Tests/ChanFlow_m3_par.xml
dockerhub-test-nektar-dev:
<<: *dockerhub_test_template
needs: [ "dockerhub-build-dev" ]
variables:
image_name: nektar-dev
script:
- cd $CI_PROJECT_DIR/templates/executable
- ./test.sh /usr/local/lib64/nektar++/cmake 3
# Deployment
dockerhub-deploy-nektar:
<<: *dockerhub_deploy_template
variables:
image_name: nektar
dockerhub-deploy-nektar-env:
<<: *dockerhub_deploy_template
variables:
image_name: nektar-env
dockerhub-deploy-nektar-dev:
<<: *dockerhub_deploy_template
variables:
image_name: nektar-dev
dockerhub-deploy-nektar-workbook:
<<: *dockerhub_deploy_template
variables:
image_name: nektar-workbook
......@@ -101,6 +101,9 @@ SET(LIB_DIR "lib")
IF( CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND NOT APPLE )
SET(LIB_DIR "lib64")
ENDIF()
IF (DEFINED NEKTAR_LIB_DIR)
SET(LIB_DIR ${NEKTAR_LIB_DIR})
ENDIF()
SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ")
SET(NEKTAR_BIN_DIR bin)
......@@ -110,11 +113,19 @@ SET(NEKTAR_SHARE_DIR share/nektar++)
SET(NEKTAR_DOC_DIR share/doc/nektar++)
SET(NEKTAR_CMAKE_DIR ${LIB_DIR}/nektar++/cmake)
# Allow for overriding final include header directory (for Fedora/CentOS
# packaging)
IF (DEFINED NEKTAR_INCLUDE_ROOT)
SET(NEKTAR_INCLUDE_DIST_DIR ${NEKTAR_INCLUDE_ROOT}/nektar++)
ELSE()
SET(NEKTAR_INCLUDE_DIST_DIR ${CMAKE_INSTALL_PREFIX}/${NEKTAR_INCLUDE_DIR})
ENDIF()
# Set ThirdParty locations.
SET(TPSRC ${CMAKE_SOURCE_DIR}/ThirdParty)
SET(TPBUILD ${CMAKE_BINARY_DIR}/ThirdParty)
SET(TPDIST ${CMAKE_BINARY_DIR}/ThirdParty/dist)
SET(TPINC ${CMAKE_INSTALL_PREFIX}/include/ThirdParty)
SET(TPINC ${NEKTAR_INCLUDE_DIST_DIR}/ThirdParty)
SET(TPLIB ${CMAKE_INSTALL_PREFIX}/${NEKTAR_LIB_DIR}/nektar++/thirdparty)
# Create ThirdParty source directory if it doesn't exist already.
......
......@@ -30,13 +30,12 @@
SET(NEKTAR++_FOUND "ON")
SET(NEKTAR++_VERSION "@NEKTAR_VERSION@")
SET(NEKTAR++_ROOT_DIR "@CMAKE_INSTALL_PREFIX@")
SET(NEKTAR++_INCLUDE_DIRS "${NEKTAR++_ROOT_DIR}/@NEKTAR_INCLUDE_DIR@")
SET(NEKTAR++_INCLUDE_DIRS "@NEKTAR_INCLUDE_DIST_DIR@")
SET(NEKTAR++_LIBRARY_DIRS "${NEKTAR++_ROOT_DIR}/@NEKTAR_LIB_DIR@")
SET(NEKTAR++_DEFINITIONS @NEKTAR_DEFINITIONS@)
SET(NEKTAR++_LIBRARIES @NEKTAR++_LIBRARIES@)
SET(NEKTAR++_TP_INCLUDE_DIRS
"${NEKTAR++_ROOT_DIR}/@NEKTAR_INCLUDE_DIR@/ThirdParty")
SET(NEKTAR++_TP_INCLUDE_DIRS "@NEKTAR_INCLUDE_DIST_DIR@/ThirdParty")
SET(NEKTAR++_TP_LIBRARIES "")
SET(NEKTAR++_TP_LIBRARY_DIRS "")
......
FROM nektarpp/nektar-env:latest AS build
ARG NEKTAR_IMAGE=nektarpp/nektar:latest
ARG ENV_IMAGE=nektarpp/nektar-env:latest
FROM $NEKTAR_IMAGE as nektar
FROM $ENV_IMAGE AS build
LABEL maintainer="David Moxey <d.moxey@exeter.ac.uk>"
LABEL maintainer="Nektar++ Development Team <nektar-users@imperial.ac.uk>"
ARG INSTALL_PREFIX=/usr/local
USER root
COPY --from=nektarpp/nektar:latest ${INSTALL_PREFIX} ${INSTALL_PREFIX}
COPY --from=nektar ${INSTALL_PREFIX} ${INSTALL_PREFIX}
# Set up entrypoint for copying test files.
COPY docker/nektar/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
......
......@@ -6,14 +6,24 @@ image for code development purposes.
## Building
The image is built using `nektarpp/nektar-env` and requires as build context the
path to the Nektar++ source tree. It supports the build environment variable:
The image is built using `nektarpp/nektar-env` or similar and requires as build
context the path to the Nektar++ source tree. It supports the build environment
variables:
- `ENV_IMAGE` and `NEKTAR_IMAGE`, which are used to select the environment image
and Nektar image to build against. This is used by the CI to e.g. consistently
build against the correct commits. By default these are set to
`nektarpp/nektar-env:latest` and `nektarpp/nektar:latest`.
- `INSTALL_PREFIX` can be set to adjust the install prefix, which is
`/usr/local` by default.
Then build the image using a command similar to:
```sh
docker build -t nektarpp/nektar-dev -f ~/nektar++/docker/nektar-dev/Dockerfile ~/nektar++
docker build \
-t nektarpp/nektar-dev \
-f ~/nektar++/docker/nektar-dev/Dockerfile \
--build-arg ENV_IMAGE=nektarpp/nektar-env:latest \
--build-arg NEKTAR_IMAGE=nektarpp/nektar:latest \
~/nektar++
```
FROM debian:buster-slim
LABEL maintainer="David Moxey <d.moxey@exeter.ac.uk>"
LABEL maintainer="Nektar++ Development Team <nektar-users@imperial.ac.uk>"
RUN DEBIAN_RELEASE=buster && \
echo "deb http://deb.debian.org/debian ${DEBIAN_RELEASE} non-free" > \
......
FROM jupyter/scipy-notebook:ae5f7e104dd5 AS build
LABEL maintainer="Nektar++ Development Team <nektar-users@imperial.ac.uk>"
USER root
RUN apt-get update && \
apt-get install -y libtinyxml-dev && \
......@@ -23,4 +25,4 @@ RUN cd /tmp/nektar && mkdir build && cd build && \
chown -R $NB_UID:$NB_UID /tmp/nektar && \
cd /tmp/nektar/build && sudo -u $NB_USER make nekpy-install-system && cd && rm -R /tmp/nektar
USER $NB_UID
\ No newline at end of file
USER $NB_UID
FROM nektarpp/nektar-env:latest AS build
ARG ENV_IMAGE=nektarpp/nektar-env:latest
FROM $ENV_IMAGE AS build
LABEL maintainer="David Moxey <d.moxey@exeter.ac.uk>"
LABEL maintainer="Nektar++ Development Team <nektar-users@imperial.ac.uk>"
COPY --chown=nektar:nektar . /home/nektar
......
......@@ -13,9 +13,13 @@ enabled:
## Building
The image is built using `nektarpp/nektar-env` and requires as build context the
path to the Nektar++ source tree. It supports three additional build arguments:
The image is built using `nektarpp/nektar-env` or similar and requires as build
context the path to the Nektar++ source tree. It supports several additional
build arguments:
- `ENV_IMAGE` is used to select the environment to build against. This is used
by the CI to e.g. consistently build against the correct commits. By default
this is set to `nektarpp/nektar-env:default`.
- `BUILD_DEMOS` can be set to `ON` to build demos, which are disabled by
default;
- `BUILD_SOLVERS` can be set to `OFF` to disable build of solvers, which are
......
......@@ -868,8 +868,8 @@ NekDouble MMFAdvection::ComputeCirculatingArclength(const NekDouble zlevel,
const NekDouble Rhs)
{
NekDouble Tol = 0.0001, Maxiter = 1000, N = 100, F = 0.0, dF = 0.0;
NekDouble newy, y0, tmp;
NekDouble Tol = 0.0001, Maxiter = 1000, N = 100;
NekDouble newy, F = 0.0, dF = 1.0, y0, tmp;
Array<OneD, NekDouble> xp(N + 1);
Array<OneD, NekDouble> yp(N + 1);
......
......@@ -7,7 +7,7 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.5.1)
# TODO - Put the name of your project here.
PROJECT(ExampleSolver)
PROJECT(ExampleSolver C CXX)
# Finds Nektar++. This may introduce other dependencies, such as Boost.
FIND_PACKAGE(Nektar++ REQUIRED)
......
......@@ -10,7 +10,13 @@ make install
# Run test case in parallel.
cd ..
export OMPI_MCA_btl_vader_single_copy_mechanism=none
test_output=`mpirun -n $2 ./build/dist/ExampleSolver sample-laplace.xml | grep "L 2 error" | awk '{print ($7 < 1e-10)}'`
if [[ $EUID -eq 0 ]]; then
mpiargs="-n $2 --allow-run-as-root"
else
mpiargs="-n $2"
fi
test_output=`mpirun $mpiargs ./build/dist/ExampleSolver sample-laplace.xml | grep "L 2 error" | awk '{print ($7 < 1e-10)}'`
if [ "$test_output" -eq 1 ]; then
echo "Test passed tolerance"
exit 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment