티스토리 뷰

728x90

pipeline {
    agent {
        kubernetes {
            inheritFrom 'seunggabi-batch' 
            defaultContainer 'seunggabi-batch'
        }
    }

    environment {
        COUNTRY = "kr"
        ENV = "prod"
        CLASS = "seunggabi.batch.job.SparkSubmitJob"
    }

    stages {
        stage('Run Job') {
            steps {
                script {
                    ARGS = sorted(params).collect { /$it.value/ } join ","
                }
                sh "/app/static/sh/emr.sh 1 20 ${COUNTRY} ${ENV} ${CLASS} \"${ARGS}\""
            }
        }
    }
}

@NonCPS
def sorted(def m){
    m.sort { /$it.key/ }
}

https://stackoverflow.com/questions/63121651/sort-map-by-value-in-groovy-jenkins-pipeline-script/73643428#73643428

 

Sort map by value in Groovy jenkins pipeline script

How to do custom sort of Map for example by value in Jekins pipeline script? This code doesn't quite work in Jenkins pipeline script: Map m =[ james :"silly boy", janny :"...

stackoverflow.com

https://issues.jenkins.io/browse/JENKINS-44924?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel&showAll=true 

 

[JENKINS-44924] pipeline groovy script - Sort a list with custom comparator or closure not sorting - Jenkins Jira

If I could have viably fixed this, I would have already - the transformation done to Groovy code to be able to be durable makes a lot of things more or less impossible to get working correctly. We've dealt with as many of them as we could without having to

issues.jenkins.io

 

728x90
댓글