Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pipelineJob('seedJob') {
- description('SeedJob for generate jobs by jobdsl plugin')
- logRotator {
- numToKeep(10)
- artifactNumToKeep(10)
- }
- triggers {
- gitlab {
- secretToken("s3cr3tt0k3n_h3r3")
- triggerOnNoteRequest(false)
- }
- }
- definition {
- cpsScm {
- scm {
- git {
- extensions {
- wipeOutWorkspace()
- }
- remote {
- branch('origin/master')
- url("$GIT_REPOSITORY_URL/jenkins_pipelines.git")
- credentials('creds_on_gitlab')
- }
- }
- }
- scriptPath('pipelines/common/seedJob.Jenkinsfile')
- }
- }
- }
- ///////////////////////////////////////////////////////////////////////////////
- pipeline {
- agent any
- stages {
- stage ('Download git repo jenkins_pipeline') {
- steps {
- checkout([$class: 'GitSCM',
- branches: [[name: '*/master']],
- userRemoteConfigs: [[credentialsId: 'creds_on_gitlab',
- url: "$GIT_REPOSITORY_URL/jenkins_pipelines.git"]]
- ])
- script {
- switch(JENKINS_INSTANCE) {
- case ~/.*prod.*/:
- SEED_JOBS_TARGETS = [
- "jobs/common/**/*.groovy",
- "jobs/crypto-service/**/*.groovy",
- "jobs/domain/prod/*.groovy"].join('\n')
- break
- default:
- throw new RuntimeException("please, define 'JENKINS_INSTANCE' variable")
- }
- }
- jobDsl targets: "${SEED_JOBS_TARGETS}",
- removedJobAction: 'DELETE'
- }
- }
- stage('PROD Display list management') {
- when {
- expression { JENKINS_INSTANCE.endsWith('prod') }
- }
- steps {
- jobDsl targets: ['views/listview_prod.groovy'].join('\n'),
- ignoreMissingFiles: true
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment