Skip to content

Instantly share code, notes, and snippets.

@ravibhure
Forked from richid/Jenkinsfile
Created June 18, 2020 14:42
Show Gist options
  • Select an option

  • Save ravibhure/0275445c10f41ec8efae0261116a173d to your computer and use it in GitHub Desktop.

Select an option

Save ravibhure/0275445c10f41ec8efae0261116a173d to your computer and use it in GitHub Desktop.

Revisions

  1. @richid richid revised this gist Jan 29, 2018. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions Jenkinsfile
    Original file line number Diff line number Diff line change
    @@ -4,10 +4,11 @@ def version = env.VERSION
    def jobs = [:]

    if (applications.size() < 1) {
    error("ERROR: APPLICATIONS must be a comma-delimited list of apps to build")
    error("ERROR: APPLICATIONS must be a comma-delimited list of applications to build")
    }

    for (def app : applications) {
    for (int i = 0; i < applications.size(); i++) {
    def app = applications[i]
    jobs["jobs-${app}"] = {
    node {
    stage("Build ${app}") {
  2. @richid richid revised this gist Jan 29, 2018. No changes.
  3. @richid richid created this gist Jan 29, 2018.
    35 changes: 35 additions & 0 deletions Jenkinsfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    def applications = env.APPLICATIONS.split(",").findAll { it }.collect { it.trim() }
    def environment = env.ENVIRONMENT
    def version = env.VERSION
    def jobs = [:]

    if (applications.size() < 1) {
    error("ERROR: APPLICATIONS must be a comma-delimited list of apps to build")
    }

    for (def app : applications) {
    jobs["jobs-${app}"] = {
    node {
    stage("Build ${app}") {
    build job: 'Application-Builder', parameters: [
    string(name: 'APPLICATION', value: app),
    string(name: 'ENVIRONMENT', value: environment),
    string(name: 'VERSION', value: version)
    ]
    }
    }
    }
    }

    pipeline {
    agent none
    stages {
    stage('Build apps(s)') {
    steps {
    script {
    parallel jobs
    }
    }
    }
    }
    }