From 26e422ff90f2a4fb9d2d25c0b2328b365fe5f0d7 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 11 Dec 2020 16:33:00 +0100 Subject: add 'findSecBugs' plug-in into 'spotBugs' module and solve bugs or exclude false-positive update gitlab-ci configuration to display jUnit test-coverage --- .gitlab-ci.yml | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to '.gitlab-ci.yml') diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 81a4a4dd..3d865418 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,6 +9,7 @@ variables: 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_DEPTH: "2" SECURE_LOG_LEVEL: "debug" + JACOCO_CSV_LOCATION: '${CI_PROJECT_DIR}/build_reporting/target/site/jacoco-aggregate-ut/jacoco.csv' include: - template: Dependency-Scanning.gitlab-ci.yml @@ -31,7 +32,47 @@ assemble: - tags script: | mvn $MAVEN_CLI_OPTS generate-sources compile test + after_script: + - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, " instructions covered"; print 100*covered/instructions, "% covered" }' $JACOCO_CSV_LOCATION artifacts: when: always reports: junit: "**/target/surefire-reports/TEST-*.xml" + paths: + - target/jacoco-report/jacoco.xml + + +buildDistributionPackage: + 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 "Build full package of version $VERSION + mvn $MAVEN_CLI_OPTS verify -s .cisettings.xml -DskipTests + echo "VERSION=$VERSION" >> variables.env + artifacts: + when: always + reports: + dotenv: variables.env + name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME" + paths: + - target/*.-dist.zip + +release: + stage: release + image: registry.gitlab.com/gitlab-org/release-cli:latest + needs: + - job: buildDistributionPackage + artifacts: true + when: manual + only: + - master + script: | + echo "Releasing version $VERSION of $LIB_NAME" + echo "Publishing version $VERSION to public EGIZ maven" + mvn $MAVEN_CLI_OPTS deploy -s .cisettings.xml + artifacts: + name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME-EGIZ" + paths: + - target/*.-dist.zip -- cgit v1.2.3 From fd1aa7ad49e2c0dcde4724ed966b6e3a446c2903 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Mon, 14 Dec 2020 12:17:17 +0100 Subject: fix wrong indent in GitLab CI configuration --- .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 3d865418..7d336924 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -38,8 +38,8 @@ assemble: when: always reports: junit: "**/target/surefire-reports/TEST-*.xml" - paths: - - target/jacoco-report/jacoco.xml + paths: + - target/jacoco-report/jacoco.xml buildDistributionPackage: -- cgit v1.2.3 From 5ecde41cf85eeeaa1be8826d8581d6797154c517 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Mon, 14 Dec 2020 12:24:52 +0100 Subject: update GitLab CI process to use latest maven version --- .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 7d336924..4009365f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,5 @@ -image: maven:3.6-jdk-8 +#image: maven:3.6-jdk-8 +image: maven:latest variables: LC_ALL: "en_US.UTF-8" -- cgit v1.2.3 From 76bba5972cfa6d6272a73cbdf56a8705419c55c8 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Mon, 14 Dec 2020 13:52:25 +0100 Subject: fix wrong release-package path in GitLab CI configuration --- .gitlab-ci.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to '.gitlab-ci.yml') diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4009365f..17655aa5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,6 +11,8 @@ variables: GIT_DEPTH: "2" SECURE_LOG_LEVEL: "debug" JACOCO_CSV_LOCATION: '${CI_PROJECT_DIR}/build_reporting/target/site/jacoco-aggregate-ut/jacoco.csv' + JACOCO_XML_LOCATION: '${CI_PROJECT_DIR}/build_reporting/target/site/jacoco-aggregate-ut/jacoco.xml' + PROJECT_RELEASE_PACKAGE: '${CI_PROJECT_DIR}/target/*-dist.zip' include: - template: Dependency-Scanning.gitlab-ci.yml @@ -40,7 +42,8 @@ assemble: reports: junit: "**/target/surefire-reports/TEST-*.xml" paths: - - target/jacoco-report/jacoco.xml + - $JACOCO_CSV_LOCATION + - $JACOCO_XML_LOCATION buildDistributionPackage: @@ -49,8 +52,8 @@ buildDistributionPackage: - tags script: | export VERSION=$(mvn -B help:evaluate -Dexpression=project.version -B | grep -v "\[INFO\]" | grep -Po "\d+\.\d+\.\d+((-\w*)+)?") - echo "Build full package of version $VERSION - mvn $MAVEN_CLI_OPTS verify -s .cisettings.xml -DskipTests + echo "Build full package of version $VERSION" + mvn $MAVEN_CLI_OPTS verify -DskipTests echo "VERSION=$VERSION" >> variables.env artifacts: when: always @@ -58,7 +61,7 @@ buildDistributionPackage: dotenv: variables.env name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME" paths: - - target/*.-dist.zip + - $PROJECT_RELEASE_PACKAGE release: stage: release @@ -72,8 +75,8 @@ release: script: | echo "Releasing version $VERSION of $LIB_NAME" echo "Publishing version $VERSION to public EGIZ maven" - mvn $MAVEN_CLI_OPTS deploy -s .cisettings.xml + mvn $MAVEN_CLI_OPTS deploy artifacts: name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME-EGIZ" paths: - - target/*.-dist.zip + - $PROJECT_RELEASE_PACKAGE -- cgit v1.2.3 From 051ab70f8ca88e24d71640696b023be87df92c08 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Wed, 16 Dec 2020 08:55:21 +0100 Subject: update GitLab CI configuration to set code-coverage extractor and artifact names for releases --- .gitlab-ci.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to '.gitlab-ci.yml') diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 17655aa5..acc0e423 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -37,6 +37,7 @@ assemble: mvn $MAVEN_CLI_OPTS generate-sources compile test after_script: - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, " instructions covered"; print 100*covered/instructions, "% covered" }' $JACOCO_CSV_LOCATION + coverage: '/([0-9]{1,3}.[0-9]*).%.covered/' artifacts: when: always reports: @@ -56,10 +57,10 @@ buildDistributionPackage: mvn $MAVEN_CLI_OPTS verify -DskipTests echo "VERSION=$VERSION" >> variables.env artifacts: + name: "${CI_PROJECT_NAME}-${CI_COMMIT_SHORT_SHA}" when: always reports: - dotenv: variables.env - name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME" + dotenv: variables.env paths: - $PROJECT_RELEASE_PACKAGE @@ -77,6 +78,7 @@ release: echo "Publishing version $VERSION to public EGIZ maven" mvn $MAVEN_CLI_OPTS deploy artifacts: - name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME-EGIZ" + name: "${CI_PROJECT_NAME}-${CI_COMMIT_SHORT_SHA}-release" + expire_in: never paths: - $PROJECT_RELEASE_PACKAGE -- cgit v1.2.3 From 10533a1a5a4e833f2436cd4752cabba8e6d664f3 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 18 Dec 2020 17:42:17 +0100 Subject: update GitLab CI to exclude /feature/.* branches from packaging --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) (limited to '.gitlab-ci.yml') diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index acc0e423..26294b10 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -51,6 +51,7 @@ buildDistributionPackage: stage: package except: - tags + - /^feature/.*$/i script: | export VERSION=$(mvn -B help:evaluate -Dexpression=project.version -B | grep -v "\[INFO\]" | grep -Po "\d+\.\d+\.\d+((-\w*)+)?") echo "Build full package of version $VERSION" -- cgit v1.2.3 From 83d7101ae4169a840e13e2b178fd7a07108fff2d Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Tue, 22 Dec 2020 12:25:48 +0100 Subject: remove SAST.gitlab template because it's already covered by maven build-process --- .gitlab-ci.yml | 2 -- 1 file changed, 2 deletions(-) (limited to '.gitlab-ci.yml') diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 26294b10..364d19fb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,3 @@ -#image: maven:3.6-jdk-8 image: maven:latest variables: @@ -16,7 +15,6 @@ variables: include: - template: Dependency-Scanning.gitlab-ci.yml - - template: Security/SAST.gitlab-ci.yml - template: Secret-Detection.gitlab-ci.yml stages: -- cgit v1.2.3 From 68e9725d024ccef7b618f462dee5648ca288bdc0 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 15 Jan 2021 15:57:27 +0100 Subject: add 'docker' tag into GitLab CI runner to select a shared docker based runner --- .gitlab-ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) (limited to '.gitlab-ci.yml') diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 364d19fb..523230e3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,6 +29,8 @@ cache: assemble: stage: assemble + tags: + - docker except: - tags script: | @@ -47,6 +49,8 @@ assemble: buildDistributionPackage: stage: package + tags: + - docker except: - tags - /^feature/.*$/i @@ -66,6 +70,8 @@ buildDistributionPackage: release: stage: release image: registry.gitlab.com/gitlab-org/release-cli:latest + tags: + - docker needs: - job: buildDistributionPackage artifacts: true -- cgit v1.2.3