Bump java version. Update Jenkinsfile

This commit is contained in:
a.romanov 2019-06-26 12:49:47 +03:00
parent 46b53e8c93
commit 06ed09fc3a
2 changed files with 25 additions and 110 deletions

49
Jenkinsfile vendored
View File

@ -1,47 +1,18 @@
#!groovy
build('antifraud', 'java-maven') {
checkoutRepo()
loadBuildUtils()
def serviceName = env.REPO_NAME
def mvnArgs = '-DjvmArgs="-Xmx256m"'
// Run mvn and generate docker file
runStage('Maven package') {
withCredentials([[$class: 'FileBinding', credentialsId: 'java-maven-settings.xml', variable: 'SETTINGS_XML']]) {
def mvn_command_arguments = ' --batch-mode --settings $SETTINGS_XML -P ci ' +
" -Dgit.branch=${env.BRANCH_NAME} " +
" ${mvnArgs}"
if (env.BRANCH_NAME == 'master') {
sh 'mvn deploy' + mvn_command_arguments
} else {
sh 'mvn package' + mvn_command_arguments
}
def javaServicePipeline
runStage('load JavaService pipeline') {
javaServicePipeline = load("build_utils/jenkins_lib/pipeJavaService.groovy")
}
}
def serviceImage;
def imgShortName = 'rbkmoney/' + "${serviceName}" + ':' + '$COMMIT_ID';
getCommitId()
runStage('Build Service image') {
serviceImage = docker.build(imgShortName, '-f ./target/Dockerfile ./target')
}
def serviceName = env.REPO_NAME
def mvnArgs = '-DjvmArgs="-Xmx256m"'
def useJava11 = true
def registry = 'dr2.rbkmoney.com'
def registryCredsId = 'jenkins_harbor'
try {
if (env.BRANCH_NAME == 'master' || env.BRANCH_NAME.startsWith('epic')) {
runStage('Push Service image') {
docker.withRegistry('https://dr.rbkmoney.com/v2/', 'dockerhub-rbkmoneycibot') {
serviceImage.push();
}
// Push under 'withRegistry' generates 2d record with 'long name' in local docker registry.
// Untag the long-name
sh "docker rmi dr.rbkmoney.com/${imgShortName}"
}
}
}
finally {
runStage('Remove local image') {
// Remove the image to keep Jenkins runner clean.
sh "docker rmi ${imgShortName}"
}
}
javaServicePipeline(serviceName, useJava11, mvnArgs, registry, registryCredsId)
}

86
pom.xml
View File

@ -4,7 +4,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.rbkmoney</groupId>
<artifactId>antifraud</artifactId>
<version>1.0.3-SNAPSHOT</version>
<description>AntiFraud inspection service</description>
@ -23,15 +22,8 @@
<dockerfile.base.service.tag>22c57470c4fc47161894f036b7cf9d70f42b75f5</dockerfile.base.service.tag>
<damsel.version>1.264-e044dd7</damsel.version>
<shared.resources.version>0.2.1</shared.resources.version>
<!-- <db.host.name>localhost</db.host.name>
<db.host.port>5432</db.host.port>
<db.name>antifraud</db.name>
<db.url>jdbc:postgresql://${db.host.name}:${db.host.port}/${db.name}</db.url>
<db.user>postgres</db.user>
<db.password>postgres</db.password>
<db.schema>af</db.schema>-->
</properties>
<profiles>
<profile>
<id>dev</id>
@ -41,6 +33,7 @@
</properties>
</profile>
</profiles>
<dependencies>
<!--Spring libs-->
<dependency>
@ -53,10 +46,6 @@
</exclusion>
</exclusions>
</dependency>
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
@ -134,6 +123,7 @@
</includes>
<filtering>true</filtering>
</resource>
<resource>
<directory>${project.build.directory}/maven-shared-archive-resources</directory>
<filtering>true</filtering>
@ -141,40 +131,24 @@
<exclude>Dockerfile</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<!--<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>${flyway.version}</version>
<configuration>
<url>${db.url}</url>
<user>${db.user}</user>
<password>${db.password}</password>
<schemas>
<schema>${db.schema}</schema>
</schemas>
</configuration>
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.jdbc.version}</version>
</dependency>
</dependencies>
</plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-remote-resources-plugin</artifactId>
@ -202,46 +176,16 @@
</executions>
</plugin>
<!-- JOOQ -->
<!--<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>${jooq.version}</version>
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.jdbc.version}</version>
</dependency>
</dependencies>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.2</version>
<configuration>
<jdbc>
<driver>org.postgresql.Driver</driver>
<url>${db.url}</url>
<user>${db.user}</user>
<password>${db.password}</password>
</jdbc>
<generator>
<generate>
<javaTimeTypes>true</javaTimeTypes>
<pojos>true</pojos>
<pojosEqualsAndHashCode>true</pojosEqualsAndHashCode>
<pojosToString>true</pojosToString>
</generate>
<database>
<name>org.jooq.util.postgres.PostgresDatabase</name>
<includes>.*</includes>
<excludes>schema_version</excludes>
<inputSchema>${db.schema}</inputSchema>
</database>
<target>
<packageName>com.rbkmoney.antifraud.domain</packageName>
<directory>src/main/java/</directory>
</target>
</generator>
<source>11</source>
<target>11</target>
</configuration>
</plugin>-->
</plugin>
</plugins>
</build>
</project>