-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci-template.gitlab-ci.yml
52 lines (51 loc) · 1.62 KB
/
ci-template.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
docs:
stage: test
trigger:
project: code0-tech/development/telescopium
branch: build-branch
strategy: depend
variables:
C0_TRIGGER_PROJECT: $CI_PROJECT_NAME
C0_TRIGGER_SHA: $CI_COMMIT_SHA
C0_TRIGGER_REF: $C0_GH_REF
docs:preview:
stage: test
image: registry.gitlab.com/gitlab-ci-utils/curl-jq:latest
needs:
- docs
script:
- >
QUERY='{
"query":"query($fullPath: ID!, $iid: ID!, $bridgeJob: String!, $downstreamJob:String!) {
project(fullPath: $fullPath) {
pipeline(iid: $iid) {
job(name: $bridgeJob) {
downstreamPipeline {
job(name: $downstreamJob) { id }
}
}
}
}
}","variables":{
"fullPath":"'"$CI_PROJECT_PATH"'",
"iid":"'"$CI_PIPELINE_IID"'",
"bridgeJob":"docs",
"downstreamJob":"build"
}
}'
- INLINED_QUERY=${QUERY//[$'\t\r\n']}
- echo $INLINED_QUERY
- >
RESPONSE=$(curl
-X POST
--data "$INLINED_QUERY"
-H 'Content-Type: application/json'
https://gitlab.com/api/graphql)
- echo $RESPONSE
- BUILD_JOB_ID=$(echo "$RESPONSE" | jq -r .data.project.pipeline.job.downstreamPipeline.job.id | awk -F '/' '{print $NF}')
- |
echo -e "\e[0Ksection_start:`date +%s`:glpa_summary\r\e[0KHeader of the summary"
echo "Documentation preview available at https://code0-tech.gitlab.io/-/development/telescopium/-/jobs/$BUILD_JOB_ID/artifacts/dist/index.html"
echo -e "\e[0Ksection_end:`date +%s`:glpa_summary\r\e[0K"
rules:
- if: $C0_GH_REF != "refs/heads/main"