hooker/Jenkinsfile
Inal Arsanukaev ba90c93b9f HOOK-2: initial commit (#1)
* HOOK-2: initial commit

* Refactoring, added tests

* Added postgres for tests

* Fixed after comments. Added indicies. v1

* Fixed after comments. v2

* Fixed after comments. v3

* Fixed logs

* Changed database structure, fixed dao-classes

* Fixed table name, added foreign key

* add enabled field

* Added some params to post-request

* Fix path condition

* refactor WebhookDao

* Add logs to WebhookHttpPostSender

* Add test for signer

* Added readme

* Fixed readme

* fix readme

* tiny refactoring

* tiny refactoring

* add tables required for resending of messages

* Fixed after comments, changed webhook id type

* Added batch operation

* scheduler draft

* add scheduled task dao interface

* disable scheduler
2017-04-13 12:38:34 +03:00

48 lines
1.6 KiB
Groovy

#!groovy
build('hooker', 'java-maven') {
checkoutRepo()
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 serviceImage;
def imgShortName = 'rbkmoney/' + "${serviceName}" + ':' + '$COMMIT_ID';
getCommitId()
runStage('Build Service image') {
serviceImage = docker.build(imgShortName, '-f ./target/Dockerfile ./target')
}
try {
if (env.BRANCH_NAME == 'master') {
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}"
}
}
}