Files
jenkins-pipelines/pipelines/jobs-dsl/jobs-dsl.groovy
aleksandr.vodyanov 8f7b47fe0d [DO-290] reafactoring Release-activities (!17)
Reviewed-on: https://git.avroid.tech/DevOps/jenkins-pipelines/pulls/17
Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech>
Co-committed-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech>
2024-02-26 21:09:00 +03:00

61 lines
1.9 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: hostPathWorkspaceVolume(hostPath: "/data"),
yaml: '''
apiVersion: v1
kind: Pod
spec:
containers:
- name: linux
image: harbor.avroid.tech/devops/base-build-image:1.0
tty: true
resources:
limits:
cpu: 300m
memory: 256Mi
requests:
cpu: 300m
memory: 256Mi
imagePullPolicy: Always
imagePullSecrets:
- name: harbor-registry-secret
'''
) {
node(POD_LABEL) {
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)
}
}
}
}