forked from dogtagpki/pki
-
Notifications
You must be signed in to change notification settings - Fork 1
/
azure-pipelines.yml
229 lines (200 loc) · 7.6 KB
/
azure-pipelines.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
217
218
219
220
221
222
223
224
225
226
227
228
229
jobs:
- job: BuildTest
pool:
vmImage: ubuntu-latest
steps:
- script: |
docker build \
--target pki-base \
--tag pki-base:latest \
.
docker run \
--name=runner \
-v $BUILD_SOURCESDIRECTORY:/root/src \
--privileged \
--detach \
pki-base:latest
while :
do
docker exec runner echo "Runner is ready" && break
echo "Waiting for runner..."
sleep 1
[ $((++i)) -ge 10 ] && exit 1
done
displayName: Create runner container
- script: |
docker exec runner dnf install -y dnf-plugins-core rpm-build maven
docker exec runner dnf copr enable -y @pki/master
docker exec runner dnf builddep -y --spec /root/src/pki.spec
displayName: Install PKI dependencies
- script: |
docker exec runner \
/root/src/build.sh -v rpm
displayName: Build PKI RPM packages
- script: |
# find RPM packages (excluding debug packages)
docker exec runner \
ls /root/build/pki/RPMS | grep -v debuginfo | grep -v debugsource | tee output
RPMS=$(cat output)
# get list of files in each RPM package
for rpm in $RPMS
do
docker exec runner \
rpm -qlp "/root/build/pki/RPMS/$rpm" | tee -a files
done
# exclude RPM-specific files
sed -i \
-e '/^\/usr\/share\/licenses\//d' \
-e '/^\/usr\/share\/man\//d' \
-e '/^\/usr\/share\/doc\//d' \
-e '/^\/usr\/lib\/.build-id\//d' \
-e '/__pycache__/d' \
files
displayName: Get list of files from RPM packages
- script: |
# get Python <major>.<minor> version
docker exec runner python3 --version | tee output
VERSION=$(sed 's/Python \([0-9]\+\.[0-9]\+\)\..*/\1/' output)
docker exec runner \
/root/src/build.sh \
--work-dir=/root/build \
--python-dir=/usr/lib/python$VERSION/site-packages \
dist
displayName: Build PKI with CMake
- script: |
docker exec runner \
mvn install:install-file \
-f /root/src \
-Dfile=/usr/lib/java/jss.jar \
-DgroupId=org.dogtagpki.jss \
-DartifactId=jss-base \
-Dversion=5.4.0-SNAPSHOT \
-Dpackaging=jar \
-DgeneratePom=true
displayName: Install JSS into Maven repo
- script: |
docker exec runner \
mvn install:install-file \
-f /root/src \
-Dfile=/usr/share/java/tomcatjss.jar \
-DgroupId=org.dogtagpki.tomcatjss \
-DartifactId=tomcatjss-tomcat-9.0 \
-Dversion=8.4.0-SNAPSHOT \
-Dpackaging=jar \
-DgeneratePom=true
displayName: Install Tomcat JSS into Maven repo
- script: |
docker exec runner \
mvn install:install-file \
-f /root/src \
-Dfile=/usr/share/java/ldapjdk.jar \
-DgroupId=org.dogtagpki.ldap-sdk \
-DartifactId=ldapjdk \
-Dversion=5.4.0-SNAPSHOT \
-Dpackaging=jar \
-DgeneratePom=true
displayName: Install LDAP JDK into Maven repo
- script: |
docker exec runner \
mvn package \
-f /root/src \
-DskipTests
displayName: Build PKI with Maven
- script: |
docker exec runner \
jar tvf /root/build/dist/pki-common.jar | awk '{print $8;}' | grep -v '/$' | sort | tee cmake.out
docker exec runner \
jar tvf /root/src/base/common/target/pki-common.jar | awk '{print $8;}' | grep -v -E '^META-INF/maven/|/$' | sort > maven.out
diff cmake.out maven.out
displayName: Compare pki-common.jar
- script: |
docker exec runner \
jar tvf /root/build/dist/pki-tools.jar | awk '{print $8;}' | grep -v '/$' | sort | tee cmake.out
docker exec runner \
jar tvf /root/src/base/tools/target/pki-tools.jar | awk '{print $8;}' | grep -v -E '^META-INF/maven/|/$' | sort > maven.out
diff cmake.out maven.out
displayName: Compare pki-tools.jar
- script: |
docker exec runner \
jar tvf /root/build/dist/pki-ca.jar | awk '{print $8;}' | grep -v '/$' | sort | tee cmake.out
docker exec runner \
jar tvf /root/src/base/ca/target/pki-ca.jar | awk '{print $8;}' | grep -v -E '^META-INF/maven/|/$' | sort > maven.out
diff cmake.out maven.out
displayName: Compare pki-ca.jar
- script: |
docker exec runner \
jar tvf /root/build/dist/pki-kra.jar | awk '{print $8;}' | grep -v '/$' | sort | tee cmake.out
docker exec runner \
jar tvf /root/src/base/kra/target/pki-kra.jar | awk '{print $8;}' | grep -v -E '^META-INF/maven/|/$' | sort > maven.out
diff cmake.out maven.out
displayName: Compare pki-kra.jar
- script: |
docker exec runner \
jar tvf /root/build/dist/pki-ocsp.jar | awk '{print $8;}' | grep -v '/$' | sort | tee cmake.out
docker exec runner \
jar tvf /root/src/base/ocsp/target/pki-ocsp.jar | awk '{print $8;}' | grep -v -E '^META-INF/maven/|/$' | sort > maven.out
diff cmake.out maven.out
displayName: Compare pki-ocsp.jar
- script: |
docker exec runner \
jar tvf /root/build/dist/pki-tks.jar | awk '{print $8;}' | grep -v '/$' | sort | tee cmake.out
docker exec runner \
jar tvf /root/src/base/tks/target/pki-tks.jar | awk '{print $8;}' | grep -v -E '^META-INF/maven/|/$' | sort > maven.out
diff cmake.out maven.out
displayName: Compare pki-tks.jar
- script: |
docker exec runner \
jar tvf /root/build/dist/pki-tps.jar | awk '{print $8;}' | grep -v '/$' | sort | tee cmake.out
docker exec runner \
jar tvf /root/src/base/tps/target/pki-tps.jar | awk '{print $8;}' | grep -v -E '^META-INF/maven/|/$' | sort > maven.out
diff cmake.out maven.out
displayName: Compare pki-tps.jar
- script: |
docker exec runner \
jar tvf /root/build/dist/pki-acme.jar | awk '{print $8;}' | grep -v '/$' | sort | tee cmake.out
docker exec runner \
jar tvf /root/src/base/acme/target/pki-acme.jar | awk '{print $8;}' | grep -v -E '^META-INF/maven/|/$' | sort > maven.out
diff cmake.out maven.out
displayName: Compare pki-acme.jar
- script: |
docker exec runner \
/root/src/build.sh \
--work-dir=/root/build \
install
displayName: Install PKI with CMake
- script: |
readarray -t files < files
docker exec runner ls -ld "${files[@]}"
displayName: Compare CMake and RPM files
- script: |
# generate CSR
docker exec runner \
pki nss-cert-request \
--key-type RSA \
--subject "CN=Certificate Authority" \
--ext /usr/share/pki/server/certs/ca_signing.conf \
--csr ca_signing.csr
# issue self-signed cert
docker exec runner \
pki nss-cert-issue \
--csr ca_signing.csr \
--ext /usr/share/pki/server/certs/ca_signing.conf \
--cert ca_signing.crt
# import cert
docker exec runner \
pki nss-cert-import \
--cert ca_signing.crt \
--trust CT,C,C \
ca_signing
# display cert
docker exec runner \
pki nss-cert-show ca_signing
displayName: Test PKI CLI
- script: |
docker exec runner dnf install -y tomcat
docker exec runner pki-server create tomcat@pki
docker exec runner pki-server start tomcat@pki --wait
docker exec runner pki-server status tomcat@pki
docker exec runner pki-server stop tomcat@pki --wait
docker exec runner pki-server remove tomcat@pki
displayName: Test PKI Server CLI