Jenkinsfile如何使用Array Intro Array?

时间:2019-07-12 14:27:54

标签: jenkins jenkins-pipeline devops pipeline changelist

我正在使用git changeLogSets插件(https://wiki.jenkins.io/display/JENKINS/Git+Changelog+Plugin

我正在尝试使用插件发送邮件。

我想从代码中发送一个变量。

样本;当我打印变量echo $ {exp}时,我希望它打印所有更改。如何使用数组或其他替代方法?

def changeLogSets = currentBuild.changeSets
for (int i = 0; i < changeLogSets.size(); i++) {
    def entries = changeLogSets[i].items
    for (int j = 0; j < entries.length; j++) {
        def entry = entries[j]
        echo "${entry.commitId} by ${entry.author} on ${new Date(entry.timestamp)}: ${entry.msg}"
        def files = new ArrayList(entry.affectedFiles)
        for (int k = 0; k < files.size(); k++) {
            def file = files[k]
            echo "  ${file.editType.name} ${file.path}"
        }
    }
}

0 个答案:

没有答案