environment test
This commit is contained in:
parent
27183530cc
commit
05865e1cd2
4
Dockerfile
Normal file
4
Dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
|||
FROM openjdk:11
|
||||
ARG JAR_NAME
|
||||
COPY build/libs/${JAR_NAME} ${JAR_NAME}
|
||||
ENTRYPOINT ["java", "-jar", "/${JAR_NAME}"]
|
16
Jenkinsfile
vendored
16
Jenkinsfile
vendored
|
@ -40,6 +40,7 @@ podTemplate(
|
|||
def gitBranch = myRepo.GIT_BRANCH
|
||||
def shortGitCommit = "${gitCommit[0..10]}"
|
||||
def previousGitCommit = sh(script: "git rev-parse ${gitCommit}~", returnStdout: true)
|
||||
def docker_registry_url = "harboar.loafle.net"
|
||||
|
||||
stage('Test') {
|
||||
try {
|
||||
|
@ -57,11 +58,26 @@ podTemplate(
|
|||
throw(exc)
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build') {
|
||||
container('gradle') {
|
||||
sh "gradle build"
|
||||
}
|
||||
}
|
||||
|
||||
stage('Create Docker images') {
|
||||
container('docker') {
|
||||
withCredentials([[$class: 'UsernamePasswordMultiBinding',
|
||||
credentialsId: 'harbor.loafle.net',
|
||||
usernameVariable: 'HARBOR_USER',
|
||||
passwordVariable: 'HARBOR_PASSWORD']]) {
|
||||
sh """
|
||||
docker login -u ${HARBOR_USER} -p ${HARBOR_PASSWORD} ${docker_registry_url}
|
||||
docker build -t ${docker_registry_url}/prototype/cicd-java-spring-boot:${gitCommit} -f Dockerfile.arg --build-arg JAR_NAME="cicd-${gitCommit}.jar" .
|
||||
docker push ${docker_registry_url}/prototype/cicd-java-spring-boot:${gitCommit}
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user