-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
60 lines (53 loc) · 1.53 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
image: flowm/mbed-cli
variables:
REPO_NAME: "gitlab.lrz.de/move-on/move-on_helium_sensors"
DEPLOY_HOST: "192.168.152.10"
DEPLOY_PORT: "40106"
DEPLOY_USER: "deploy"
DEPLOY_TARGET: "${DEPLOY_USER}@${DEPLOY_HOST}"
before_script:
- cd $CI_PROJECT_DIR
# SSH Agent for deploy
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan -p ${DEPLOY_PORT} ${DEPLOY_HOST} >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- git submodule sync --recursive
- git submodule update --init --recursive
stages:
- build
# - deploy
build:
stage: build
script:
- cd src
- make clean
- make artifacts
cache:
paths:
- mbed-os/
artifacts:
name: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA:0:8}"
expire_in: 4 week
paths:
- artifacts/
except:
- rpi
# Deploy disabled
.deploy-sens:
stage: deploy
script:
- scp -P ${DEPLOY_PORT} artifacts/move-on_helium_sensors.hex ${DEPLOY_TARGET}:move-on_helium_sensors.hex
- ssh -p ${DEPLOY_PORT} ${DEPLOY_TARGET} "st-flash --format ihex write move-on_helium_sensors.hex"
- timeout --preserve-status --foreground 30 ssh -p ${DEPLOY_PORT} ${DEPLOY_TARGET} "reset-nucleo && mqttserial" || true
except:
- rpi
# Deploy disabled
.deploy-rpi:
stage: deploy
script:
- ssh -p ${DEPLOY_PORT} ${DEPLOY_TARGET} "cd /opt/move-on_helium/SEN/ && git fetch && git reset --hard origin/rpi && tools/grafana/daemon/ser2mqtt/setup.sh"
only:
- rpi