Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mix of pipeline and job level tags does not tag GHA job #1296

Open
jmeickle-theaiinstitute opened this issue May 1, 2024 · 4 comments
Open
Assignees
Labels
bug Something isn't working ci-visibility Related to [junit, gate, metric, tag, trace, dora, deployment]

Comments

@jmeickle-theaiinstitute
Copy link

Bug description

In Github Actions, when running this command in a job:

datadog-ci tag --level=pipeline --tags repro:dockerless &&
datadog-ci tag --level=job --tags jobrepro:dockerless-job

The Github Actions step output is:

Run datadog-ci tag --level=pipeline --tags repro:dockerless &&
  datadog-ci tag --level=pipeline --tags repro:dockerless &&
  datadog-ci tag --level=job --tags jobrepro:dockerless-job
  shell: bash --noprofile --norc -e -o pipefail {0}
  env:
   [REDACTED]
    DATADOG_API_KEY: ***
Run '/home/runner/k8s/index.js'
  shell: /home/runner/externals/node16/bin/node {0}
Tags sent
Tags sent

(That is, it runs twice successfully)

This is a case where we have one pipeline with two parallel jobs, both running these tagging commands. Using the example above, repro shows up as a tag on the pipeline but jobrepro does not show up as a tag on the job (in any run).

Describe what you expected

Either the datadog-ci tool should tag the data, or it should fail if this is an invalid usage

Steps to reproduce the issue

No response

Additional context

v2.33.1 of datadog-ci

Command

tag

@jmeickle-theaiinstitute jmeickle-theaiinstitute added the bug Something isn't working label May 1, 2024
@github-actions github-actions bot added the ci-visibility Related to [junit, gate, metric, tag, trace, dora, deployment] label May 1, 2024
@ManuelPalenzuelaDD
Copy link
Contributor

ManuelPalenzuelaDD commented May 6, 2024

Hi @jmeickle-theaiinstitute ! There are some limitations around adding custom tags to GitHub jobs.

We have some docs related to this. The TLDR is that if the job name is changed using the name property OR you're using a matrix strategy to define jobs you need to make expose a DD_GITHUB_JOB_NAME env variable pointing to the real job name.

Could this be whats going on here? 👀

@benjamin-cribb-jane
Copy link

benjamin-cribb-jane commented May 16, 2024

datadog-ci tag --level job --tags pr_owner:<REDACTED>
  shell: /usr/bin/bash -e {0}
  env:
    PR_COMMENTS_ENABLED: false
    TAG: <REDACTED>
    DD_CIVISIBILITY_AGENTLESS_ENABLED: true
    DD_ENV: ci
    DD_SERVICE: fullstack
    DD_API_KEY: ***
    DD_GITHUB_JOB_NAME: Run e2e tests / Run E2E desktop on node 0
    DD_TAGS: pr_owner:<REDACTED>
    DATADOG_API_KEY: ***
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

100 59.2M  100 59.2M    0     0  [8]<REDACTED>
Tags sent

I've tried every possible combination of job name appearing anywhere in datadog or CICD. It's also silently failing to send tags to jobs which are not part of a matrix run. Both when tags are set as env variables, and when tags are attempted to be sent via datadog-ci, regardless of whether DD_GITHUB_JOB_NAME is provided or not provided.

[edit] Worth noting, my jobs are part of a reusable workflow triggered by a parent job

@ManuelPalenzuelaDD
Copy link
Contributor

ManuelPalenzuelaDD commented May 28, 2024

Hi @benjamin-cribb-jane , we recently had a bug that caused GitHub jobs' custom tags not to be added. We think that what might've happened is this:

  1. The first issue was due to the missing DD_GITHUB_JOB_NAME variable.
  2. We introduced a bug causing the GitHub jobs' custom tags behavior to break.
  3. You tried using the DD_GITHUB_JOB_NAME variable and it didn't work (likely due to the bug introduced at step 2).
  4. We fixed the bug introduced in step 2.
  • Could you try doing this one more time with the DD_GITHUB_JOB_NAME variable?
  • If you could also provide us an Org ID to look into this it'd be great.

Hopefully it works now! 🤞

@juan-fernandez
Copy link
Contributor

hey did you try those steps @benjamin-cribb-jane ? 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ci-visibility Related to [junit, gate, metric, tag, trace, dora, deployment]
Projects
None yet
Development

No branches or pull requests

4 participants