-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
49 lines (41 loc) · 1.52 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
stages:
- build
- deploy
assembly:
stage: build
image: $CI_REGISTRY/swe/gitlab-ci/sbt:1.3-2.13-jdk-8
before_script:
- if [ -z "${CI_BASE_DIR}" ]; then echo "set CI_BASE_DIR"; exit 2; fi;
- if [ -z "${CI_AWS_PROFILE}" ]; then echo "set CI_AWS_PROFILE"; exit 2; fi;
- if [ -z "${CI_AWS_TARGET}" ]; then echo "set CI_AWS_TARGET"; exit 2; fi;
- if [ -z "${CI_RESULT_FTP_PATH}" ]; then echo "set CI_RESULT_FTP_PATH";\
exit 2; fi;
script:
- sbt clean assembly
- mkdir artifacts
- mv target/scala-2.13/nro-delegated-stats.jar artifacts
- ./scripts/generate-script.sh > artifacts/nro-stats.sh
- chmod +x artifacts/nro-stats.sh
- cp ./scripts/fetch.sh artifacts
- cp ./scripts/rerun.sh artifacts
artifacts:
paths:
- artifacts
deploy:
stage: deploy
needs: ["assembly"]
image: debian:buster-backports
before_script:
- if [ -z "${SSH_TARGET}" ]; then echo "set SSH_TARGET"; exit 2; fi;
- if [ -z "${SSH_KEY}" ]; then echo "set SSH_KEY"; exit 2; fi;
- if [ -z "${SSH_KNOWN_HOSTS}" ]; then echo "set SSH_KNOWN_HOSTS"; \
exit 2; fi;
- if [ -z "${NRO_STATS_HOME}" ]; then echo "set NRO_STATS_HOME"; exit 2; fi;
- apt-get update && apt-get install docker.io openssh-client --yes
#- mkdir /root/.ssh/
#- echo "$SSH_KNOWN_HOSTS" > /root/.ssh/known_hosts
- eval "$(ssh-agent)"
- echo "$SSH_KEY" | tr -d '\r' | ssh-add -
script:
- scp -oUserKnownHostsFile="$SSH_KNOWN_HOSTS" artifacts/* "$SSH_TARGET:$NRO_STATS_HOME"
when: manual