Commit c44f8302 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Updated CI setupfiles, environment_enpt_enmapboxapp.yml and .gitlab-ci.yml.


Signed-off-by: Daniel Scheffler's avatarDaniel Scheffler <danschef@gfz-potsdam.de>
parent f71735bb
......@@ -43,14 +43,13 @@ test_enpt_enmapboxapp_install:
stage: test
script:
- source /root/miniconda3/bin/activate
- conda update conda
- conda install conda-build
- conda create -y -q --name enpt_enmapboxapp_test python=3
- source activate enpt_enmapboxapp_test
# update conda and python
- conda update -n base -c defaults conda
# - conda update -c conda-forge python
- conda update -n base -c conda-forge conda
# - conda update -c conda-forge python
- conda create -y -q --name enpt_enmapboxapp_test python=3
- source activate enpt_enmapboxapp_test
# install enpt
- pip install -e .
......
......@@ -6,26 +6,48 @@ tag="enpt_enmapboxapp_ci:0.1.4"
gitlab_runner="enpt_enmapboxapp_gitlab_CI_runner"
echo "#### Build runner docker image"
sudo docker rmi ${tag}
sudo docker build -f ${context_dir}/${dockerfile} -m 20G -t ${tag} ${context_dir}
# sudo docker build -f ./context/enpt_enmapboxapp_ci.docker -m 20G -t enpt_enmapboxapp_ci:0.7.0 ./context --no-cache
docker rmi ${tag}
docker build ${context_dir} \
--no-cache \
-f ${context_dir}/${dockerfile} \
-m 20G \
-t ${tag}
# create the gitlab-runner docker container for the current project
# NOTE: The 'gitlab-runner' and 'gitlab-ci-multi-runner' services will run within this container.
# The runner uses a 'config.toml' configuration file at /etc/gitlab-runner within the container which can be
# modified through additional parameters of the 'gitlab-runner register' command.
echo "#### Create gitlab-runner (daemon) container with tag; ${tag}"
sudo docker stop ${gitlab_runner}
sudo docker rm ${gitlab_runner}
sudo docker run -d --name ${gitlab_runner} --restart always \
-v /var/run/docker.sock:/var/run/docker.sock gitlab/gitlab-runner:latest
docker stop ${gitlab_runner}
docker rm ${gitlab_runner}
docker run \
-d \
--name ${gitlab_runner} \
--restart always \
-v /var/run/docker.sock:/var/run/docker.sock \
gitlab/gitlab-runner:latest
# register the runner at the corresponding GitLab repository via a registration-token
echo "#### Register container at gitlab, get token here https://gitext.gfz-potsdam.de/EnMAP/GFZ_Tools_EnMAP_BOX/enpt_enmapboxapp/settings/ci_cd"
read -p "Please enter gitlab token: " token
echo ""
read -p "Please enter gitlab runner name: " runner_name
echo "New gitlab runner image will named ${gitlab_runner}"
sudo docker exec -it ${gitlab_runner} /bin/bash -c "export RUNNER_EXECUTOR=docker && gitlab-ci-multi-runner register -n \
# NOTE: In case of locally stored images (like here), the docker pull policy 'never' must be used
# (see https://docs.gitlab.com/runner/executors/docker.html#how-pull-policies-work).
docker exec -it ${gitlab_runner} /bin/bash -c "\
export RUNNER_EXECUTOR=docker && \
gitlab-ci-multi-runner register \
--non-interactive \
--executor 'docker' \
--docker-image '${tag}' \
--url 'https://gitext.gfz-potsdam.de/ci' \
--registration-token '${token}' \
--run-untagged=true \
--locked=true \
--tag-list enpt_enmapboxapp_client \
--description '${runner_name}' \
--docker-image '${tag}' "
--tag-list enpt_enmapboxapp_ci_client \
--run-untagged='true' \
--locked='true' \
--access-level='not_protected' \
--docker-pull-policy='never'
"
ls
FROM gms_base_centos:0.3
FROM ci_base_centos:0.1
# copy some needed stuff to /root
COPY *.yml /root/
......@@ -7,5 +7,6 @@ COPY *.yml /root/
# -> also include packages for conda deployment and upload
RUN /bin/bash -i -c "\
source /root/miniconda3/bin/activate ; \
conda update -n base -c conda-forge conda;\
source activate ci_env; \
conda env update -n ci_env -f /root/environment_enpt_enmapboxapp.yml"
name: enpt_enmapboxapp
channels: &id1
- conda-forge
dependencies:
- python=3.*.*
- pip # avoids that conda uses the wrong pip
......
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