-
Notifications
You must be signed in to change notification settings - Fork 11
/
.gitlab-ci.yml
198 lines (186 loc) · 5.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
include:
- project: 'to-be-continuous/docker'
ref: '5.11.0'
file: '/templates/gitlab-ci-docker.yml'
variables:
BUILD_FOR_INSTALLER: "true"
MAVEN_DEPLOY_ARGS: deploy
MAVEN_CLI_OPTS: $MAVEN_CLI_OPTS -U -q
MAVEN_OPTS: >-
-Dhttps.protocols=TLSv1.2
-Dmaven.repo.local=${MAVEN_CFG_DIR}/repository
-Dorg.slf4j.simpleLogger.showDateTime=true
-Djava.awt.headless=true
-Dnetbeans.verify.integrity=false
# -Dmaven.test.skip=true
DOCKER_REGISTRY_MIRROR: docker.snap-ci.ovh
DOCKER_REGISTRY_USER: $NEXUS_USER
DOCKER_REGISTRY_PASSWORD: $NEXUS_PASSWORD
DOCKER_FILE: "docker/build/Dockerfile"
DOCKER_CONTEXT_PATH: "${CI_PROJECT_DIR}"
DOCKER_SNAPSHOT_IMAGE: "$NEXUS_URL/$CI_PROJECT_NAME:12.0.0-snapshot"
DOCKER_RELEASE_IMAGE: "$NEXUS_URL/$CI_PROJECT_NAME:12.0.0"
DOCKER_TRIVY_ARGS: "--ignore-unfixed --vuln-type os --debug --timeout 15m"
DOCKER_TRIVY_SECURITY_LEVEL_THRESHOLD: CRITICAL
DOCKER_BUILD_ARGS: "--cache=true --compressed-caching=false --use-new-run --cleanup --build-arg LICENSE=${INSTALL4J_LICENSE} --build-arg=UPLOAD_URL --build-arg=NEXUS_USER --build-arg=NEXUS_PASS --target=unix"
DOCKER_HADOLINT_ARGS: --failure-threshold error
DOCKER_PROD_PUBLISH_STRATEGY: auto
DOCKER_BUILD_CACHE_DISABLED: "true"
COMPILE_BRANCH: master
# RECOMPILE: "true"
RECOMPILE:
description: When other projects should be recompiled or if artifacts are already safe to get from COMPILE_BRANCH
value: "true"
options:
- "true"
- "false"
stages:
- compile
- build
- package-build
- package-test
- publish
- gpt-tests
# Compile other projects first to get freshly built artifacts
.compile:
stage: compile
rules:
- if: $RECOMPILE == "true"
when: always
- if: $RECOMPILE == "false"
when: never
- if: $BRANCH
variables:
COMPILE_BRANCH: $BRANCH
- if: $CI_COMMIT_TAG
variables:
COMPILE_BRANCH: $CI_COMMIT_TAG
compile-snap-engine:
extends: .compile
trigger:
project: senbox-org/snap-engine
branch: $COMPILE_BRANCH
strategy: depend
# Trigger child pipelines to get mvn-build artifacts available (optional, but needed when they have expired)
compile:
extends: .compile
trigger:
project: $PROJECT
branch: $COMPILE_BRANCH
strategy: depend
parallel:
matrix:
- PROJECT: senbox-org/snap-desktop
- PROJECT: senbox-org/microwave-toolbox
- PROJECT: senbox-org/optical-toolbox
- PROJECT: senbox-org/smos-box
needs:
- job: compile-snap-engine
# Fetch artifacts built at compile stage
build:
stage: build
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
variables:
MAVEN_CLI_OPTS: >-
--no-transfer-progress
--batch-mode
--errors
--fail-at-end
--show-version
-DdeployAtEnd=false
-Denable.long.tests=true
when: on_success
- if: $BRANCH
variables:
COMPILE_BRANCH: $BRANCH
when: on_success
- if: $RECOMPILE == "false"
when: always
- when: on_success
needs:
- job: compile
optional: true
- project: senbox-org/snap-engine
job: mvn-build
ref: $COMPILE_BRANCH
artifacts: true
- project: senbox-org/snap-desktop
job: mvn-build
ref: $COMPILE_BRANCH
artifacts: true
- project: senbox-org/microwave-toolbox
job: mvn-build
ref: $COMPILE_BRANCH
artifacts: true
- project: senbox-org/optical-toolbox
job: mvn-build
ref: $COMPILE_BRANCH
artifacts: true
- project: senbox-org/smos-box
job: mvn-build
ref: $COMPILE_BRANCH
artifacts: true
script: echo build-snap
artifacts:
expire_in: 2 hours
paths:
- LICENSE.html
- etc
- "${CI_PROJECT_DIR}/snap-application/target"
- "${CI_PROJECT_DIR}/snap-main/target"
- "${CI_PROJECT_DIR}/snap-smart-configurator-ui/src/main/resources/org/esa/snap/smart/configurator/ui/Performance32.png"
- "${CI_PROJECT_DIR}/microwavetbx-kit/target/netbeans_clusters/microwavetbx"
- "${CI_PROJECT_DIR}/microwavetbx-kit/target/netbeans_clusters/rstb"
- "${CI_PROJECT_DIR}/opttbx-kit/target/netbeans_clusters/opttbx"
- "${CI_PROJECT_DIR}/smos-kit/target/netbeans_clusters"
# Before building the image we need other projects artifacts
docker-kaniko-build:
needs:
- job: build
artifacts: true
# Triggers 3 GPT tests pipelines (linux,windows,macos)
gpt-tests:
stage: gpt-tests
trigger:
project: senbox-org/snap-gpt-tests
branch: $COMPILE_BRANCH
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
inherit:
variables: false
variables:
SCOPE: daily
parallel:
matrix:
- PLATFORM: [linux,windows,darwin]
allow_failure: true
# Report on Github cf https://ecp-ci.gitlab.io/docs/guides/build-status-gitlab.html
.report-status:
image: curlimages/curl
variables:
URL: "https://api.github.com/repos/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}/statuses/${CI_COMMIT_SHA}"
STATUS_NAME: snap-ci
script:
# For complete details on the GitHub API please see:
# https://docs.github.com/en/rest/commits/statuses?apiVersion=2022-11-28#create-a-commit-status
- |-
curl -X POST $URL -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" -d '{"state": "'$CI_JOB_NAME'", "context": "'$STATUS_NAME'", "target_url": "'$CI_PIPELINE_URL'", "description": "Build snap docker image"}'
environment:
name: reporting-github
dependencies: []
retry: 2
pending:
stage: .pre
extends:
- .report-status
success:
stage: .post
extends:
- .report-status
failure:
stage: .post
extends:
- .report-status
rules:
- when: on_failure