Jenkins Artifactory 插件:artifactDeploymentPatterns.addInclude 等效于声明性管道

Jenkins Artifactory plugin: artifactDeploymentPatterns.addInclude equivalent for declarative pipelines

在脚本化的 Jenkins 管道中,我使用了以下功能:

rtMaven.deployer.artifactDeploymentPatterns.addInclude("frog*")

在声明性管道中执行此操作的等效方法是什么?

declarative examples on the wiki makes no mention of it, whereas the scripted 个示例可以。

很明显,看插件的源码,我想要的功能都有,就是不知道怎么调用。

https://github.com/jfrog/jenkins-artifactory-plugin/blob/ebce86efdf1e1a7c38a9ad1ed6a8063b58ecdf3a/src/main/java/org/jfrog/hudson/pipeline/declarative/steps/maven/MavenDeployerStep.java#L26

有效的脚本代码:

server = Artifactory.server("myServer")
rtMaven = Artifactory.newMavenBuild()
rtMaven.tool = config.toolMaven // Tool name from Jenkins configuration
rtMaven.deployer releaseRepo: "libs-release-local", snapshotRepo: "libs-snapshot-local", server: server
rtMaven.resolver releaseRepo: "libs-release", snapshotRepo: "libs-snapshot", server: server
rtMaven.deployer.deployArtifacts = false // Disable artifacts deployment during Maven run
if (config.includeFilterPattern) {
    rtMaven.deployer.artifactDeploymentPatterns.addInclude(config.includeFilterPattern)
}
buildInfo = Artifactory.newBuildInfo()
buildInfo.name = "myBuild"
buildInfo.env.capture = true

我的声明性代码目前如下所示:

rtMavenResolver (
        id: "resolver-id",
        serverId: "myServer",
        releaseRepo: "libs-release",
        snapshotRepo: "libs-snapshot"
)

rtMavenDeployer (
        id: "deployer-id",
        serverId: "myServer",
        releaseRepo: "libs-release-local",
        snapshotRepo: "libs-snapshot-local"
)

rtBuildInfo (
        captureEnv: true,
        buildName: "myBuild"
)

//... mvn clean install

rtPublishBuildInfo (
        serverId: "myServer"
)

一旦你知道如何操作就非常简单(在撰写本文时未记录):

rtMavenDeployer (
        id: "deployer-id",
        serverId: "myServer",
        releaseRepo: "libs-release-local",
        snapshotRepo: "libs-snapshot-local",
        includePatterns: ["frog*"]
)