-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
94 lines (88 loc) · 3.57 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
91
92
93
94
variables:
CONTAINER_REGISTRY: collaborating.tuhh.de:5005
CONTAINER_TEST_IMAGE: ${CONTAINER_REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_SLUG}
CONTAINER_STAGING_IMAGE: ${CONTAINER_REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}:latest
CONTAINER_STAGING_SOLR_IMAGE: ${CONTAINER_REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}:solr-latest
CONTAINER_RELEASE_IMAGE: ${CONTAINER_REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}:release
BASE_IMAGE: ${CONTAINER_REGISTRY}/itbh/tnt/digital-learning-lab/dll-docker
DOCKER_FILE_PATH: .
.before_script_template:
before_script: &before_script_definition
- cp ./docker/docker-compose.reviews ./docker/docker-compose.yml
# - docker-compose -p ${CI_PROJECT_PATH_SLUG}-${CI_ENVIRONMENT_SLUG} -f ./docker/docker-compose.yml config
- docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CONTAINER_REGISTRY}
# - docker pull ${BASE_IMAGE}
- mkdir ./dll/media
- mkdir ./dll/media/inhalte
- |
ssh-agent bash -c '
ssh-add ~/.ssh/id_rsa_dll-inhalte;
git clone -b master git@collaborating.tuhh.de:itbh/tnt/digital-learning-lab/inhalte.git ./dll/media/inhalte;
'
- ls -la ./dll/media/inhalte/UBaustein
- git -C ./dll/media/inhalte branch | cat
- rm -rf ./dll/media/inhalte/.git
stages:
# - tests
- review
- register
start_review:
stage: review
before_script: *before_script_definition
script:
# Project specific
- export SECRET_KEY=$(openssl rand -base64 12)
- export HOST_IP=$(gethostip -d $(hostname --fqdn))
- docker-compose -p ${CI_PROJECT_PATH_SLUG}-${CI_ENVIRONMENT_SLUG} -f ./docker/docker-compose.yml build --no-cache --force-rm
- docker-compose -p ${CI_PROJECT_PATH_SLUG}-${CI_ENVIRONMENT_SLUG} -f ./docker/docker-compose.yml down
- docker-compose -p ${CI_PROJECT_PATH_SLUG}-${CI_ENVIRONMENT_SLUG} -f ./docker/docker-compose.yml up -d
- mkdir -p ./_linkchecker
- echo "https://${CI_PROJECT_ID}-${CI_ENVIRONMENT_SLUG}.dll.rz.tuhh.de/"
- echo "https://${CI_PROJECT_ID}-${CI_ENVIRONMENT_SLUG}.dll.rz.tuhh.de/" >./_linkchecker/url
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
expire_in: 1 week
paths:
- ./_linkchecker
environment:
name: ${CI_COMMIT_REF_NAME}
url: https://${CI_PROJECT_ID}-${CI_ENVIRONMENT_SLUG}.dll.rz.tuhh.de/
on_stop: stop_review
only:
- branches
tags:
- floki_development
except:
- master
- /^DLL-.*$/
stop_review:
stage: review
variables:
GIT_STRATEGY: none
script:
- cp ./docker/docker-compose.reviews ./docker/docker-compose.yml
- docker-compose -p ${CI_PROJECT_PATH_SLUG}-${CI_ENVIRONMENT_SLUG} -f ./docker/docker-compose.yml down
when: manual
environment:
name: ${CI_COMMIT_REF_NAME}
action: stop
only:
- branches
tags:
- floki_development
except:
- master
register_images:
stage: register
before_script:
- docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CONTAINER_REGISTRY}
script:
- docker build --no-cache -t ${CONTAINER_STAGING_IMAGE} ${DOCKER_FILE_PATH}
- docker push ${CONTAINER_STAGING_IMAGE}
- docker build --no-cache -t ${CONTAINER_STAGING_SOLR_IMAGE} ${DOCKER_FILE_PATH} -f Dockerfile.solr
- docker push ${CONTAINER_STAGING_SOLR_IMAGE}
tags:
- floki_build
only:
- master
when: manual