From 364e66c22628382c0fda6acdebdc1e8345874291 Mon Sep 17 00:00:00 2001 From: tpariney Date: Thu, 25 Sep 2025 09:44:37 +0200 Subject: [PATCH 1/2] Setup CI --- .gitlab-ci.yml | 21 ++++++++++++++ settings.sh | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100644 settings.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..d546ad6 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,21 @@ +image: maven:3-openjdk-17 + +stages: + - build + +variables: + MAVEN_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository" + +cache: + paths: + # On s'assure que les dépendances Maven sont mises en cache + # pour éviter de les rapatrier à chaque lancement du pipeline + - $CI_PROJECT_DIR/.m2/repository + key: "$CI_BUILD_REF_NAME" + +build-job: + stage: build + script: + - chmod +x ./settings.sh + - ./settings.sh + - mvn clean package diff --git a/settings.sh b/settings.sh new file mode 100644 index 0000000..07e73e1 --- /dev/null +++ b/settings.sh @@ -0,0 +1,79 @@ +#!/bin/bash + +# Create the settings.xml file from a template +cat < settings.xml + + + + nexus-deptinfo + ${MAVEN_ENT_USERNAME} + ${MAVEN_ENT_PASSWORD} + + + nexus-deptinfo-snapshots + ${MAVEN_ENT_USERNAME} + ${MAVEN_ENT_PASSWORD} + + + sonar + ${MAVEN_ENT_USERNAME} + ${MAVEN_ENT_PASSWORD} + + + + + + nexus-deptinfo + * + https://disc.univ-fcomte.fr/cr700-nexus/repository/maven-public/ + + + + + org.sonarsource.scanner.maven + + + + + nexus-deptinfo-snapshots + + true + + + + nexus-deptinfo-snapshots + https://disc.univ-fcomte.fr/cr700-nexus/content/groups/public + + true + + + true + + + + + + sonar + + true + + + https://disc.univ-fcomte.fr/cr700-sonarqube + + + + +EOF + +# Move settings.xml to the .m2 directory of the runner's container +mv settings.xml /root/.m2/settings.xml + +# Create the settings-security.xml file from a template +cat < settings-security.xml + + ${MAVEN_MASTER_PASSWORD} + +EOF + +# Move settings-security.xml to the .m2 directory of the runner's container +mv settings-security.xml /root/.m2/settings-security.xml -- GitLab From 215fb64e7c58a8d85fcae30cc1de76ada0033662 Mon Sep 17 00:00:00 2001 From: tpariney Date: Thu, 25 Sep 2025 09:51:35 +0200 Subject: [PATCH 2/2] Configure CI runner and run conditions --- .gitlab-ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d546ad6..5d68ae1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,3 +19,9 @@ build-job: - chmod +x ./settings.sh - ./settings.sh - mvn clean package + tags: + - avm_groupe1 + rules: + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' + - if: $CI_COMMIT_TAG + - if: $CI_COMMIT_BRANCH == 'dev' -- GitLab