forked from ruzickap/packer-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
154 lines (128 loc) · 5.15 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# This file is a template, and might need editing before it works on your project.
# see https://docs.gitlab.com/ce/ci/yaml/README.html for all available options
variables:
GIT_SUBMODULE_STRATEGY: recursive
# BOX_VERSION: "20190608.01"
PACKER_IMAGES_OUTPUT_DIR: /var/tmp/packer-templates-images
LOGDIR: /var/tmp/packer-templates-logs
VAGRANTUP_USER: peru
PACKER_RUN_TIMEOUT: 18000
# PACKER_LOG: 1
# VAGRANT_LOG: info
before_script:
- export BOX_VERSION=${BOX_VERSION:-$(date +%Y%m%d).01}
- test -d /home/gitlab-runner/packer_cache || mkdir -v /home/gitlab-runner/packer_cache
- ln -sv /home/gitlab-runner/packer_cache packer_cache
- echo "*** ${BOX_VERSION} | $(date)"
after_script:
- rm packer_cache
- date
.job_template: &job_definition
script:
- ./build.sh ${CI_JOB_NAME}
- ./vagrant_init_destroy_boxes.sh ${PACKER_IMAGES_OUTPUT_DIR}/${CI_JOB_NAME}.box
- ./upload_box_to_vagrantup.sh ${VAGRANTUP_USER}@${PACKER_IMAGES_OUTPUT_DIR}/${CI_JOB_NAME}.box
- rm -v ${PACKER_IMAGES_OUTPUT_DIR}/${CI_JOB_NAME}.box
tags:
- packer-templates
retry: 1
# Run only when triggered by Web GUI or scheduled by GitLab
only:
- schedules
- web
stages:
- my_ubuntu-18.04-server-amd64-libvirt
- my_ubuntu-18.04-server-amd64-virtualbox
- ubuntu-16.04-server-amd64-libvirt
- ubuntu-16.04-server-amd64-virtualbox
- ubuntu-18.04-server-amd64-libvirt
- ubuntu-18.04-server-amd64-virtualbox
- ubuntu-19.04-desktop-amd64-libvirt
- ubuntu-19.04-desktop-amd64-virtualbox
- my_centos-7-x86_64-libvirt
- my_centos-7-x86_64-virtualbox
- windows-server-2019-datacenter-x64-eval-libvirt
- windows-server-2019-datacenter-x64-eval-virtualbox
- windows-server-2016-standard-x64-eval-libvirt
- windows-server-2016-standard-x64-eval-virtualbox
- windows-server-2012_r2-standard-x64-eval-libvirt
- windows-server-2012_r2-standard-x64-eval-virtualbox
- my_windows-10-enterprise-x64-eval-libvirt
- my_windows-10-enterprise-x64-eval-virtualbox
- windows-10-enterprise-x64-eval-libvirt
- windows-10-enterprise-x64-eval-virtualbox
- check_accessibility_vagrant_cloud
my_ubuntu-18.04-server-amd64-libvirt:
stage: my_ubuntu-18.04-server-amd64-libvirt
<<: *job_definition
my_ubuntu-18.04-server-amd64-virtualbox:
stage: my_ubuntu-18.04-server-amd64-virtualbox
<<: *job_definition
ubuntu-16.04-server-amd64-libvirt:
stage: ubuntu-16.04-server-amd64-libvirt
<<: *job_definition
ubuntu-16.04-server-amd64-virtualbox:
stage: ubuntu-16.04-server-amd64-virtualbox
<<: *job_definition
ubuntu-18.04-server-amd64-libvirt:
stage: ubuntu-18.04-server-amd64-libvirt
<<: *job_definition
ubuntu-18.04-server-amd64-virtualbox:
stage: ubuntu-18.04-server-amd64-virtualbox
<<: *job_definition
ubuntu-19.04-desktop-amd64-libvirt:
stage: ubuntu-19.04-desktop-amd64-libvirt
<<: *job_definition
ubuntu-19.04-desktop-amd64-virtualbox:
stage: ubuntu-19.04-desktop-amd64-virtualbox
<<: *job_definition
my_centos-7-x86_64-libvirt:
stage: my_centos-7-x86_64-libvirt
<<: *job_definition
my_centos-7-x86_64-virtualbox:
stage: my_centos-7-x86_64-virtualbox
<<: *job_definition
windows-server-2019-datacenter-x64-eval-libvirt:
stage: windows-server-2019-datacenter-x64-eval-libvirt
<<: *job_definition
windows-server-2019-datacenter-x64-eval-virtualbox:
stage: windows-server-2019-datacenter-x64-eval-virtualbox
<<: *job_definition
windows-server-2016-standard-x64-eval-libvirt:
stage: windows-server-2016-standard-x64-eval-libvirt
<<: *job_definition
windows-server-2016-standard-x64-eval-virtualbox:
stage: windows-server-2016-standard-x64-eval-virtualbox
<<: *job_definition
windows-server-2012_r2-standard-x64-eval-libvirt:
stage: windows-server-2012_r2-standard-x64-eval-libvirt
<<: *job_definition
windows-server-2012_r2-standard-x64-eval-virtualbox:
stage: windows-server-2012_r2-standard-x64-eval-virtualbox
<<: *job_definition
my_windows-10-enterprise-x64-eval-libvirt:
stage: my_windows-10-enterprise-x64-eval-libvirt
<<: *job_definition
my_windows-10-enterprise-x64-eval-virtualbox:
stage: my_windows-10-enterprise-x64-eval-virtualbox
<<: *job_definition
windows-10-enterprise-x64-eval-libvirt:
stage: windows-10-enterprise-x64-eval-libvirt
<<: *job_definition
windows-10-enterprise-x64-eval-virtualbox:
stage: windows-10-enterprise-x64-eval-virtualbox
<<: *job_definition
check_accessibility_vagrant_cloud:
stage: check_accessibility_vagrant_cloud
when: always
tags:
- packer-templates
script:
- for NAME in ubuntu-{18.10,18.04}-desktop-amd64 ubuntu-{18.04,16.04,14.04}-server-amd64 my_ubuntu-{18.04,16.04}-server-amd64 my_centos-7-x86_64 my_windows-10-enterprise-x64-eval windows-{server-{{2016,2012_r2}-standard,2019-datacenter},10-enterprise}-x64-eval; do
for VAGRANT_PROVIDER in virtualbox libvirt; do
CURRENT_VERSION=$(curl -s https://app.vagrantup.com/api/v1/box/peru/$NAME | jq -r ".current_version.version") ;
URL="https://app.vagrantup.com/peru/boxes/$NAME/versions/$CURRENT_VERSION/providers/$VAGRANT_PROVIDER.box" ;
echo "*** $URL" ;
curl -L --fail --silent --head --output /dev/null "$URL" || ( echo "* Failed... ^^^" && exit 1 )
done
done