bugfix: add cleanws in pipelines (!20)

Reviewed-on: https://git.avroid.tech/DevOps/jenkins-pipelines/pulls/20
Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech>
Co-committed-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech>
This commit is contained in:
aleksandr.vodyanov
2024-02-27 17:56:26 +03:00
committed by Aleksandr Vodyanov
parent 7c906923e4
commit 8098ef59be
5 changed files with 162 additions and 128 deletions

View File

@@ -32,29 +32,37 @@ podTemplate(workspaceVolume: hostPathWorkspaceVolume(hostPath: "/data"),
'''
) {
node(POD_LABEL) {
stage('Get repository') {
def git = new Git(this, "$env.JENKINS_GIT_CREDENTIALS_SSH")
try {
stage('Get repository') {
def git = new Git(this, "$env.JENKINS_GIT_CREDENTIALS_SSH")
git.clone([urlRepo: "$env.JENKINS_GIT_REPOSITORY_SSH_URL/$params.PROJECT_NAME",
branch: "$params.BRANCH_NAME"])
}
stage('Run job dsl') {
List launchJobs = [ 'Release-activity/Tavro' ]
jobDsl(
targets: 'jobs-dsl/folders/*.groovy\n' +
'jobs-dsl/jobs/**/*.groovy\n' +
'jobs-dsl/views/**/*.groovy',
failOnSeedCollision: true,
lookupStrategy: 'JENKINS_ROOT',
removedJobAction: 'IGNORE',
removedViewAction: 'IGNORE',
removedConfigFilesAction: 'IGNORE'
)
launchJobs.each { job ->
build(job: job, wait: false)
git.clone([urlRepo: "$env.JENKINS_GIT_REPOSITORY_SSH_URL/$params.PROJECT_NAME",
branch: "$params.BRANCH_NAME"])
}
stage('Run job dsl') {
List launchJobs = [ 'Release-activity/Tavro' ]
jobDsl(
targets: 'jobs-dsl/folders/*.groovy\n' +
'jobs-dsl/jobs/**/*.groovy\n' +
'jobs-dsl/views/**/*.groovy',
failOnSeedCollision: true,
lookupStrategy: 'JENKINS_ROOT',
removedJobAction: 'IGNORE',
removedViewAction: 'IGNORE',
removedConfigFilesAction: 'IGNORE'
)
launchJobs.each { job ->
build(job: job, wait: false)
}
}
}
catch(err) {
echo 'ERROR: ' + err.getMessage()
currentBuild.result = 'FAILURE'
} finally {
cleanWs()
}
}
}