added build_utils + bumps

This commit is contained in:
n.pospolita 2019-04-24 09:42:40 +03:00
parent e82db64995
commit f99b2ac206
4 changed files with 34 additions and 42 deletions

4
.gitmodules vendored Normal file
View File

@ -0,0 +1,4 @@
[submodule "build_utils"]
path = build_utils
url = git@github.com:rbkmoney/build_utils.git
branch = master

50
Jenkinsfile vendored
View File

@ -1,48 +1,18 @@
#!groovy
build('newway', 'java-maven') {
checkoutRepo()
loadBuildUtils()
def serviceName = env.REPO_NAME
def baseImageTag = "f26fcc19d1941ab74f1c72dd8a408be17a769333"
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)
}

1
build_utils Submodule

@ -0,0 +1 @@
Subproject commit ea4aa042f482551d624fd49a570d28488f479e93

21
pom.xml
View File

@ -19,9 +19,9 @@
<properties>
<project.maintainer>Inal Arsanukaev &lt;i.arsanukaev@rbkmoney.com&gt;</project.maintainer>
<shared.resources.version>0.3.3</shared.resources.version>
<shared.resources.version>0.3.6</shared.resources.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<dockerfile.base.service.tag>2a8b44ac628c1bdb729abd04ed7a2a54676e574b</dockerfile.base.service.tag>
<dockerfile.base.service.tag>bc95d0d6dc13c693acd2b274531a7d604b877bf3</dockerfile.base.service.tag>
<server.port>8022</server.port>
<exposed.ports>${server.port}</exposed.ports>
<db.url>jdbc:postgresql://localhost:5432/newway</db.url>
@ -101,6 +101,11 @@
<version>1.18.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
<version>2.2.4.RELEASE</version>
</dependency>
<!--RBK libs-->
<dependency>
@ -108,6 +113,11 @@
<artifactId>eventstock-client-damsel</artifactId>
<version>1.2.6</version>
</dependency>
<dependency>
<groupId>com.rbkmoney</groupId>
<artifactId>machinegun-proto</artifactId>
<version>1.12-ebae56f</version>
</dependency>
<dependency>
<groupId>com.rbkmoney</groupId>
<artifactId>eventstock-client-fistful</artifactId>
@ -174,6 +184,13 @@
<version>0.12.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>kafka</artifactId>
<version>1.10.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>