-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
100 lines (94 loc) · 4.14 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
image: docker.uib.gmbh/opsi/dev/pybuilder:uib-python-default
stages:
- set_variables
- build_and_analyze
- sign
- make_opsiproduct
set_variables:
stage: set_variables
script:
- CONFIGED_VERSION=$(sed -n 's,.*<version>\(.*\)</version>.*,\1,p' pom.xml | head -1)
- CONFIGED_JAR_NAME="configed-${CONFIGED_VERSION}.jar"
- CONFIGED_JAR_NAME_WITH_DEPS="configed-${CONFIGED_VERSION}-jar-with-dependencies.jar"
- echo "CONFIGED_VERSION=$CONFIGED_VERSION" > version-and-jar.env
- echo "CONFIGED_JAR_NAME=$CONFIGED_JAR_NAME" >> version-and-jar.env
- echo "CONFIGED_JAR_NAME_WITH_DEPS=$CONFIGED_JAR_NAME_WITH_DEPS" >> version-and-jar.env
artifacts:
reports:
dotenv:
- version-and-jar.env
expire_in: 2 day
compile_and_package:
image: gaianmobius/openjdk-21-mvn-3.9.6
stage: build_and_analyze
script:
- TRANSIFEX_MIN_TRANSLATION_RATE=0.0
- '[ "$CI_COMMIT_TAG" = "" ] || TRANSIFEX_MIN_TRANSLATION_RATE=1.0'
- curl -o opsi-dev-tools.tar.gz "$OPSIDEVTOOLS_URL_LINUX_X64"
- tar -xvf opsi-dev-tools.tar.gz
- mv opsi-dev-tool opsi-dev-cli
- ./opsi-dev-cli -l debug transifex upload-resource src/main/resources/de/uib/messages/opsi-configed_en.properties
- ./opsi-dev-cli -l debug transifex download-translations opsi-configed.properties src/main/resources/de/uib/messages --min-translation-rate $TRANSIFEX_MIN_TRANSLATION_RATE -l de -l fr
# Unfortunately we need to build en extra jar vor mac aarch6
# Since JavaFX supports only one architecture per platform
- mvn package -Djavafx.platform=mac
- mkdir mac_x64
- mv target/$CONFIGED_JAR_NAME_WITH_DEPS mac_x64/$CONFIGED_JAR_NAME_WITH_DEPS
- mvn clean package
- jdeps --class-path target/$CONFIGED_JAR_NAME_WITH_DEPS --recursive --ignore-missing-deps --list-deps target/$CONFIGED_JAR_NAME | grep -v "java.base/sun" > target/module.deps
# jdk.crypto.ec is needed for TLS (HTTPS)
- echo " jdk.crypto.ec" >> target/module.deps
- cat target/module.deps
artifacts:
name: "configed-build"
paths:
- mac_x64/$CONFIGED_JAR_NAME_WITH_DEPS
- target/$CONFIGED_JAR_NAME_WITH_DEPS
- target/module.deps
expire_in: 2 day
needs:
- set_variables
sonarqube-check:
stage: build_and_analyze
image: gaianmobius/openjdk-21-mvn-3.9.6
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
script:
- mvn compile sonar:sonar -Dsonar.projectKey=configed
only:
- v4.4 # the name of your main branch
signandupload:
stage: sign
script:
- echo "CI_JOB_ID_CONFIGED=$CI_JOB_ID" > ci_job_id.env
- opsi-dev-tool -l info --signserver-sign target/$CONFIGED_JAR_NAME_WITH_DEPS
- mkdir opsi-configed
- mv target/$CONFIGED_JAR_NAME_WITH_DEPS target/module.deps opsi-configed/
- mkdir opsi-configed/mac_x64/
- mv mac_x64/$CONFIGED_JAR_NAME_WITH_DEPS opsi-configed/mac_x64/
- cp CHANGELOG.md opsi-configed/
- '[ "$CI_COMMIT_TAG" = "" ] && opsi-dev-tool -l info --binary-push opsi-configed configed all all $CONFIGED_VERSION "$CI_JOB_ID"'
- '[ "$CI_COMMIT_TAG" = "" ] || opsi-dev-tool -l info --binary-push opsi-configed configed all all $CONFIGED_VERSION'
needs:
- set_variables
- compile_and_package
artifacts:
reports:
dotenv:
- ci_job_id.env
expire_in: 2 day
trigger_opsiproduct_pipeline:
stage: make_opsiproduct
script:
- '[ "$CI_COMMIT_TAG" = "" ] || CONFIGED_PRERELEASE_VERSION=""'
- '[ "$CI_COMMIT_TAG" = "" ] && CONFIGED_PRERELEASE_VERSION="$CI_JOB_ID_CONFIGED"'
- curl --request POST --form "token=$CI_JOB_TOKEN" --form ref=v4.3 --form "variables[CONFIGED_PRERELEASE_VERSION]=$CONFIGED_PRERELEASE_VERSION" --form "variables[CONFIGED_VERSION]=$CONFIGED_VERSION" --form "variables[CONFIGED_JAR_NAME_WITH_DEPS]=$CONFIGED_JAR_NAME_WITH_DEPS" --form "variables[PIPELINE_COMMIT_TAG]=$CI_COMMIT_TAG" "https://gitlab.uib.gmbh/api/v4/projects/427/trigger/pipeline"
needs:
- set_variables
- compile_and_package
- signandupload