updated pom.xml
Some checks failed
Locusworks Team/eight-track/pipeline/head There was a failure building this commit

This commit is contained in:
Isaac Parenteau
2020-05-22 20:35:59 +01:00
parent f8c145efa9
commit 275a29a78d
3 changed files with 138 additions and 107 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@
/key.bin
/logs/
/conf/
.metadata/

140
Jenkinsfile vendored
View File

@ -1,7 +1,18 @@
#!groovy
// Required Jenkins plugins:
// https://wiki.jenkins-ci.org/display/JENKINS/Timestamper
// https://wiki.jenkins-ci.org/display/JENKINS/Static+Code+Analysis+Plug-ins
// https://wiki.jenkins-ci.org/display/JENKINS/Checkstyle+Plugin ?
// https://wiki.jenkins-ci.org/display/JENKINS/FindBugs+Plugin
// https://wiki.jenkins-ci.org/display/JENKINS/PMD+Plugin ?
// https://wiki.jenkins-ci.org/display/JENKINS/DRY+Plugin ?
// https://wiki.jenkins-ci.org/display/JENKINS/Task+Scanner+Plugin
// https://wiki.jenkins-ci.org/display/JENKINS/Javadoc+Plugin
// https://wiki.jenkins-ci.org/display/JENKINS/JaCoCo+Plugin ?
init()
init()
def branch_name
def branch_name_base
@ -23,7 +34,8 @@ def init() {
build_url = env.BUILD_URL
job_name = "${env.JOB_NAME}"
branch_name = env.BRANCH_NAME
persist = branch_name
branch_name_docker = branch_name.replaceAll(/\//,'.')
persist = "/var/lib/jenkins/PERSIST/${branch_name_docker}"
// execute the branch type specific pipeline code
try {
@ -31,52 +43,44 @@ def init() {
if (branch_name.indexOf('release/')==0) build_type='release'
if (branch_name.indexOf('feature/')==0) build_type='feature'
if (branch_name.indexOf('develop')==0) build_type='develop'
if (branch_name.indexOf('hotfix')==0) build_type='hotfix'
if (branch_name.indexOf('bugfix')==0) build_type='bugfix'
if (branch_name.indexOf('master')==0) build_type='master'
if (branch_name.indexOf('hotfix/')==0) build_type='hotfix'
if (branch_name.indexOf('bugfix/')==0) build_type='bugfix'
// common pipeline elements
node('master') {
Initialize()
SetVersion(build_type)
print_vars() // after SetVersion - all variables now defined
set_result('INPROGRESS')
Build() // builds database via flyway migration
}
switch(build_type) {
case ~/feature/:
case ~/hotfix/:
case ~/bugfix/:
case ~/master/:
case ~/develop/:
CommonBuild();
break;
case ~/release/:
CommonBuild();
Deploy();
break;
default:
throw "unsupported branch type: ${branch_name}"
if (branch_name.indexOf('develop')==0) {
node('master') {
Deploy();
}
} else if (branch_name.indexOf('release/')==0) {
node('master') {
Deploy();
}
}
node('master') {
set_result('SUCCESS')
set_result('SUCCESS')
}
} catch (err) {
node() {
set_result('FAILURE')
set_result('FAILURE')
}
throw err
}
}
def CommonBuild() {
// common pipeline elements
node('master') {
Initialize()
SetVersion(build_type)
print_vars() // after SetVersion - all variables now defined
set_result('INPROGRESS')
Build()
}
}
def Build() {
stage ('build') {
mvn_alt("install -DskipTests=true -Dbuild.revision=${git_commit}")
mvn "install -DskipTests=true -Dbuild.revision=${git_commit}"
step([$class: 'ArtifactArchiver', artifacts: '**/target/*.jar', fingerprint: true])
}
}
@ -92,10 +96,8 @@ def Initialize() {
}
def Deploy() {
node('master') {
stage ('deploy') {
mvn_alt("deploy -DskipTests=true -Dbuild.number=${build_number} -Dbuild.revision=${git_commit}")
}
stage ('deploy') {
mvn "deploy -DskipTests=true -Dbuild.number=${build_number} -Dbuild.revision=${git_commit}"
}
}
@ -105,17 +107,19 @@ def getSha1() {
return sha1
}
def mvn_initial(args) {
mvn_alt(args)
def mvn(args) {
withMaven(
maven: 'maven-3.6.1',
globalMavenSettingsConfig: 'locusworks-settings'
) {
sh "mvn ${args}"
}
}
def mvn_alt(args) {
// add maven tools to path before calling maven
withMaven(maven: 'maven-3.6.1', jdk: 'jdk1.8.0_221', mavenSettingsConfig: 'maven_settings') {
writeFile file: '.skip-task-scanner', text: ''
writeFile file: '.skip-publish-junit-results', text: ''
sh "mvn ${args}"
}
def mvn_initial(args) {
mvn(args)
}
def set_result(status) {
@ -130,10 +134,13 @@ def set_result(status) {
} else {
error ("unknown status")
}
// save in persistence file for access the status page
// make sure the directory exists first
sh "mkdir -p $persist && echo $status > $persist/build.result"
}
def notify_bitbucket(state) {
echo "notify bitbucket, state = $state, commit: ${git_commit}"
}
def print_vars() {
@ -146,35 +153,34 @@ def print_vars() {
echo "display_name = ${currentBuild.displayName}"
echo "version = ${version}"
echo "git_commit = ${git_commit}"
}
def SetVersion( v ) {
stage ('set version') {
echo "set version ${v}"
branch_name_base = (branch_name =~ /([^\/]+$)/)[0][0]
switch(build_type) {
case ~/develop/:
version = build_number + '-SNAPSHOT'
currentBuild.displayName = version
break;
case ~/release/:
// for release branches, where the branch is named "release/1.2.3",
// derive the version and display name derive from the numeric suffix and append the build number
// 3.2.1.100
version = branch_name_base + '.' + build_number + '-RELEASE'
currentBuild.displayName = version
break;
default:
// for all other branches the version number is 0 with an appended build number
// and for the display name use the jenkins default #n and add the branch name
version = branch_name_base + "." + build_number
currentBuild.displayName = "#" + build_number + " - " + branch_name_base
if ( v == 'release' ) {
// for release branches, where the branch is named "release/1.2.3",
// derive the version and display name derive from the numeric suffix and append the build number
// 3.2.1.100
version = branch_name_base + "." + build_number + "-RELEASE";
//version = branch_name.substring('release/'.length()) + "." + build_number
currentBuild.displayName = version
} else if (v == 'develop') {
version = branch_name_base + "." + build_number + "-SNAPSHOT";
currentBuild.displayName = version
} else {
// for all other branches the version number is 0 with an appended build number
// and for the display name use the jenkins default #n and add the branch name
// #101 - feature/user/foo
//version = '0.' + build_number
version = branch_name_base + "." + build_number
currentBuild.displayName = "#" + build_number + " - " + branch_name_base
}
display_name = currentBuild.displayName
mvn_initial("versions:set -DnewVersion=${version}")
mvn_initial "versions:set -DnewVersion=${version}"
}
}
return this
return this

104
pom.xml
View File

@ -18,19 +18,19 @@
</scm>
<properties>
<flyway.version>6.0.3</flyway.version>
<mariadb.version>2.4.4</mariadb.version>
<hibernate.version>5.4.4.Final</hibernate.version>
<spring.version>5.1.9.RELEASE</spring.version>
<spring.boot.version>2.1.8.RELEASE</spring.boot.version>
<spring.data.version>2.1.10.RELEASE</spring.data.version>
<flyway.version>6.1.3</flyway.version>
<mariadb.version>2.5.2</mariadb.version>
<hibernate.version>5.4.10.Final</hibernate.version>
<spring.version>5.2.2.RELEASE</spring.version>
<spring.boot.version>2.2.2.RELEASE</spring.boot.version>
<spring.data.version>2.2.2.RELEASE</spring.data.version>
<jackson.version>2.10.1</jackson.version>
<log4j.version>2.12.1</log4j.version>
<slf4j.version>1.7.28</slf4j.version>
<maven.enforcer.version>3.0.0-M2</maven.enforcer.version>
<dep.check.version>5.2.2</dep.check.version>
<license-maven-plugin.version>3.0</license-maven-plugin.version>
<nexus.repo>http://nexus.locusworks.net</nexus.repo>
<nexus.repo>https://nexus.locusworks.net</nexus.repo>
</properties>
<build>
@ -38,7 +38,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M2</version>
<version>${maven.enforcer.version}</version>
<configuration>
<rules>
<dependencyConvergence />
@ -116,7 +116,7 @@
<artifactId>flyway-maven-plugin</artifactId>
<version>${flyway.version}</version>
<configuration>
<url>jdbc:mariadb://devops.locusworks.net:3306/</url>
<url>jdbc:mariadb://localhost:3306/</url>
<outOfOrder>false</outOfOrder>
<schemas>
<schema>eighttrack</schema>
@ -126,8 +126,6 @@
<location>filesystem:${basedir}/src/main/resources/database/migration</location>
</locations>
</configuration>
<!-- <executions> <execution> <phase>process-sources</phase> <goals>
<goal>migrate</goal> </goals> </execution> </executions> -->
<dependencies>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
@ -143,32 +141,20 @@
<dependency>
<groupId>net.locusworks</groupId>
<artifactId>applogger</artifactId>
<version>1.0.3-RELEASE</version>
<version>1.0.1-RELEASE</version>
</dependency>
<dependency>
<groupId>net.locusworks</groupId>
<artifactId>crypto</artifactId>
<version>1.0.5-RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-core</artifactId>
<version>1.22</version>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-parsers</artifactId>
<version>1.22</version>
<version>1.0.1-RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.dv8tion/JDA2 -->
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>4.0.0_50</version>
<version>4.1.0_88</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
@ -188,7 +174,7 @@
<dependency>
<groupId>com.sedmelluq</groupId>
<artifactId>lavaplayer</artifactId>
<version>1.3.22</version>
<version>1.3.32</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.flywaydb/flyway-core -->
@ -208,7 +194,7 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.17</version>
<version>8.0.18</version>
</dependency>
<dependency>
@ -217,14 +203,13 @@
<version>${hibernate.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-dbcp2 -->
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-c3p0 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>2.7.0</version>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>${hibernate.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot -->
<dependency>
<groupId>org.springframework.boot</groupId>
@ -296,43 +281,55 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.10.0.pr3</version>
<version>${jackson.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.10.0.pr3</version>
<version>${jackson.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.10.0.pr3</version>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.11</version>
<version>2.4.0-b180830.0359</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sun.xml.bind/jaxb-core -->
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.2.11</version>
<version>2.3.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.11</version>
<version>2.4.0-b180830.0438</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.mpatric/mp3agic -->
<dependency>
<groupId>com.mpatric</groupId>
<artifactId>mp3agic</artifactId>
<version>0.9.1</version>
</dependency>
</dependencies>
<distributionManagement>
@ -346,4 +343,31 @@
</repository>
</distributionManagement>
<repositories>
<repository>
<id>locusworks-public</id>
<name>locusworks-public</name>
<url>${nexus.repo}/repository/locusworks-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>locusworks-public</id>
<url>${nexus.repo}/repository/locusworks-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>