forked from RedhawkSDR/VITA49
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
216 lines (198 loc) · 6.62 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
variables:
rh_20_release: '2-0-8'
rh_22_release: '2-2-0'
namespace: rh.
stages:
- build
- test
- deploy
- trigger
.package: &package
image: ${docker_registry}${docker_rpm_repository}docker:latest-rpm
stage: build
tags:
- ca
- docker
before_script:
- safe_version=$(echo ${short_version} | tr -d -)
- safe_ref=$(echo ${CI_COMMIT_REF_NAME} | tr -d /| tr '[:upper:]' '[:lower:]')
- if [ -z "$CI_COMMIT_TAG" ]; then
redhawk_version=${latest_version}
rpm_release="0.$CI_PIPELINE_ID.rh${safe_version}";
else
redhawk_version=${release_version}
rpm_release="`rpm --query --queryformat "%{release}\n" --specfile ${namespace}$CI_PROJECT_NAME.spec | head -n 1 | awk -F"." "{print $1}"`.rh${safe_version}";
fi
- redhawk_repo=$s3_repo_url/redhawk/cf-and-deps/yum/$redhawk_version/$dist/$arch
script:
- printf "FROM ${docker_registry}${rpmbuild_repository}rpmbuild:$dist-$arch-onbuild" > Dockerfile
- docker login ${docker_registry} -u ${docker_user} -p ${docker_password}
- docker image build --pull
--tag=$CI_PROJECT_PATH_SLUG-$safe_ref-$dist-$arch-rh${safe_version}
--build-arg "project=$CI_PROJECT_NAME"
--build-arg "rpm_release=$rpm_release"
--build-arg "spec_file=${namespace}$CI_PROJECT_NAME.spec"
--build-arg "arch=$arch"
--build-arg "other_repos=$redhawk_repo" .
- id=$(docker container create $CI_PROJECT_PATH_SLUG-$safe_ref-$dist-$arch-rh${safe_version})
- docker container cp $id:/root/rpmbuild/RPMS/ output/
- docker container rm -f $id || true
- docker image rm -f $CI_PROJECT_PATH_SLUG-$safe_ref-$dist-$arch-rh${safe_version} || true
artifacts:
paths:
- output/*/*.rpm
expire_in: 2 days
except:
- master
- /^.*-external$/
- /^(\d+\.)?(\d+)?(\.\d+)$/
package:el6:rh2.0:
variables:
latest_version: 2.0-nightly
release_version: $rh_20_release
short_version: '2.0'
dist: el6
arch: x86_64
<<: *package
package:el6-i386:rh2.0:
variables:
latest_version: 2.0-nightly
release_version: $rh_20_release
short_version: '2.0'
dist: el6
arch: i686
<<: *package
package:el7:rh2.0:
variables:
latest_version: 2.0-nightly
release_version: $rh_20_release
short_version: '2.0'
dist: el7
arch: x86_64
<<: *package
package:el6:rh2.2:
variables:
latest_version: 2.2-nightly
release_version: $rh_22_release
short_version: '2.2'
dist: el6
arch: x86_64
<<: *package
package:el6-i386:rh2.2:
variables:
latest_version: 2.2-nightly
release_version: $rh_22_release
short_version: '2.2'
dist: el6
arch: i686
<<: *package
package:el7:rh2.2:
variables:
latest_version: 2.2-nightly
release_version: $rh_22_release
short_version: '2.2'
dist: el7
arch: x86_64
<<: *package
.s3: &s3
image: ${docker_registry}utils/s3cmd:el6-createrepo
stage: deploy
tags:
- s3
script:
- /usr/bin/s3cmd sync s3://$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/yum/$CI_COMMIT_REF_SLUG/rh${short_version}/$dist/$arch .
- mkdir -p $arch
- for file in `find output -name *.rpm`; do
cp $file $arch;
done
- repomanage --keep=2 --old $arch| xargs rm -f; createrepo --update $arch
- /usr/bin/s3cmd sync -F -v --delete-removed $arch s3://$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/yum/$CI_COMMIT_REF_SLUG/rh${short_version}/$dist/ && s3cmd setacl -v s3://$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/yum/$CI_COMMIT_REF_SLUG/rh${short_version}/$dist --acl-public --recursive || true
deploy-el7-2.2:
variables:
dist: el7
arch: x86_64
short_version: '2.2'
dependencies:
- package:el7:rh2.2
<<: *s3
deploy-el7-2.0:
variables:
dist: el7
arch: x86_64
short_version: '2.0'
dependencies:
- package:el7:rh2.0
<<: *s3
deploy-el6-2.2:
variables:
dist: el6
arch: x86_64
short_version: '2.2'
dependencies:
- package:el6:rh2.2
<<: *s3
deploy-el6-2.0:
variables:
dist: el6
arch: x86_64
short_version: '2.0'
dependencies:
- package:el6:rh2.0
<<: *s3
deploy-el6-i386-2.2:
variables:
dist: el6
arch: i686
short_version: '2.2'
dependencies:
- package:el6-i386:rh2.2
<<: *s3
deploy-el6-i386-2.0:
variables:
dist: el6
arch: i686
short_version: '2.0'
dependencies:
- package:el6-i386:rh2.0
<<: *s3
deploy:
image: ${docker_registry}centos:7
stage: deploy
dependencies: []
script:
- if [ -n "$jenkins_url" ]; then
echo "Deploying to $jenkins_url/job/$CI_PROJECT_NAMESPACE/job/$CI_PROJECT_NAME-$CI_COMMIT_REF_NAME"
curl --insecure -X POST $jenkins_url/job/$CI_PROJECT_NAMESPACE/job/$CI_PROJECT_NAME-$CI_COMMIT_REF_NAME/buildWithParameters?pipeline_id=$CI_PIPELINE_ID --user $jenkins_user:$jenkins_api_token;
fi
except:
- master
- /^.*-external$/
- /^(\d+\.)?(\d+)?(\.\d+)$/
abi-check:
image: ${docker_registry}redhawk/buildenv:2.2-el7
stage: test
dependencies:
- package:el7:rh2.2
variables:
last_release: '4.0.0-2'
script:
- curl -fsSL $yum_repo_url/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/$last_release/rh2.2/el7/x86_64/$namespace$CI_PROJECT_NAME-$last_release.rh2.2.el7.centos.x86_64.rpm > $namespace$CI_PROJECT_NAME-$last_release.rh2.2.el7.centos.x86_64.rpm
- curl -fsSL $yum_repo_url/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/$last_release/rh2.2/el7/x86_64/$namespace$CI_PROJECT_NAME-debuginfo-$last_release.rh2.2.el7.centos.x86_64.rpm > $namespace$CI_PROJECT_NAME-debuginfo-$last_release.rh2.2.el7.centos.x86_64.rpm
- curl -fsSL $yum_repo_url/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/$last_release/rh2.2/el7/x86_64/$namespace$CI_PROJECT_NAME-devel-$last_release.rh2.2.el7.centos.x86_64.rpm > $namespace$CI_PROJECT_NAME-devel-$last_release.rh2.2.el7.centos.x86_64.rpm
- abipkgdiff --verbose
--debug-info-pkg1 $namespace$CI_PROJECT_NAME-debuginfo-$last_release.rh2.2.el7.centos.x86_64.rpm
--debug-info-pkg2 output/x86_64/$namespace$CI_PROJECT_NAME-debuginfo*.rpm
--devel-pkg1 $namespace$CI_PROJECT_NAME-devel-$last_release.rh2.2.el7.centos.x86_64.rpm
--devel-pkg2 output/x86_64/$namespace$CI_PROJECT_NAME-devel*.rpm
$namespace$CI_PROJECT_NAME-$last_release.rh2.2.el7.centos.x86_64.rpm
output/x86_64/$namespace$CI_PROJECT_NAME-5*.rpm
allow_failure: true
trigger:
image: ${docker_registry}${trigger_repo}trigger:latest
stage: trigger
dependencies: []
script:
- gitlab-ci-trigger --file ${dependencies_url}
only:
- branches
allow_failure: true