Skip to content

Commit aa06443

Browse files
authored
fix(gitlab-ci): tweak publishing file generation (#48)
1 parent 7894d92 commit aa06443

File tree

1 file changed

+15
-42
lines changed

1 file changed

+15
-42
lines changed

.gitlab-ci.yml

Lines changed: 15 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,15 @@ include:
5151
artifact_map: artifacts.json
5252
email: ${NOTIFY_EMAIL}
5353
action: FULL
54-
nspect_id: ${NSPECT_ID}
5554
public: True
5655
needs:
5756
- job: bootstrap
5857
artifacts: true
59-
- job: assemble-artifacts
58+
- job: create-operator-json
59+
optional: true
60+
artifacts: true
61+
- job: create-agent-json
62+
optional: true
6063
artifacts: true
6164

6265
## setup vault creds
@@ -166,12 +169,11 @@ create-operator-json:
166169
artifacts: true
167170
script:
168171
- |
169-
export version="${CI_COMMIT_TAG#operator/}"
170-
cat > operator.json << EOF
172+
cat > artifacts.json << EOF
171173
{
172174
"skyhook": {
173175
"source": {
174-
"org": "nvstaging",
176+
"org": "${NGC_PRIVATE_ORG}",
175177
"team": "skyhook"
176178
},
177179
"target": {
@@ -181,16 +183,17 @@ create-operator-json:
181183
"artifacts": [
182184
{
183185
"name": "operator",
184-
"version": "${version}",
186+
"version": "${CI_COMMIT_TAG#operator/}",
185187
"type": "container"
186188
}
187-
]
189+
],
190+
"nspect_id": "${OPERATOR_NSPECT_ID}"
188191
}
189192
}
190193
EOF
191194
artifacts:
192195
paths:
193-
- operator.json
196+
- artifacts.json
194197

195198
create-agent-json:
196199
rules:
@@ -200,8 +203,7 @@ create-agent-json:
200203
artifacts: true
201204
script:
202205
- |
203-
export version="${CI_COMMIT_TAG#agent/}"
204-
cat > agent.json << EOF
206+
cat > artifacts.json << EOF
205207
{
206208
"skyhook": {
207209
"source": {
@@ -215,43 +217,14 @@ create-agent-json:
215217
"artifacts": [
216218
{
217219
"name": "agent",
218-
"version": "${version}",
220+
"version": "${CI_COMMIT_TAG#agent/}",
219221
"type": "container"
220222
}
221-
]
223+
],
224+
"nspect_id": "${AGENT_NSPECT_ID}"
222225
}
223226
}
224227
EOF
225-
artifacts:
226-
paths:
227-
- agent.json
228-
229-
assemble-artifacts:
230-
needs:
231-
- job: create-operator-json
232-
optional: true
233-
artifacts: true
234-
- job: create-agent-json
235-
optional: true
236-
artifacts: true
237-
rules:
238-
- if: '$CI_COMMIT_TAG =~ /^(operator|agent)\/v\d+\.\d+\.\d+$/'
239-
before_script:
240-
- apt update
241-
- apt install -y jq
242-
script:
243-
- |
244-
if [ -f operator.json ] && [ -f agent.json ]; then
245-
# Merge both JSON files
246-
jq -s '.[0].skyhook.artifacts += .[1].skyhook.artifacts | .[0]' operator.json agent.json > artifacts.json
247-
elif [ -f operator.json ]; then
248-
cp operator.json artifacts.json
249-
elif [ -f agent.json ]; then
250-
cp agent.json artifacts.json
251-
else
252-
echo "No JSON files found"
253-
exit 1
254-
fi
255228
artifacts:
256229
paths:
257230
- artifacts.json

0 commit comments

Comments
 (0)