This article is about how you can use Docker Container to test your codes. Which you have on GitLab |
.gitlab-ci.yml
(mind the '.' at the beginning of the file name)Prepare content for CI / CD purposes - you can use simple example below as a template
Executing script on Gateway is a little bit different than using Docker image. Please investigate carefully |
stages: - Test Docker Execution inside Docker container: stage: Test Docker tags: - Docker image: 'gitlab.eufus.psnc.pl:5050/g2michal/imas-based-docker/ual-fc2k' before_script: - module load IMAS - imasdb test - tar -xf beaver-data/data/input/input.tar.gz -C $HOME/public/imasdb/test/3/0 script: - make - ./bin/main |
The ual-fc2k is a private repository. You have to request access in order to use Docker image |
tags - The tag indicates whether the task is to be performed by HPC or Docker.
Use Docker in this example. Using HPC is described here
Please visit this page
In rare occasions it might happen you want to clone another repository from a completely different location and use it during CI/CD execution phase. You can do this by cloning repository inside Docker
container
On the left sidebar, select Settings > CI/CD
Enter variable name in the Key
field. We are using name CREDENTIALS
- in this tutorial
Enter <your_github_username>:<your_gitlab_token> as the Value
.
Remove Protect variable checkbox to use it in each tag or branch |
Mark Mask variable to protect your confidential data from others. Access token serves the purpose of password.
|
Update you .gitlab-ci.yml file to use variable with access token
stages: - Test Docker with access to external repository Execution inside Docker container: stage: Test Docker with access to external repository tags: - Docker image: 'gitlab.eufus.psnc.pl:5050/g2michal/imas-based-docker/ual-fc2k' before_script: - module load IMAS - imasdb test - git clone https://$CREDENTIALS@github.com/mkopsnc/beaver-data.git - tar -xf beaver-data/data/input/input.tar.gz -C $HOME/public/imasdb/test/3/0 script: - make - ./bin/main |
Check your CI/CD pipelines. If everything is okay, job should be successful
The scientific work is published for the realization of the international project co-financed by Polish Ministry of Science and Higher Education in 2019 from financial resources of the program entitled "PMW"; Agreement No. 5040/H2020/Euratom/2019/2
This work has been carried out within the framework of the EUROfusion Consortium and has received funding from the Euratom research and training programme 2014–2020 under grant agreement No 633053. The views and opinions expressed herein do not necessarily reflect those of the European Commission or ITER