Jenkinsfile
This commit is contained in:
Vendored
+37
@@ -0,0 +1,37 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
|
||||
stage("Get code from repo") {
|
||||
steps{
|
||||
withCredentials([gitUsernamePassword(credentialsId: 'jenkinsgiteausername', gitToolName: 'git')]) {
|
||||
// git url: "https://gitea.dev.osnawiki.de/ds/test" , branch: "main"
|
||||
git url: "${repo}" , branch: "${branch}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage("Build Docker image") {
|
||||
steps {
|
||||
script {
|
||||
//def customImage = docker.build("my-image:${env.BUILD_ID}")
|
||||
def imageName = "registry.dev.osnawiki.de/${env.Repo.replace('https://gitea.dev.osnawiki.de/','').replaceFirst('/','#').replaceAll('/','').replaceAll('\\.','').replace('#','-')}:${env.Branch.toLowerCase()}-${env.BUILD_NUMBER}"
|
||||
imageName = imageName.replace('--','-')
|
||||
echo "Baue Image ${imageName}"
|
||||
customImage = docker.build(imageName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage("Push image") {
|
||||
steps {
|
||||
script {
|
||||
withDockerRegistry(credentialsId: 'registrycredentials', url: "https://registry.dev.osnawiki.de") {
|
||||
customImage.push("latest")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user