简体   繁体   English

过滤发布到Artifactory的工件

[英]Filter artifacts that get published to Artifactory

I am trying to filter the artifacts that get published to Artifactory and running into two issues: 我试图过滤发布到Artifactory的工件,并遇到两个问题:

1) The include/exclude filtering is not working for me as expected. 1)包含/排除过滤对我不起作用。 2) I have not found a way to set it to exclude unpublished artifacts from buildinfo. 2)我还没有找到一种方法来将其设置为从buildinfo中排除未发布的工件。


1) The relevant section of my jenkinsfile looks like this: 1)我的jenkinsfile的相关部分如下所示:

    def now = new Date()
    def changelist  = now.format("yyyyMMddHHmm", TimeZone.getTimeZone('US/Central'))

    def server = Artifactory.server env.ARTIFACTORY_SERVER_ID
    server.credentialsId = 'creds-artifactory'

    def rtMaven = Artifactory.newMavenBuild()
    rtMaven.resolver server: server, releaseRepo: 'releases-repo', snapshotRepo: 'snapshots-repo'
    rtMaven.deployer server: server, releaseRepo: 'candidates-repo', snapshotRepo: 'snapshots-repo'

    rtMaven.deployer.artifactDeploymentPatterns.addInclude("myGroupId:myDistArtifactId*")

    buildInfo = rtMaven.run pom: 'pom.xml', goals: "clean install -B -Dchangelist=.${changelist}".toString()

    server.publishBuildInfo buildInfo

I have tried also to exclude with no lock. 我也尝试不加锁定地排除在外。 The only way I got this to work was to do a simple filter like exclude "*.zip". 我让它起作用的唯一方法是做一个简单的过滤器,例如排除“ * .zip”。 But have not found any other way to make it work based on artifactId. 但是还没有找到任何其他方法可以使其基于artifactId工作。 What am I missing? 我想念什么? Based on the docs I saw this should be working. 根据文档,我看到这应该可以工作。

2) The other issue is that the excluded artifacts (metadata) still get published since they are in my buildInfo but in Artifactory they show as being deleted (ie not attached binary). 2)另一个问题是,排除的工件(元数据)仍在我的buildInfo中发布,但在Artifactory中却显示为已删除(即未附加二进制文件)。 is there a way to update buildInfo and remove the excluded artifacts? 有没有一种方法来更新buildInfo并删除排除的工件?

Maybe this documentation article will be helpful, see uploading example: 也许这篇文档文章会有所帮助,请参见上传示例:

def uploadSpec = """{
    "files": [
      {
        "pattern": "bazinga/*froggy*.zip",
        "target": "bazinga-repo/froggy-files/"
      }
    ]
}"""
server.upload spec: uploadSpec

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM