-
-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathconfig.yml
More file actions
105 lines (104 loc) · 3.1 KB
/
config.yml
File metadata and controls
105 lines (104 loc) · 3.1 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
workflows:
version: 2.1
build_test_deploy:
jobs:
- test
- publish_latest:
context: docker-hub
requires:
- test
filters:
branches:
only:
- master
- build_children:
context: circle-api
requires:
- publish_latest
monthly:
triggers:
- schedule:
cron: "0 0 1 * *"
filters:
branches:
only:
- master
jobs:
- test
- publish_latest:
context: docker-hub
requires:
- test
filters:
branches:
only:
- master
- build_children:
context: circle-api
requires:
- publish_latest
version: 2.1
executors:
testbuild-executor:
machine:
image: default
jobs:
test:
executor: testbuild-executor
steps:
- checkout
- run:
name: Install goss
command: |
# rather than give internet scripts SU rights, we install to local user bin and add to path
[ -d ~/bin ] || mkdir ~/bin
export GOSS_DST=~/bin
export PATH=$PATH:~/bin
curl -fsSL https://goss.rocks/install | sh
goss -version
- run:
name: Test
command: |
# Don't forget path!
export PATH=$PATH:~/bin
./run-tests.sh --circleci --keepimage
- run:
name: Save docker image
command: |
[ -d workspace ] || mkdir workspace
docker save -o workspace/lancachenet-ubuntu.tar lancachenet/ubuntu:goss-test
#Download from Artifacts and Load this into your own docker using the following command
#docker load -i /tmp/workspace/lancachenet-ubuntu.tar
- store_test_results:
path: reports/goss/report.xml
- store_artifacts:
path: reports
destination: reports
- store_artifacts:
path: workspace/lancachenet-ubuntu.tar
destination: docker-lancachenet-ubuntu.tar
- persist_to_workspace:
root: workspace
paths: lancachenet-ubuntu.tar
publish_latest:
executor: testbuild-executor
steps:
- attach_workspace:
at: /tmp/workspace
- run:
name: "Deploy latest to docker hub"
command: |
docker load -i /tmp/workspace/lancachenet-ubuntu.tar
docker login -u $DOCKER_USER -p $DOCKER_PASS
docker tag lancachenet/ubuntu:goss-test lancachenet/ubuntu:latest
docker push lancachenet/ubuntu:latest
build_children:
executor: testbuild-executor
steps:
- run:
name: "Request API to build children"
command: |
for child in {"ubuntu-nginx","lancache-dns"}; do
echo "Asking API to trigger build for $child"
curl -X POST --header "Content-Type: application/json" -d '{"branch":"master"}' https://circleci.com/api/v1.1/project/github/lancachenet/$child/build?circle-token=${CIRCLE_API_USER_TOKEN}
done