2022-01-16 18:22:00 +00:00
|
|
|
properties([
|
|
|
|
parameters([
|
|
|
|
gitParameter(
|
|
|
|
branch: '',
|
|
|
|
branchFilter: 'origin/(.*)',
|
2022-01-16 18:28:21 +00:00
|
|
|
defaultValue: 'origin/main',
|
2022-01-16 18:22:00 +00:00
|
|
|
description: '',
|
|
|
|
name: 'BRANCH',
|
|
|
|
quickFilterEnabled: false,
|
2022-01-16 18:28:21 +00:00
|
|
|
selectedValue: 'DEFAULT',
|
2022-01-16 18:22:00 +00:00
|
|
|
sortMode: 'NONE',
|
|
|
|
tagFilter: '*',
|
2022-01-16 18:28:21 +00:00
|
|
|
useRepository: 'git@github.com:DarkflameUniverse/NexusDashboard.git',
|
2022-01-16 18:22:00 +00:00
|
|
|
type: 'PT_BRANCH'
|
|
|
|
)
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
node('worker'){
|
|
|
|
stage('Clone Code'){
|
|
|
|
checkout([
|
|
|
|
$class: 'GitSCM',
|
|
|
|
branches: [[name: params.BRANCH]],
|
|
|
|
extensions: [],
|
|
|
|
userRemoteConfigs: [
|
|
|
|
[
|
|
|
|
credentialsId: 'aronwk',
|
2022-01-16 18:28:21 +00:00
|
|
|
url: 'git@github.com:DarkflameUniverse/NexusDashboard.git'
|
2022-01-16 18:22:00 +00:00
|
|
|
]
|
|
|
|
]
|
|
|
|
])
|
|
|
|
}
|
|
|
|
def tag = ''
|
|
|
|
stage("Build Container"){
|
2022-01-16 18:28:21 +00:00
|
|
|
if (params.BRANCH.contains('main')){
|
2022-01-16 18:22:00 +00:00
|
|
|
tag = 'latest'
|
|
|
|
} else {
|
|
|
|
tag = params.BRANCH.replace('\\', '-')
|
|
|
|
}
|
|
|
|
sh "docker build -t aronwk/dlu-account_manager:${tag} ."
|
|
|
|
}
|
|
|
|
stage("Push Container"){
|
|
|
|
withCredentials([usernamePassword(credentialsId: 'docker-hub-token', passwordVariable: 'password', usernameVariable: 'username')]) {
|
|
|
|
sh "docker login -u ${username} -p ${password}"
|
|
|
|
sh "docker push aronwk/dlu-account_manager:${tag}"
|
|
|
|
sh 'docker logout'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|