From b934e977a8949f966d0fb28cd785abc95c50954c Mon Sep 17 00:00:00 2001 From: Christian Kollmann Date: Fri, 30 Oct 2020 09:51:14 +0100 Subject: Add CI pipeline --- .gitlab-ci.yml | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .gitlab-ci.yml (limited to '.gitlab-ci.yml') diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..2d0e2687 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,68 @@ +image: maven:latest + +variables: + LC_ALL: "en_US.UTF-8" + LANG: "en_US.UTF-8" + LANGUAGE: "en_US" + LIB_NAME: "eaaf-components" + MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true --settings .cisettings.xml" + MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=${CI_PROJECT_DIR}/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true" + GIT_SUBMODULE_STRATEGY: recursive + GIT_DEPTH: "2" + SECURE_LOG_LEVEL: "debug" + +include: + - template: Dependency-Scanning.gitlab-ci.yml + - template: Security/SAST.gitlab-ci.yml + - template: Secret-Detection.gitlab-ci.yml + +stages: + - assemble + - test + - package + - release + +cache: + paths: + - ".m2/repository" + +assemble: + stage: assemble + except: + - tags + script: | + mvn $MAVEN_CLI_OPTS compile test + artifacts: + when: always + reports: + junit: "target/surefire-reports/TEST-*.xml" + +publishToGitlab: + stage: package + except: + - tags + script: | + export VERSION=$(mvn -B help:evaluate -Dexpression=project.version -B | grep -v "\[INFO\]" | grep -Po "\d+\.\d+\.\d+((-\w*)+)?") + echo "Publishing version $VERSION for $LIB_NAME" + mvnw $MAVEN_CLI_OPTS deploy -s .cisettings.xml -P gitlabDeploy + echo "VERSION=$VERSION" >> variables.env + artifacts: + when: always + reports: + dotenv: variables.env + +release: + stage: release + image: registry.gitlab.com/gitlab-org/release-cli:latest + needs: + - job: publishToGitlab + artifacts: true + when: manual + only: + - master + script: | + echo "Releasing version $VERSION of $LIB_NAME" + release: + name: "$VERSION" + tag_name: "v$VERSION" + description: "$(cat README.md)" -- cgit v1.2.3 From 4fff33e9d658ca458c31394767a92f5f6599a643 Mon Sep 17 00:00:00 2001 From: Christian Kollmann Date: Fri, 30 Oct 2020 10:45:38 +0100 Subject: CI: Fix typo --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to '.gitlab-ci.yml') diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2d0e2687..4fbd5459 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,7 @@ variables: LANG: "en_US.UTF-8" LANGUAGE: "en_US" LIB_NAME: "eaaf-components" - MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true --settings .cisettings.xml" + MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true" MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=${CI_PROJECT_DIR}/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true" GIT_SUBMODULE_STRATEGY: recursive GIT_DEPTH: "2" @@ -44,7 +44,7 @@ publishToGitlab: script: | export VERSION=$(mvn -B help:evaluate -Dexpression=project.version -B | grep -v "\[INFO\]" | grep -Po "\d+\.\d+\.\d+((-\w*)+)?") echo "Publishing version $VERSION for $LIB_NAME" - mvnw $MAVEN_CLI_OPTS deploy -s .cisettings.xml -P gitlabDeploy + mvn $MAVEN_CLI_OPTS deploy -s .cisettings.xml -P gitlabDeploy echo "VERSION=$VERSION" >> variables.env artifacts: when: always -- cgit v1.2.3 From 475c30468cdfe502a48b735837b99d1fd2661132 Mon Sep 17 00:00:00 2001 From: Christian Kollmann Date: Fri, 30 Oct 2020 10:59:29 +0100 Subject: CI: Add junit report, enable code quality scanning --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to '.gitlab-ci.yml') diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4fbd5459..516f0a75 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,6 +15,7 @@ include: - template: Dependency-Scanning.gitlab-ci.yml - template: Security/SAST.gitlab-ci.yml - template: Secret-Detection.gitlab-ci.yml + - template: Code-Quality.gitlab-ci.yml stages: - assemble @@ -35,7 +36,7 @@ assemble: artifacts: when: always reports: - junit: "target/surefire-reports/TEST-*.xml" + junit: "**/target/surefire-reports/TEST-*.xml" publishToGitlab: stage: package -- cgit v1.2.3 From 17bef2441719f3d36ee74fd526f03c86810653d6 Mon Sep 17 00:00:00 2001 From: Christian Kollmann Date: Fri, 30 Oct 2020 12:02:13 +0100 Subject: CI: Use cisettings for spotbugs --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.gitlab-ci.yml') diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 516f0a75..db89c941 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,7 @@ variables: LANG: "en_US.UTF-8" LANGUAGE: "en_US" LIB_NAME: "eaaf-components" - MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true" + MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true --settings ${CI_PROJECT_DIR}/.cisettings.xml" MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=${CI_PROJECT_DIR}/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true" GIT_SUBMODULE_STRATEGY: recursive GIT_DEPTH: "2" -- cgit v1.2.3 From 71ee7827780f15f5126f4d0cbe55ad38723fa67c Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Mon, 7 Dec 2020 15:22:24 +0100 Subject: update build pipeline to test deployment to egiz public maven --- .gitlab-ci.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to '.gitlab-ci.yml') diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index db89c941..37ca635e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -26,7 +26,7 @@ stages: cache: paths: - ".m2/repository" - + assemble: stage: assemble except: @@ -42,10 +42,14 @@ publishToGitlab: stage: package except: - tags + before_script: + - mkdir -p ~/.ssh + - ssh-keyscan apps.egiz.gv.at >> ~/.ssh/known_hosts + - chmod 644 ~/.ssh/known_hosts script: | export VERSION=$(mvn -B help:evaluate -Dexpression=project.version -B | grep -v "\[INFO\]" | grep -Po "\d+\.\d+\.\d+((-\w*)+)?") - echo "Publishing version $VERSION for $LIB_NAME" - mvn $MAVEN_CLI_OPTS deploy -s .cisettings.xml -P gitlabDeploy + echo "Publishing version $VERSION for $LIB_NAME to public EGIZ maven" + mvn $MAVEN_CLI_OPTS deploy -s .cisettings.xml -P jenkinsDeploy -DskipTests echo "VERSION=$VERSION" >> variables.env artifacts: when: always @@ -61,8 +65,14 @@ release: when: manual only: - master + before_script: + - mkdir -p ~/.ssh + - ssh-keyscan apps.egiz.gv.at >> ~/.ssh/known_hosts + - chmod 644 ~/.ssh/known_hosts script: | echo "Releasing version $VERSION of $LIB_NAME" + echo "Publishing version $VERSION to public EGIZ maven" + mvn $MAVEN_CLI_OPTS deploy -s .cisettings.xml -P jenkinsDeploy release: name: "$VERSION" tag_name: "v$VERSION" -- cgit v1.2.3