-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.jobserv.yml
83 lines (74 loc) · 2.21 KB
/
.jobserv.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
timeout: 10
triggers:
- name: merge-request
type: github_pr
runs:
- name: unit-test
container: python:3.6-alpine
host-tag: amd64
script: unit-test
- name: flake8
container: python:3.6-alpine
host-tag: amd64
script: flake8
- name: build-container
type: git_poller
params:
GIT_URL: "https://github.com/foundriesio/jobserv.git"
GIT_POLL_REFS: "refs/heads/master"
runs:
- name: build-container
container: docker:dind
privileged: true
host-tag: amd64
script: build-container
# This run is just handy for demonstration purposes as documented in the
# tutorial
- name: post-merge
type: git_poller
params:
GIT_URL: "https://github.com/foundriesio/jobserv.git"
GIT_POLL_REFS: "refs/heads/master"
runs:
- name: flake8
container: python:3.5-alpine
host-tag: amd64
script: flake8
scripts:
flake8: |
#!/bin/sh -ex
pip3 install flake8 flake8-junit-report==2.1.0
flake8 --ignore=E722 --exclude=migrations/ ./ | tee flake8.txt
flake8_junit flake8.txt /archive/junit.xml
unit-test: |
#!/bin/sh -ex
apk --no-cache add git python3-dev musl-dev gcc openssl libffi-dev openssl-dev
git config --global user.email "[email protected]"
git config --global user.name "cibot"
./unit-test.sh
build-container: |
#!/bin/sh -e
TAG=${GIT_SHA:0:6}
/usr/local/bin/dockerd-entrypoint.sh --raw-logs >$archive/dockerd.log 2>&1 &
for i in `seq 10` ; do
sleep 1
docker info >/dev/null 2>&1 && break
if [ $i = 10 ] ; then
echo 'Timed out trying to connect to internal docker host.' >&2
exit 1
fi
done
set -x
docker build -t doanac/jobserv:$TAG --force-rm .
docker tag doanac/jobserv:$TAG doanac/jobserv:latest
if [ -f /secrets/dockerpass ] ; then
set +x
token=$(cat /secrets/dockerpass)
mkdir -p $HOME/.docker
docker login --username=doanac --password=$token
set -x
docker push doanac/jobserv:$TAG
docker push doanac/jobserv:latest
else
echo "dockerpass not provided, skipping publishing step"
fi