-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
90 lines (80 loc) · 3.37 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
image: docker:git
variables:
GIT_LFS_SKIP_SMUDGE: 1 # Avoid fetching the files from LFS when doing git fetch
TMPDIR: "${CI_PROJECT_DIR}.tmp"
MOUNT_POINT: /builds/$CI_PROJECT_PATH/mnt
services:
- docker:dind
stages:
- build
- deploy
before_script:
- 'echo "New job started"'
- 'echo "Project name: $CI_PROJECT_NAME."'
- 'echo "Commit ref: $CI_COMMIT_REF_NAME."'
# inspired from https://molecule.readthedocs.io/en/latest/ci.html
- apk add --no-cache python3 python3-dev
trial_docker:
stage: build
tags:
- docker
script:
- 'echo "${MOUNT_POINT}"'
- mkdir -p "$MOUNT_POINT"
- chmod a+rw $MOUNT_POINT
- docker login ${ARTIFACT_DOCKER_URL} -u ${ARTIFACT_CI_USER} -p ${ARTIFACT_CI_TOKEN}
- docker pull ${ARTIFACT_DOCKER_URL}/${CI_PROJECT_NAME}:master
# - docker run --rm -v /builds/eurobench/pi_csic/tests/data/input:/in -v "${MOUNT_POINT}:/out" ${ARTIFACT_DOCKER_URL}/${CI_PROJECT_NAME}:master ./run_pi /in/subject_10_trial_01.csv /in/subject_10_anthropometry.yaml /out
- docker build . -t ${ARTIFACT_DOCKER_URL}/${CI_PROJECT_NAME}:master
- wget -O test_docker_call.py https://raw.githubusercontent.com/eurobench/docker_test/master/test_docker_call.py
- export DOCKER_IMAGE='${ARTIFACT_DOCKER_URL}/${CI_PROJECT_NAME}:master'
- export TEST_PLAN='tests/test_plan.xml'
- export OUT_FOLDER="${MOUNT_POINT}"
- python3 test_docker_call.py
except:
- master
deploy_image:
stage: deploy
tags:
- docker
script:
- 'echo "${MOUNT_POINT}"'
- mkdir -p "$MOUNT_POINT"
- ls -la
- chmod a+rw $MOUNT_POINT
- 'echo "mounting point attempt: $MOUNT_POINT"'
- ls -la
- docker login ${ARTIFACT_DOCKER_URL} -u ${ARTIFACT_CI_USER} -p ${ARTIFACT_CI_TOKEN}
- docker pull ${ARTIFACT_DOCKER_URL}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_NAME}
# - docker run --rm -v /builds/eurobench/pi_csic/tests/data/input:/in -v "${MOUNT_POINT}:/out" ${ARTIFACT_DOCKER_URL}/${CI_PROJECT_NAME}:master ./run_pi /in/subject_10_trial_01.csv /in/subject_10_anthropometry.yaml /out
- docker build . -t ${ARTIFACT_DOCKER_URL}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_NAME}
- wget -O test_docker_call.py https://raw.githubusercontent.com/eurobench/docker_test/master/test_docker_call.py
- export DOCKER_IMAGE='${ARTIFACT_DOCKER_URL}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_NAME}'
- export TEST_PLAN='tests/test_plan.xml'
- export OUT_FOLDER="${MOUNT_POINT}"
- python3 test_docker_call.py
- docker push ${ARTIFACT_DOCKER_URL}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_NAME}
only:
- master
# gen_docker:
# stage: build
# tags:
# - docker
# script:
# - 'echo "name: $CI_PROJECT_NAME:$CI_COMMIT_REF_NAME"'
# - 'echo "artifactory url: $ARTIFACT_DOCKER_URL"'
# - docker build . -t ${ARTIFACT_DOCKER_URL}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_NAME}
# - export DOCKER_IMAGE='${ARTIFACT_DOCKER_URL}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_NAME}'
# - export TEST_PLAN='test_data/test_plan.xml'
# - python3 test_docker_call.py
# test_docker:
# stage: test
# script:
# - DOCKER_IMAGE=${ARTIFACT_DOCKER_URL}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_NAME} python3 tests/test_docker_call.py
# deploy_docker:
# stage: deploy
# script:
# #- docker save -o pi_csic_docker_image.tar pi_csic_docker_image
# - docker login ${ARTIFACT_DOCKER_URL} -u ${ARTIFACT_CI_USER} -p ${ARTIFACT_CI_TOKEN}
after_script:
- echo "Job finished, well done"