Files
jenkins-pipelines/pipelines/jobs-dsl/jobs-dsl.groovy
2025-02-04 16:15:21 +03:00

51 lines
1.7 KiB
Groovy

@Library('shared-lib') _
import tech.avroid.scm.Git
properties([
disableConcurrentBuilds(),
parameters([
string(name: 'PROJECT_NAME', defaultValue: 'DevOps/jenkins-pipelines'),
string(name: 'BRANCH_NAME', defaultValue: 'master')
]),
])
podTemplate(workspaceVolume: emptyDirWorkspaceVolume(memory: false), yaml: getPodTemplate('alpine')) {
node(POD_LABEL) {
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',
'Release-activity/Platformng'
]
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'
}
}
}