Skip to content

Support for multiple tags #10

@smolse

Description

@smolse

Version: 1.1.2

Currently, when multiple tags are passed to the action (e.g., tags: key_a:value_a,key_b:value_b), test runs in Datadog CI Visibility have only one tag key attached with not quite correct value (e.g., tag key is key_a and key value is value_a,key_b:value_b). The action passes inputs.tags value in a single --tags flag to datadog-ci in the JUnit file upload steps, but datadog-ci tool expects each tag to be passed in its own --tags flag. However, it's also possible to pass tags to datadog-ci through an environment variable DD_TAGS, in which case datadog-ci actually seems to split them by comma: https://github.com/DataDog/datadog-ci/blob/master/src/commands/junit/upload.ts#L156.

Potential solution could be to pass tags via an environment variable instead of --tags flag, i.e.:

- name: Upload the JUnit files
   if: ${{ inputs.logs != 'true' }}
   shell: bash
   run: |
     datadog-ci junit upload \
       --service ${{ inputs.service }} \
       --max-concurrency ${{ inputs.concurrency }} \
       ${{ inputs.files }}
   env:
     DATADOG_API_KEY: ${{ inputs.api-key }}
     DATADOG_SITE: ${{ inputs.datadog-site }}
     DD_ENV: ${{ inputs.env }}
     DD_TAGS: ${{ inputs.tags }}

In this case passing multiple comma separated tags to inputs.tags should work.

Alternatively, I believe double quotes surrounding ${{ inputs.tags }} in the datadog-ci command can be removed like this:

datadog-ci junit upload \
  --service ${{ inputs.service }} \
  --tags ${{ inputs.tags }} \
  --max-concurrency ${{ inputs.concurrency }} \
  ${{ inputs.files }}

Then multiple whitespace separated tags can be passed to inputs.tags according to the clipanion docs which is used by datadog-ci for CLI implementation: https://mael.dev/clipanion/docs/options#arrays

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions