forked from rubo77/freifunk-gluon-site
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
86 lines (80 loc) · 2.71 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
variables:
GIT_SUBMODULE_STRATEGY: recursive
GIT_SSL_CAPATH: /etc/ssl/certs/
CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/build
GLUON_GIT: https://github.com/freifunk-gluon/gluon.git/
GLUON_BRANCH: v2020.2.x
DEPRECATED: upgrade
# set to '' or 'BROKEN=1'
BROKEN: 'BROKEN=1'
# set to '', 'V=s' or 'V=s BUILD_LOG=1'
VERBOSE: ''
cache:
key: $CI_COMMIT_REF_SLUG-$GLUON_GIT-$GLUON_BRANCH
paths:
- gluon
stages:
- prepare
- build
- upload
# Preparation
prepare:
stage: prepare
image: docker:latest
services:
- docker:dind
script:
- docker info
- docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY
- docker pull $CONTAINER_IMAGE:latest || true
- docker build --cache-from $CONTAINER_IMAGE:latest -t $CONTAINER_IMAGE:$CI_COMMIT_SHA -t $CONTAINER_IMAGE:latest .gitlab-ci/build-container
- docker push $CONTAINER_IMAGE:$CI_COMMIT_SHA
- docker push $CONTAINER_IMAGE:latest
cache: {}
# Actual building
build:
stage: build
image: $CI_REGISTRY_IMAGE/build
script:
- export FORCE_UNSAFE_CONFIGURE=1
# set make options to max number of cores or -j1 if verbose is set
- if [ -n "$VERBOSE" ]; then MAKEOPTS="-j 1 $VERBOSE"; else MAKEOPTS="-j $(nproc --all)"; fi
- MAKEOPTS="$MAKEOPTS $BROKEN GLUON_DEPRECATED=$DEPRECATED"
- 'echo Build options: "$MAKEOPTS"'
# former clone step
- ./.gitlab-ci/update-git.sh 2>&1 | tee -a debug.log
- ./.gitlab-ci/build.sh -c update -b rc -a stable -n $CI_PIPELINE_ID -m "-j $(nproc --all) $BROKEN" 2>&1 | tee -a debug.log
# We should never need this, should we?
- ./.gitlab-ci/build.sh -c clean -b rc -a stable -n $CI_PIPELINE_ID -m "-j $(nproc --all)" 2>&1 | tee -a debug.log
# Apply patches
- ./.gitlab-ci/patch.sh patches gluon
# Build
- ./.gitlab-ci/build.sh -c build -b rc -a stable -n $CI_PIPELINE_ID -m "-j $(nproc --all) $BROKEN" 2>&1 | tee -a debug.log
# Revert patches
- ./.gitlab-ci/patch.sh -r patches gluon
# Bring gluon repo to cacheable state
- ./.gitlab-ci/build.sh -c clean -b rc -a stable -n $CI_PIPELINE_ID -m "-j $(nproc --all) $BROKEN" 2>&1 | tee -a debug.log
# Sign
- echo $SIGNING_KEY > signing_key
- ./.gitlab-ci/build.sh -c sign -b rc -a stable -s $(pwd)/signing_key
artifacts:
untracked: false
paths:
- debug.*
- output
- gluon/openwrt/logs/*
expire_in: 3 days
when: always
dependencies: []
upload:
stage: upload
image: $CI_REGISTRY_IMAGE/build
script:
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_KEY")
# create fake gluon dir to satisfy build script
- mkdir -p gluon
- ./.gitlab-ci/build.sh -c upload -b $CI_COMMIT_REF_NAME -n $CI_PIPELINE_ID
dependencies:
- build
cache: {}