Implemented Jenkins CI/CD Pipeline (#45)
nclazz/codebuilder/pipeline/head This commit has test failures
Details
nclazz/codebuilder/pipeline/head This commit has test failures
Details
Reviewed-on: de.nclazz/codebuilder#45 Co-authored-by: Niclas Thobaben <nthobaben@nclazz.de> Co-committed-by: Niclas Thobaben <nthobaben@nclazz.de>master
parent
c9bc42a9b3
commit
f72957998e
|
@ -6,7 +6,7 @@ pipeline {
|
|||
}
|
||||
|
||||
environment {
|
||||
NEXUS_CREDENTIALS = credentials('jenkins_nexus')
|
||||
// NEXUS_CREDENTIALS = credentials('jenkins_nexus')
|
||||
|
||||
DOCKER_IMAGE_TAG_NAME="codebuilder"
|
||||
DOCKER_IMAGE_NAME="nclazz/codebuilder"
|
||||
|
@ -26,19 +26,35 @@ pipeline {
|
|||
}
|
||||
stage('Build') {
|
||||
steps {
|
||||
sh 'mvn clean package -DskipTests=true -B -s settings.xml'
|
||||
sh 'mvn clean package -DskipTests -B -s settings.xml'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Test') {
|
||||
steps {
|
||||
sh 'mvn test -B -s settings.xml'
|
||||
sh 'mvn verify -B -s settings.xml'
|
||||
jacoco(
|
||||
changeBuildStatus: true,
|
||||
exclusionPattern: '**/models/**',
|
||||
minimumInstructionCoverage: '30',
|
||||
maximumInstructionCoverage: '50'
|
||||
)
|
||||
recordIssues(
|
||||
enabledForFailure: true,
|
||||
aggregatingResults: true,
|
||||
tools: [java(), checkStyle(), findBugs(pattern: '**/target/spotbugsXml.xml')]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
stage('Deploy maven artifacts') {
|
||||
steps {
|
||||
sh 'mvn deploy -B -s settings.xml'
|
||||
withCredentials([usernamePassword(credentialsId: 'jenkins_nexus', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
|
||||
sh 'mvn deploy -Dnexus.user=${USERNAME} -Dnexus.password=${PASSWORD} -B -s settings.xml'
|
||||
}
|
||||
script {
|
||||
addEmbeddableBadgeConfiguration(id: "mavenArtifact", subject: "Maven Artifact", color: "green", status: "${VERSION}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,6 +63,9 @@ pipeline {
|
|||
dir('codebuilder-service') {
|
||||
sh "docker build --tag $DOCKER_IMAGE_TAG_NAME:$VERSION ."
|
||||
}
|
||||
script {
|
||||
addEmbeddableBadgeConfiguration(id: "dockerImage", subject: "Docker", color: "green", status: "${DOCKER_IMAGE_TAG_NAME}:${VERSION}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,10 +94,10 @@ pipeline {
|
|||
subject: "Jenkins job ${env.JOB_NAME}#${env.BUILD_NUMBER} failed",
|
||||
body: """
|
||||
There is a build failure in ${env.JOB_NAME}.
|
||||
Build: ${env.BUILD_URL}
|
||||
Logs: ${env.BUILD_URL}console
|
||||
Changes: ${env.BUILD_URL}changes
|
||||
--
|
||||
Build: ${env.BUILD_URL}
|
||||
Logs: ${env.BUILD_URL}console
|
||||
Changes: ${env.BUILD_URL}changes
|
||||
--
|
||||
"""
|
||||
)
|
||||
}
|
||||
|
@ -91,10 +110,10 @@ pipeline {
|
|||
subject: "Jenkins job ${env.JOB_NAME}#${env.BUILD_NUMBER} unstable",
|
||||
body: """
|
||||
Some tests have failed in ${env.JOB_NAME}.
|
||||
Build: ${env.BUILD_URL}
|
||||
Logs: ${env.BUILD_URL}console
|
||||
Changes: ${env.BUILD_URL}changes
|
||||
--
|
||||
Build: ${env.BUILD_URL}
|
||||
Logs: ${env.BUILD_URL}console
|
||||
Changes: ${env.BUILD_URL}changes
|
||||
--
|
||||
"""
|
||||
)
|
||||
}
|
||||
|
@ -108,15 +127,19 @@ pipeline {
|
|||
body: """
|
||||
The build ${env.JOB_NAME} completed successfully and is back to normal.
|
||||
|
||||
Build: ${env.BUILD_URL}
|
||||
Logs: ${env.BUILD_URL}console
|
||||
Changes: ${env.BUILD_URL}changes
|
||||
--
|
||||
Build: ${env.BUILD_URL}
|
||||
Logs: ${env.BUILD_URL}console
|
||||
Changes: ${env.BUILD_URL}changes
|
||||
--
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
always {
|
||||
junit(
|
||||
allowEmptyResults: true,
|
||||
testResults: '**/target/surefire-reports/**/*.xml'
|
||||
)
|
||||
cleanWs()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
[![Build Status](https://jenkins.nclazz.de/buildStatus/icon?job=nclazz%2Fcodebuilder%2Fmaster)](https://jenkins.nclazz.de/job/nclazz/job/codebuilder/job/master/)
|
||||
[![Docker Image](https://jenkins.nclazz.de/buildStatus/icon?job=nclazz%2Fcodebuilder%2Fmaster&config=dockerImage)](https://jenkins.nclazz.de/job/nclazz/job/codebuilder/job/master/)
|
||||
|
||||
Codebuilder
|
||||
====================
|
||||
Nclazz Codebuilder is an open source service for creating custom code generators.
|
||||
|
||||
Codebuilder uses [mustache templates](https://mustache.github.io/) to create code generators based on [Apibuilder](https://www.apibuilder.io/)
|
||||
specs. It is designed to provide a simple and straightforward way to create generators for your own specific needs
|
||||
without requiring you to write and deploy a custom application.
|
||||
|
||||
|
||||
|
|
@ -7,21 +7,18 @@
|
|||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.5.5</version>
|
||||
<relativePath/>
|
||||
<groupId>de.nclazz.apps.codebuilder</groupId>
|
||||
<artifactId>codebuilder-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>de.nclazz.apps.codebuilder</groupId>
|
||||
<artifactId>codebuilder-service</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
||||
<name>codebuilder-service</name>
|
||||
<description>Template based code generator builder for Apibuilder json specs.</description>
|
||||
|
||||
<properties>
|
||||
<java.version>11</java.version>
|
||||
<springboot.version>2.5.5</springboot.version>
|
||||
<modelmapper.version>2.4.4</modelmapper.version>
|
||||
<jwt.version>0.9.1</jwt.version>
|
||||
<hsqldb.version>2.6.0</hsqldb.version>
|
||||
|
@ -39,6 +36,18 @@
|
|||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>${springboot.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
@ -124,6 +133,7 @@
|
|||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${springboot.version}</version>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
|
@ -134,10 +144,17 @@
|
|||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>build-info</id>
|
||||
<goals>
|
||||
<goal>build-info</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>repackage</id>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
|
@ -164,11 +181,30 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.1</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<configuration>
|
||||
<delimiters>
|
||||
<delimiter>@</delimiter>
|
||||
</delimiters>
|
||||
<useDefaultDelimiters>false</useDefaultDelimiters>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/test/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
</project>
|
223
pom.xml
223
pom.xml
|
@ -23,60 +23,95 @@
|
|||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<properties>
|
||||
<java.version>11</java.version>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.release>11</maven.compiler.release>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
|
||||
<spotbugs.version>4.2.0</spotbugs.version>
|
||||
<jacoco.version>0.8.7</jacoco.version>
|
||||
<checkstyle.version>3.1.2</checkstyle.version>
|
||||
<maven.surefire.version>3.0.0-M5</maven.surefire.version>
|
||||
<maven.failsafe.version>3.0.0-M5</maven.failsafe.version>
|
||||
</properties>
|
||||
|
||||
<modules>
|
||||
<module>codebuilder-core</module>
|
||||
<module>codebuilder-service</module>
|
||||
</modules>
|
||||
|
||||
<build>
|
||||
<defaultGoal>install</defaultGoal>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.3.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>3.1.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>3.0.0-M1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-enforcer-plugin</artifactId>
|
||||
<version>3.0.0-M3</version>
|
||||
<configuration>
|
||||
<rules>
|
||||
<requireMavenVersion>
|
||||
<version>3.5</version>
|
||||
</requireMavenVersion>
|
||||
<requireJavaVersion>
|
||||
<version>11</version>
|
||||
</requireJavaVersion>
|
||||
<banDuplicatePomDependencyVersions/>
|
||||
</rules>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.3.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>3.1.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>3.0.0-M1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>${maven.surefire.version}</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-failsafe-plugin</artifactId>
|
||||
<version>${maven.failsafe.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>integration-test</goal>
|
||||
<goal>verify</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-enforcer-plugin</artifactId>
|
||||
<version>3.0.0-M3</version>
|
||||
<configuration>
|
||||
<rules>
|
||||
<requireMavenVersion>
|
||||
<version>3.5</version>
|
||||
</requireMavenVersion>
|
||||
<requireJavaVersion>
|
||||
<version>11</version>
|
||||
</requireJavaVersion>
|
||||
<banDuplicatePomDependencyVersions/>
|
||||
</rules>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>enforce-maven</id>
|
||||
|
@ -86,13 +121,101 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>com.github.spotbugs</groupId>
|
||||
<artifactId>spotbugs-maven-plugin</artifactId>
|
||||
<version>${spotbugs.version}</version>
|
||||
<configuration>
|
||||
<xmlOutput>true</xmlOutput>
|
||||
<effort>Medium</effort>
|
||||
<threshold>Low</threshold>
|
||||
<failOnError>false</failOnError>
|
||||
<excludeFilterFile>spotbugs-ignore.xml</excludeFilterFile>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>compile-findbugs</id>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>${jacoco.version}</version>
|
||||
<configuration>
|
||||
<rules>
|
||||
<rule>
|
||||
<element>BUNDLE</element>
|
||||
<excludes>
|
||||
<exclude>*Test</exclude>
|
||||
<exclude>**/models/**</exclude>
|
||||
</excludes>
|
||||
<limits>
|
||||
<limit>
|
||||
<counter>METHOD</counter>
|
||||
<value>COVEREDRATIO</value>
|
||||
<minimum>50%</minimum>
|
||||
</limit>
|
||||
</limits>
|
||||
</rule>
|
||||
</rules>
|
||||
<haltOnFailure>false</haltOnFailure>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>prepare-agent</id>
|
||||
<goals>
|
||||
<goal>prepare-agent</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>report</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>report</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>check</id>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<modules>
|
||||
<module>codebuilder-core</module>
|
||||
<module>codebuilder-service</module>
|
||||
</modules>
|
||||
|
||||
<reporting>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.github.spotbugs</groupId>
|
||||
<artifactId>spotbugs-maven-plugin</artifactId>
|
||||
<version>${spotbugs.version}</version>
|
||||
<configuration>
|
||||
<xmlOutput>true</xmlOutput>
|
||||
<effort>Medium</effort>
|
||||
<threshold>Low</threshold>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<!--suppress MavenModelInspection -->
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<!--suppress MavenModelInspection -->
|
||||
<version>${checkstyle.version}</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<!--suppress MavenModelInspection -->
|
||||
<artifactId>maven-surefire-report-plugin</artifactId>
|
||||
<!--suppress MavenModelInspection -->
|
||||
<version>${maven.surefire.version}</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
</project>
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
<servers>
|
||||
<server>
|
||||
<id>nexus.nclazz.de</id>
|
||||
<username>${env.NEXUS_CREDENTIALS_USR}</username>
|
||||
<password>${env.NEXUS_CREDENTIALS_PSW}</password>
|
||||
<username>${nexus.user}</username>
|
||||
<password>${nexus.password}</password>
|
||||
</server>
|
||||
</servers>
|
||||
<proxies />
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<FindBugsFilter>
|
||||
<Match>
|
||||
<Source name="~.*/models/.*"/>
|
||||
</Match>
|
||||
</FindBugsFilter>
|
Loading…
Reference in New Issue