Commit 36f4d209 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

First setup of CI runner.

parent f6564702
Pipeline #214 canceled with stages
before_script:
- git lfs pull
test_py_tools_ds:
script:
- source /root/anaconda3/bin/activate
- export GDAL_DATA=/root/anaconda3/share/gdal
- export PYTHONPATH=$PYTHONPATH:/root # /root <- directory needed later
- make coverage
- make docs
artifacts:
paths:
- htmlcov/
- docs/_build/html/
pages:
stage: deploy
dependencies:
- test_py_tools_ds
script:
- mkdir -p public/coverage
- cp -r htmlcov/* public/coverage/
- mkdir -p public/doc
- cp -r docs/_build/html/* public/doc/
artifacts:
paths:
- public
expire_in: 30 days
only:
- master
#!/usr/bin/env bash
context_dir="./context"
dockerfile="py_tools_ds_ci.docker"
tag="py_tools_ds_ci:latest"
gitlab_runner="danschef_gitlab_CI_runner"
# get py_tools_ds project # TODO move this to setup.py as soon as package is public
rm -rf context/py_tools_ds
git clone https://gitext.gfz-potsdam.de/danschef/py_tools_ds.git ./context/py_tools_ds
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
echo "#### Register container at gitlab, get token here https://gitext.gfz-potsdam.de/danschef/py_tools_ds/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 \
--url 'https://gitext.gfz-potsdam.de/ci' \
--registration-token '${token}' \
--run-untagged=true \
--locked=true \
--tag-list py_tools_ds_ci_client \
--description '${runner_name}' \
--docker-image '${tag}' "
ls
FROM centos:7
RUN yum update -y && \
yum install -y wget vim bzip2 gcc gcc-c++ make libgl1-mesa-glx mesa-libGL qt5-qtbase-gui git # TODO
ENV anaconda_dl 'Anaconda3-4.3.1-Linux-x86_64.sh'
RUN /bin/bash -i -c "cd /root; wget https://repo.continuum.io/archive/$anaconda_dl ; \
bash -i /root/$anaconda_dl -b ; \
rm -f /root/$anaconda_dl"
# 'conda install --yes -c conda-forge 'icu=58.*' lxml' fixing a bug for conda-forge gdal build, as of 06/2017
RUN /bin/bash -i -c "source /root/anaconda3/bin/activate ; \
conda install --yes pyqt coverage ; \
conda install --yes -c conda-forge gdal ; \
conda install --yes -c conda-forge 'icu=58.*' lxml ; \
conda install --yes -c conda-forge glymur pygrib rasterio pyproj cachetools ; \
pip install shapely geopandas dicttoxml jsmin cerberus pyprind pint iso8601 tqdm mpld3 sphinx-argparse"
# copy some needed stuff to /root
#COPY *.pkl /root/ # EXAMPLE
#COPY *.h5 /root/ # EXAMPLE
# copy geoarray code to /tmp # TODO move this to setup.py as soon as package is public
COPY geoarray /tmp/geoarray
# install git lfs
RUN /bin/bash -i -c "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.rpm.sh | bash"
# installing git large file support, see here: https://git-lfs.github.com/ , change version number below for future upgrades
ENV git_lfs_v='2.1.1'
RUN /bin/bash -i -c "wget https://github.com/git-lfs/git-lfs/releases/download/v${git_lfs_v}/git-lfs-linux-amd64-${git_lfs_v}.tar.gz; \
tar -zxvf git-lfs-linux-amd64-${git_lfs_v}.tar.gz; \
cd git-lfs-${git_lfs_v}; \
bash ./install.sh"
# set matplotlib backend to Agg as default, Qt won't work in headless docker containers
RUN bash -i -c 'source /root/anaconda3/bin/activate; \
sed -i "/backend : tkagg/c\backend : Agg" $(python -c "import matplotlib; print(matplotlib.matplotlib_fname())"); \
sed -i "/backend : Qt4Agg/c\backend : Agg" $(python -c "import matplotlib; print(matplotlib.matplotlib_fname())"); \
sed -i "/backend : qt5agg/c\backend : Agg" $(python -c "import matplotlib; print(matplotlib.matplotlib_fname())")'
RUN bash -i -c "source /root/anaconda3/bin/activate; \ # TODO move this to setup.py as soon as package is public
cd /tmp/geoarray/; python setup.py install;"
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