mirror of
https://github.com/DarkflameUniverse/NexusDashboard.git
synced 2024-11-22 13:37:21 +00:00
Merge pull request #6 from DarkflameUniverse/jenkins-testing
Jenkins testing
This commit is contained in:
commit
256ea19bfc
21
Jenkinsfile
vendored
21
Jenkinsfile
vendored
@ -5,8 +5,8 @@ properties([
|
|||||||
branchFilter: 'origin/(.*)',
|
branchFilter: 'origin/(.*)',
|
||||||
defaultValue: 'origin/main',
|
defaultValue: 'origin/main',
|
||||||
description: '',
|
description: '',
|
||||||
name: 'BRANCH',
|
name: 'GIT_BRANCH',
|
||||||
quickFilterEnabled: false,
|
quickFilterEnabled: true,
|
||||||
selectedValue: 'DEFAULT',
|
selectedValue: 'DEFAULT',
|
||||||
sortMode: 'NONE',
|
sortMode: 'NONE',
|
||||||
tagFilter: '*',
|
tagFilter: '*',
|
||||||
@ -17,13 +17,12 @@ properties([
|
|||||||
])
|
])
|
||||||
|
|
||||||
node('worker'){
|
node('worker'){
|
||||||
|
currentBuild.setDescription(params.GIT_BRANCH)
|
||||||
currentBuild.setDescription(params.BRANCH)
|
|
||||||
|
|
||||||
stage('Clone Code'){
|
stage('Clone Code'){
|
||||||
checkout([
|
checkout([
|
||||||
$class: 'GitSCM',
|
$class: 'GitSCM',
|
||||||
branches: [[name: params.BRANCH]],
|
branches: [[name: params.GIT_BRANCH]],
|
||||||
extensions: [],
|
extensions: [],
|
||||||
userRemoteConfigs: [
|
userRemoteConfigs: [
|
||||||
[
|
[
|
||||||
@ -34,19 +33,19 @@ node('worker'){
|
|||||||
])
|
])
|
||||||
}
|
}
|
||||||
def tag = ''
|
def tag = ''
|
||||||
stage("Build Container"){
|
stage('Build Container'){
|
||||||
if (params.BRANCH.contains('main')){
|
if (params.BRANCH.contains('main')){
|
||||||
tag = 'latest'
|
tag = 'latest'
|
||||||
} else {
|
} else {
|
||||||
tag = params.BRANCH.replace('\\', '-')
|
tag = params.BRANCH.replace('\\', '-')
|
||||||
}
|
}
|
||||||
sh "docker build -t aronwk/nexus-dashboard:${tag} ."
|
sh "docker build -t aronwk/nexus-dashboard:$tag ."
|
||||||
}
|
}
|
||||||
stage("Push Container"){
|
stage('Push Container'){
|
||||||
withCredentials([usernamePassword(credentialsId: 'docker-hub-token', passwordVariable: 'password', usernameVariable: 'username')]) {
|
withCredentials([usernamePassword(credentialsId: 'docker-hub-token', passwordVariable: 'password', usernameVariable: 'username')]) {
|
||||||
sh "docker login -u ${username} -p ${password}"
|
sh "docker login -u $username -p $password"
|
||||||
sh "docker push aronwk/nexus-dashboard:${tag}"
|
sh "docker push aronwk/nexus-dashboard:$tag"
|
||||||
sh 'docker logout'
|
sh "docker logout"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user