-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
68 lines (59 loc) · 2.42 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
variables:
CI_DEBUG_SERVICES: "true"
before_script:
- apk update
- apk --no-cache add py3-pip python3 curl
- python3 -m venv $HOME/.venv
- export PATH=$HOME/.venv/bin:$PATH
- python3 -m pip install pyyaml awscli
- curl -O https://raw.githubusercontent.com/FredHutch/swarm-build-helper/main/build_helper.py
# below is from https://stackoverflow.com/a/65810302/470769
- mkdir -p $HOME/.docker
- echo $DOCKER_AUTH_CONFIG > $HOME/.docker/config.json
- set -x
stages:
- build
- test
- deploy
build:
stage: build
image: docker:19.03.12
services:
- name: docker:19.03.12-dind
command: ["--storage-driver=overlay2"]
script:
- aws s3 cp s3://fh-pi-meshinchi-s-eco-public/Shiny_App/data/ ./data --recursive
- docker info
- docker build -t sc-registry.fredhutch.org/target-data-viz-${CI_COMMIT_BRANCH}:test .
- docker push sc-registry.fredhutch.org/target-data-viz-${CI_COMMIT_BRANCH}:test
test:
stage: test
services:
- name: sc-registry.fredhutch.org/target-data-viz-${CI_COMMIT_BRANCH}:test
alias: target-data-viz
script:
- sleep 60 && curl -sI http://target-data-viz:3838 |head -1|grep -q "200 OK"
deploy_preview:
stage: deploy
only:
refs:
- dev
script:
- docker tag sc-registry.fredhutch.org/target-data-viz-${CI_COMMIT_BRANCH}:test sc-registry.fredhutch.org/target-data-viz-preview:latest
- docker push sc-registry.fredhutch.org/target-data-viz-preview:latest
- sleep 15
- echo $SC_SWARM_CICD_SSH_KEY | base64 -d > ./sc_swarm_cicd_ssh_key
- chmod 0400 ./sc_swarm_cicd_ssh_key
- python3 build_helper.py docker-compose-preview.yml | ssh -i ./sc_swarm_cicd_ssh_key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@sc-swarm-mgr.fhcrc.org docker stack deploy --with-registry-auth -c - target-data-viz-preview
deploy:
stage: deploy
only:
refs:
- master
script:
- docker tag sc-registry.fredhutch.org/target-data-viz-${CI_COMMIT_BRANCH}:test sc-registry.fredhutch.org/target-data-viz:latest
- docker push sc-registry.fredhutch.org/target-data-viz:latest
- sleep 15
- echo $SC_SWARM_CICD_SSH_KEY | base64 -d > ./sc_swarm_cicd_ssh_key
- chmod 0400 ./sc_swarm_cicd_ssh_key
- python3 build_helper.py docker-compose.yml | ssh -i ./sc_swarm_cicd_ssh_key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@sc-swarm-mgr.fhcrc.org docker stack deploy --with-registry-auth -c - target-data-viz