forked from openshift/ansible-service-broker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathansible-service-broker.spec
514 lines (458 loc) · 21.1 KB
/
ansible-service-broker.spec
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
%if 0%{?fedora} || 0%{?rhel} >= 6
%global with_devel 1
# TODO: package new deps
%global with_bundled 0
%global with_debug 0
%global with_check 0
%global with_unit_test 0
%else
%global with_devel 0
%global with_bundled 0
%global with_debug 0
%global with_check 0
%global with_unit_test 0
%endif
%if 0%{?with_debug}
%global _dwz_low_mem_die_limit 0
%else
%global debug_package %{nil}
%endif
%global provider github
%global provider_tld com
%global project openshift
%global repo ansible-service-broker
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
%global import_path %{provider_prefix}
%if 0%{?copr}
%define build_timestamp .%(date +"%Y%m%d%H%M%%S")
%else
%define build_timestamp %{nil}
%endif
%define selinux_variants targeted
%define moduletype apps
%define modulename ansible-service-broker
Name: %{repo}
Version: 1.0.3
Release: 1%{build_timestamp}%{?dist}
Summary: Ansible Service Broker
License: ASL 2.0
URL: https://%{provider_prefix}
Source0: %{name}-%{version}.tar.gz
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
#ExclusiveArch: %%{?go_arches:%%{go_arches}}%%{!?go_arches:%%{ix86} x86_64 %{arm}}
ExclusiveArch: %{ix86} x86_64 %{arm} aarch64 ppc64le %{mips} s390x
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
Requires(pre): shadow-utils
Requires: %{name}-selinux
BuildRequires: device-mapper-devel
BuildRequires: btrfs-progs-devel
%if ! 0%{?with_bundled}
%endif
%description
%{summary}
%package container-scripts
Summary: scripts required for running ansible-service-broker in a container
BuildArch: noarch
%description container-scripts
containers scripts for ansible-service-broker
%package selinux
Summary: selinux policy module for %{name}
BuildRequires: checkpolicy, selinux-policy-devel, hardlink, policycoreutils
BuildRequires: /usr/bin/pod2man
Requires(post): /usr/sbin/semodule, /sbin/restorecon, /usr/sbin/setsebool, /usr/sbin/selinuxenabled, /usr/sbin/semanage
Requires(post): policycoreutils-python
Requires(post): selinux-policy-targeted
Requires(postun): /usr/sbin/semodule, /sbin/restorecon
BuildArch: noarch
%description selinux
selinux policy module for %{name}
%post selinux
for selinuxvariant in %{selinux_variants}
do
/usr/sbin/semodule -s ${selinuxvariant} -i \
%{_datadir}/selinux/${selinuxvariant}/%{modulename}.pp.bz2 > /dev/null
done
%postun selinux
if [ $1 -eq 0 ] ; then
for selinuxvariant in %{selinux_variants}
do
/usr/sbin/semodule -s ${selinuxvariant} -r %{modulename} > /dev/null
done
fi
%pre
getent group ansibleservicebroker || groupadd -r ansibleservicebroker
getent passwd ansibleservicebroker || \
useradd -r -g ansibleservicebroker -d /var/lib/ansibleservicebroker -s /sbin/nologin \
ansibleservicebroker
exit 0
%post
%systemd_post %{name}.service
%postun
%systemd_postun
%if 0%{?with_devel}
%package devel
Summary: %{summary}
BuildArch: noarch
Requires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
Requires: device-mapper-devel
Requires: btrfs-progs-devel
%description devel
devel for %{name}
%{import_path} prefix.
%endif
%if 0%{?with_unit_test} && 0%{?with_devel}
%package unit-test
Summary: Unit tests for %{name} package
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
%if 0%{?with_check}
#Here comes all BuildRequires: PACKAGE the unit tests
#in %%check section need for running
%endif
# test subpackage tests code from devel subpackage
Requires: %{name}-devel = %{version}-%{release}
%description unit-test
unit-test for %{name}
%endif
%prep
%setup -q -n %{repo}-%{version}
ln -sf vendor src
mkdir -p src/github.com/openshift/ansible-service-broker
cp -r pkg src/github.com/openshift/ansible-service-broker
%build
export GOPATH=$(pwd):%{gopath}
go build -tags "seccomp selinux" -ldflags "-s -w" ./cmd/broker
#Build selinux modules
# create selinux-friendly version from VR and replace it inplace
perl -i -pe 'BEGIN { $VER = join ".", grep /^\d+$/, split /\./, "%{version}.%{release}"; } s!\@\@VERSION\@\@!$VER!g;' extras/%{modulename}.te
%if 0%{?rhel} >= 6
distver=rhel%{rhel}
%endif
%if 0%{?fedora} >= 18
distver=fedora%{fedora}
%endif
for selinuxvariant in %{selinux_variants}
do
pushd extras
make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile DISTRO=${distver}
bzip2 -9 %{modulename}.pp
mv %{modulename}.pp.bz2 %{modulename}.ppbz2.${selinuxvariant}
make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile clean DISTRO=${distver}
popd
done
rm -rf src
%install
install -d -p %{buildroot}%{_bindir}
install -p -m 755 broker %{buildroot}%{_bindir}/asbd
install -p -m 755 build/entrypoint.sh %{buildroot}%{_bindir}/entrypoint.sh
install -d -p %{buildroot}%{_sysconfdir}/%{name}
install -p -m 644 etc/example-config.yaml %{buildroot}%{_sysconfdir}/%{name}/config.yaml
install -d -p %{buildroot}%{_libexecdir}/%{name}
cp -r scripts/* %{buildroot}%{_libexecdir}/%{name}
install -d -p %{buildroot}%{_unitdir}
install -p extras/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
install -d -p %{buildroot}%{_var}/log/%{name}
touch %{buildroot}%{_var}/log/%{name}/asb.log
# install selinux policy modules
for selinuxvariant in %{selinux_variants}
do
install -d %{buildroot}%{_datadir}/selinux/${selinuxvariant}
install -p -m 644 extras/%{modulename}.ppbz2.${selinuxvariant} \
%{buildroot}%{_datadir}/selinux/${selinuxvariant}/%{modulename}.pp.bz2
done
# install interfaces
install -d %{buildroot}%{_datadir}/selinux/devel/include/%{moduletype}
install -p -m 644 extras/%{modulename}.if %{buildroot}%{_datadir}/selinux/devel/include/%{moduletype}/%{modulename}.if
# hardlink identical policy module packages together
/usr/sbin/hardlink -cv %{buildroot}%{_datadir}/selinux
# source codes for building projects
%if 0%{?with_devel}
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
# find all *.go but no *_test.go files and generate devel.file-list
for file in $(find . -iname "*.go" \! -iname "*_test.go" | grep -v "^./Godeps") ; do
echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
done
for file in $(find . -iname "*.proto" | grep -v "^./Godeps") ; do
echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
done
%endif
# testing files for this project
%if 0%{?with_unit_test} && 0%{?with_devel}
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
# find all *_test.go files and generate unit-test.file-list
for file in $(find . -iname "*_test.go" | grep -v "^./Godeps"); do
echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test.file-list
done
%endif
%if 0%{?with_devel}
sort -u -o devel.file-list devel.file-list
%endif
%check
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
%if ! 0%{?with_bundled}
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
%else
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath}
%endif
%if ! 0%{?gotest:1}
%global gotest go test
%endif
# FAIL: TestFactoryNewTmpfs (0.00s), factory_linux_test.go:59: operation not permitted
#%%gotest %%{import_path}/libcontainer
%gotest %{import_path}/libcontainer/cgroups
# --- FAIL: TestInvalidCgroupPath (0.00s)
# apply_raw_test.go:16: couldn't get cgroup root: mountpoint for cgroup not found
# apply_raw_test.go:25: couldn't get cgroup data: mountpoint for cgroup not found
#%%gotest %%{import_path}/libcontainer/cgroups/fs
%gotest %{import_path}/libcontainer/configs
%gotest %{import_path}/libcontainer/devices
# undefined reference to `nsexec'
#%%gotest %%{import_path}/libcontainer/integration
%gotest %{import_path}/libcontainer/label
# Unable to create tstEth link: operation not permitted
#%%gotest %%{import_path}/libcontainer/netlink
# undefined reference to `nsexec'
#%%gotest %%{import_path}/libcontainer/nsenter
%gotest %{import_path}/libcontainer/selinux
%gotest %{import_path}/libcontainer/stacktrace
#constant 2147483648 overflows int
#%%gotest %%{import_path}/libcontainer/user
#%%gotest %%{import_path}/libcontainer/utils
#%%gotest %%{import_path}/libcontainer/xattr
%endif
#define license tag if not already defined
%{!?_licensedir:%global license %doc}
%files
%license LICENSE
%{_bindir}/asbd
%attr(750, ansibleservicebroker, ansibleservicebroker) %dir %{_sysconfdir}/%{name}
%attr(640, ansibleservicebroker, ansibleservicebroker) %config %{_sysconfdir}/%{name}/config.yaml
%{_unitdir}/%{name}.service
%{_libexecdir}/%{name}
%attr(750, ansibleservicebroker, ansibleservicebroker) %dir %{_var}/log/%{name}
%attr(640, ansibleservicebroker, ansibleservicebroker) %{_var}/log/%{name}/asb.log
%files container-scripts
%{_bindir}/entrypoint.sh
%files selinux
%attr(0600,root,root) %{_datadir}/selinux/*/%{modulename}.pp.bz2
%{_datadir}/selinux/devel/include/%{moduletype}/%{modulename}.if
%if 0%{?with_devel}
%files devel -f devel.file-list
%license LICENSE
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
%dir %{gopath}/src/%{import_path}
%endif
%if 0%{?with_unit_test} && 0%{?with_devel}
%files unit-test -f unit-test.file-list
%license LICENSE
%endif
%changelog
* Tue Aug 29 2017 Jason Montleon <[email protected]> 1.0.3-1
- 399 - APB Sandbox Role should be configurable (#403)
- 82 - add copyright headers to each file (#402) ([email protected])
- delete line (#406) ([email protected])
- make comments consistent '// ' (#405) ([email protected])
- ignore the broker only at the root (#404) ([email protected])
- 377 - The service name returned by asb is invalid (#380)
- Improve CONTRIBUTING guide (#389) ([email protected])
- add unbind and deprovision checks (#384) ([email protected])
- Add proposal for logging changes (#381) ([email protected])
- Fixed duplicate parameter after group. (#398) ([email protected])
- Fix spelling in logs (#397) ([email protected])
* Thu Aug 24 2017 Jason Montleon <[email protected]> 1.0.2-1
- Reduce broker/apb sandbox permissions (#393) ([email protected])
- Added UI form information to metadata fields for parsing by OpenShift (#386)
- adding broker build to build of image. (#396) ([email protected])
- Updates first-pass proposal (#368) ([email protected])
- Update Dockerfile names (#382) ([email protected])
- Allow dockerhub credentials to be specified as env variables without being
written directly in the script (#392) ([email protected])
- Label APBs with their FQNames (#390) ([email protected])
- Added documentation update for openshift registry (#383)
- Form metadata proposal. (#376) ([email protected])
- Move the client calls to the runtime pkg (#362) ([email protected])
* Fri Aug 18 2017 Jason Montleon <[email protected]> 1.0.1-1
- rename Dockerfiles to reflect the tags being used for (#375)
- bearer token proposal (#373) ([email protected])
- Use origin-ansible-service-broker docker image (#371)
- Point doc readers to subscribe to mailing list (#374)
- Update version to the release instead of RC (#370) ([email protected])
- Allow PUBLIC_IP to be overridden without editing the script (#369)
- Allow specifying a tag for apbs (#357) ([email protected])
- Improve user facing documentation for broker (#367) ([email protected])
- document auth configuration (#363) ([email protected])
- Update Copr Releasers (#365) ([email protected])
- move specs to proposals (#366) ([email protected])
- Update ssl doc (#361) ([email protected])
- Spell check docs (#364) ([email protected])
- Fix rebase mistake (#360) ([email protected])
- Prevent CI failures when building the broker (#348) ([email protected])
- Adding documentation for ssl and tls with openshift. (#359)
- Work Topics and Deprovision Fixes (#358) ([email protected])
- Give make more targets for the project (#350) ([email protected])
- Fixed a few typos in docs (#356) ([email protected])
- Add basic auth switch (default off) to run_latest_build.sh (#355)
- Add local etcd support for local env (#354) ([email protected])
- Match template registry name (#353) ([email protected])
- Add an insecure option to the openshift template (#334) ([email protected])
- Allow the local broker to run in insecure mode (#346) ([email protected])
- Spec: Kubernetes and COE agnostic support (#329) ([email protected])
- Added openshift registry adapter (#280) ([email protected])
- Explicitly use project name for ASB secrets (#349) ([email protected])
- Handle err when generating Dockerhub token (#339) ([email protected])
- Improve CI logging (#344) ([email protected])
- Retry pod preset check instead of sleeping (#343) ([email protected])
- Updated deployment template to use string substitution when applicable (#340)
- Accept ints from exported credentials (#337) ([email protected])
- Update AddApb to use FQNames (#336) ([email protected])
- Adding ability to pass credentials to bind and unbind actions. (#302)
- remove trailing slash (#332) ([email protected])
- Introduce authentication to the broker (#308) ([email protected])
- Move travis to using make ci (#331) ([email protected])
- Configurable refresh interval of Broker updating specs (#326)
- Run the CI test locally (#317) ([email protected])
- updating handler to use FormValue call to retrieve data from query param
(#327) ([email protected])
- fusor test will now print out details on the actual file that caused the
issue. (#328) ([email protected])
- Zero param fix (#325) ([email protected])
- readme formatting (#323) ([email protected])
- Fix the plan name in broker ci object (#321) ([email protected])
- get both tls.key AND tls.crt not two tls.keys (#316) ([email protected])
- Multi-plan support (#298) ([email protected])
- reformat the comments to be readable. (#315) ([email protected])
- Contributing doc (#313) ([email protected])
- Add a PR and Issues template (#314) ([email protected])
- The broker now has two container in a single pod (#310) ([email protected])
- Create a spec template (#312) ([email protected])
- Remove bogus selinux requires in rpm spec (#311) ([email protected])
- Update local scripts to run etcd with a local broker (#309)
- [Proposal]: New Bind and Unbind Workflow (#293) ([email protected])
- Change deployment to deploymentconfig in prep script (#307)
- Broker CI with Travis (#291) ([email protected])
- Added deployment config to broker template (#304) ([email protected])
- Remove usage of jq dependency (#305) ([email protected])
- Update the broker-ci spec to include jenkins and travis (#292)
- 1468173- Error out when bootstrap fails (#301)
- [Proposal] Plan support (#294) ([email protected])
- Increase bind timeout to 2 hours (#284) ([email protected])
- Added a minimal run_latest_build.sh with instructions (#296)
- Updated template default values (#295) ([email protected])
- Improve the broker bind output by using error returned from RunCommand (#276)
- Document Image Tags in the README (#282) ([email protected])
- add tls files to really-clean (#290) ([email protected])
- Update my_local_dev_vars.example (#289) ([email protected])
- HTTPS for asb route (#281) ([email protected])
- Broker CI spec (#277) ([email protected])
- Filtering documentation (#279) ([email protected])
- Downgrade ext_cred retry logs to Info (#278) ([email protected])
- Asbcli bind (#262) ([email protected])
- White/Black List Filtering and Multiple Registries Refactor (#271)
- 1470860 - Remove broker project creation (#275) ([email protected])
- SPEC: broker authentication spec (#260) ([email protected])
- Fix lint problems (#272) ([email protected])
- Broker bind output rework (#124) ([email protected])
- 1467852 - add ENV HOME to Dockerfile#263) (#268) ([email protected])
- Add bootstrap_on_startup feature (#267) ([email protected])
- Only print out error messages only once (#266) ([email protected])
- 1467905 - Added error handling for images with improper APB Spec (#259)
- technical debt: make scripts run from anywhere (#252) ([email protected])
- 201 - remove ProjectRoot (#255) ([email protected])
- Fix typos found by goreportcard. (#254) ([email protected])
- Adding go report card and updating a go vet problem (#253)
- remove unused template file (#251) ([email protected])
- Configurable, external broker auth support (#249) ([email protected])
- techdebt: fix Makefile deploy (#250) ([email protected])
- Add IMAGE_PULL_POLICY to broker template (#247) ([email protected])
- With a newer Etcd, we can use the GetVersion function (#223)
- Fixes BZ#1466031 add Accept header with application/json to RHCC get (#243)
(#246) ([email protected])
- Make the ImagePullPolicy Configurable (#237) ([email protected])
- Only Extract the Credentials once (#242) ([email protected])
- Automated builds from Dockerhub (#240) ([email protected])
- Refactor apb/client contents (#238) ([email protected])
- Makefile technical debt (#239) ([email protected])
- Asbcli was using the wrong var name in bind (#241) ([email protected])
- Golint fixes (#225) ([email protected])
- removing go-dockerclient (#232) ([email protected])
- Breakup all the Broker Clients into a clients pkg (#222)
- remove mockregistry (#236) ([email protected])
- techdebt: speed up builds (#234) ([email protected])
- Cleanup local pod split (#208) ([email protected])
- Remove refresh login function (#197) ([email protected])
- * adding ability for development brokers to delete specs (#209)
- remove trailing whitespace (#226) ([email protected])
- removing unnecessary function that just add's indirection. (#200)
- bump version, prepare for GA work (#224) ([email protected])
* Thu Jun 22 2017 jesus m. rodriguez <[email protected]> 0.9.4-1
- 1463798 - Fix stale APBs present in ASB after bootstrap (#221) ([email protected])
- use the correct source name in the rpm spec (#220) ([email protected])
* Thu Jun 22 2017 jesus m. rodriguez <[email protected]> 0.9.3-1
- Fixing builds and standardize on a config file name (#218) ([email protected])
- strip makefile whitespace (#210) ([email protected])
* Wed Jun 21 2017 jesus m. rodriguez <[email protected]> 0.9.2-1
- use a different source url for copr (#216) ([email protected])
- Expect a config file to be mounted (#211) ([email protected])
* Wed Jun 21 2017 jesus m. rodriguez <[email protected]> 0.9.1-1
- new package built with tito ([email protected])
- bump version ([email protected])
- add version template to keep in sync with tito (#212) ([email protected])
- Prepare repo for use with tito (#204) ([email protected])
- Starting point for running broker local to simulate InCluster (#192) ([email protected])
- Check for empty spec dir when querying for catalog. (#195) ([email protected])
- Packaging fix for #171 (#191) ([email protected])
- Recover jobs when broker restarted (#131) ([email protected])
- implement deprovision (#172) ([email protected])
- Run as arbitrary user (#146) ([email protected])
- add selinux policy and update rpm spec to build the sub package (#160) ([email protected])
- Updated to create/use service account for broker (#165) ([email protected])
- Add namespace parameter from service context. (#161) ([email protected])
- Add parameter schema support (#156) ([email protected])
- Fix the APB repo url. (#163) ([email protected])
- Deprovison spec compliance (#117) ([email protected])
- log in with serviceaccount certs and token (#154) ([email protected])
- Add Endpoint for ABP Tool to push Specs (#152) ([email protected])
- fixing bug where we attempt to deference nil parameters. (#149) ([email protected])
- Get all images (#132) ([email protected])
- better facilitate automate copr and manual brew builds (#145) ([email protected])
- Added new registry adapter for RHCC (#135) ([email protected])
- Remove jq since PR#121 merged (#141) ([email protected])
- Rename fusor to openshift (#133) ([email protected])
- Replace get_images_from_org (#121) ([email protected])
- Kubernetes client object (#115) ([email protected])