How to generate YAML Specs for any-task configurations

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

要約

The YAML Specs export does not show configuration maps for certain any-task plugin tasks from apps, such as the Generic Artifactory Deploy Task from the Artifactory for Bamboo app.

This article will use this task as an example.

環境

This applies to Bamboo versions 7.2 and above, which have the any-task command in YAML.

診断

When the plan is exported as YAML Specs, the any-task command will show as:

- any-task:
    plugin-key: org.jfrog.bamboo.bamboo-artifactory-plugin:artifactoryGenericTask
    configuration: {}

原因

The Specs exporter included in the Artifactory plugin does not include YAML configurations.

ソリューション

Export the plan as Java Specs and convert the Java to YAML

The Java Specs export will show the Task would export as:


Java Specs
new AnyTask(new AtlassianModule("org.jfrog.bamboo.bamboo-artifactory-plugin:artifactoryGenericTask")) 
  .configuration(new MapBuilder()
     .put("artifactory.generic.publishBuildInfo", "")
     .put("artifactory.generic.username", "")
     .put("artifactory.generic.specSourceChoice", "file") 
     .put("artifactory.task.buildNumber", "${bamboo.buildNumber}")
     .put("deployer.sharedCredentials", "Test") 
     .put("deployer.overrideCredentialsChoice", "sharedCredentials")
     .put("artifactory.task.buildName", "${bamboo.buildPlanName}")
     .put("artifactory.generic.resolveRepo", "")
     .put("artifactory.generic.deployPattern", "argh")
     .put("artifactory.generic.envVarsExcludePatterns", "*password*,*secret*,*security*,*key*") 
     .put("builder.artifactoryGenericBuilder.artifactoryServerId", "0")
     .put("artifactory.generic.file", "")
     .put("resolver.overrideCredentialsChoice", "")
     .put("artifactory.generic.useSpecsChoice", "legacyPatterns")
     .put("artifactory.generic.includeEnvVars", "true")
     .put("artifactory.generic.artifactSpecs", "")
     .put("artifactory.generic.password", "/* SENSITIVE INFORMATION */")
     .put("artifactory.generic.jobConfiguration", "{\n \"files\": [\n{\n \"pattern\":\".\", \n \"target\":\"/\"\n }\n ]\n}")
     .put("baseUrl", "http://bamboo:8085")
     .put("artifactory.generic.envVarsIncludePatterns", "")
     .put("artifactory.generic.resolvePattern", "")
     .put("builder.artifactoryGenericBuilder.deployableRepo", "blah")
     .put("captureBuildInfo", "true")
     .put("resolver.sharedCredentials", "")
     .put("buildInfoAggregation", "true")
     .build())))       



This could be converted to YAML as below. Any line that is not included will use the default. 

YAML Specs
- any-task:
     plugin-key: org.jfrog.bamboo.bamboo-artifactory-plugin:artifactoryGenericTask
        configuration:
          artifactory.generic.publishBuildInfo: true
          artifactory.generic.specSourceChoice: jobConfiguration
          artifactory.task.buildNumber: ${bamboo.buildNumber}                              
          deployer.overrideCredentialsChoice: noOverriding
          artifactory.task.buildName: ${bamboo.buildPlanName}
          artifactory.task.envVarsExcludePatterns: "*password*,*secret*,*security*,*key*"                      
          builder.artifactoryGenericBuilder.artifactoryServerId: 0
          artifactory.generic.useSpecsChoice: specs
          artifactory.generic.includeEnvVars: true
          artifactory.generic.jobConfiguration:
              |-
              {
                files: [
                  {
                    pattern: ".",
                    target: "/"
                  }
                ]
              }
          baseUrl: http://bamboo:8085
          captureBuildInfo: true
          buildInfoAggregation: true



Last modified on Mar 11, 2022

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.