build_testsuite_image.sh 1.38 KB
Newer Older
Daniel Scheffler's avatar
Daniel Scheffler committed
1
2
3
#!/usr/bin/env bash

context_dir="./context"
4
dockerfile="gms_preprocessing_ci.docker"
5
tag="gms_preprocessing_ci:0.9.1"
6
gitlab_runner="gms_preprocessing_gitlab_CI_runner"
Daniel Scheffler's avatar
Daniel Scheffler committed
7
8
9

# get sicor project # TODO move this to setup.py as soon as package is public
rm -rf context/sicor
10
git clone https://gitext.gfz-potsdam.de/EnMAP/sicor.git ./context/sicor
Daniel Scheffler's avatar
Daniel Scheffler committed
11
12
13
14
15
16
17
18
19
20
21

echo "#### Build runner docker image"
sudo docker rmi ${tag}
sudo docker build -f ${context_dir}/${dockerfile} -m 20G -t ${tag} ${context_dir}

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

22
echo "#### Register container at gitlab, get token here https://gitext.gfz-potsdam.de/geomultisens/gms_preprocessing/settings/ci_cd"
Daniel Scheffler's avatar
Daniel Scheffler committed
23
24
25
26
27
28
29
30
31
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 \
  --url 'https://gitext.gfz-potsdam.de/ci' \
  --registration-token '${token}' \
  --run-untagged=true \
  --locked=true \
32
  --tag-list  gms_preprocessing_ci_client \
Daniel Scheffler's avatar
Daniel Scheffler committed
33
34
35
  --description '${runner_name}' \
  --docker-image '${tag}' "
ls