使用Process DSL插件groovy脚本创建一个新的Jenkins作业

问题描述

我需要通过复制现有maven项目中的配置来创建Jenkins新工作。 我想通过常规脚本并使用“我具有Process DSL”插件来执行此操作。我编写了下面的脚本,该脚本能够创建新工作,但是我遇到了GIT SSH URL问题

String gitRepository = 'ssh://[email protected]:1111/cegp/abc-automation-test'
String buildBranch = 'develop'
String projectName = 'APMSmokeTesting'
String credentialIDGithub = '61668d1b-3336-4c4d-90d7-721017049e36'


// job definition
mavenJob(projectName) {
    logRotator {
        numToKeep(20)
    }
    wrappers {
        preBuildCleanup()
    }
    description('Build the Java project: ' + gitRepository)
    
    scm {
        git {
            branch(buildBranch)
            remote {
                github (gitRepository)
                credentials(credentialIDGithub)
            }
        }
    }
    
    triggers {
        scm('@daily')
    }
    wrappers {
        goals('clean verify -Dtags="APMSmokeTesting"')
    }
}

根据上述配置,在新作业源代码管理中,存储库URL 应为ssh://[email protected]:1111 / cegp /abc-automation-test.git,因为我只需要执行SSH。 但是,上面的脚本是填充为 {3}}的填充存储库URL 。 您能帮我解决这个问题吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)