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

--git-repository-url ignored ? #1498

Open
rrey opened this issue Nov 29, 2024 · 3 comments
Open

--git-repository-url ignored ? #1498

rrey opened this issue Nov 29, 2024 · 3 comments
Assignees
Labels
ci-visibility Related to [junit, gate, metric, tag, trace, dora, deployment] enhancement New feature or request

Comments

@rrey
Copy link

rrey commented Nov 29, 2024

Bug description

Using the datadog junit upload action, the --git-repository-url provided through extra-args is not changing the way the git metadata are retrieved and seems to always retrieve the data from the local git repo.

Example ; by specifying --git-repository-url [email protected]/<myorg>/<myrepo>.git#<commi-sha>
I would expect that the tag git.repository.name visible in the tests tags would be <myorg>/<myrepo> but it is the local repository instead.

Describe what you expected

The git tag content visible in datadog shows the metadata for the repository specified in --git-repository-url .

Steps to reproduce the issue

From a repository call the github action to upload a report with the extra-args providing the --git-repository-url:

      - name: Send integration test report to Datadog Test Visibility
        if: always()
        uses: datadog/junit-upload-github-action@c4b57b587ae0e3ed618a1f0e7a7d260cfde53032 # v1.4.0 (use commit hash for codacy compliance)
        with:
          api_key: ${{ env.DATADOG_API_KEY }}
          service: dome-service
          files: report.xml
          env: testing
          extra-args: --git-repository-url [email protected]/<some-org>/<some-other-repo>.git#<some-sha>

Example of command execution visible in my github actions logs:

 npx @datadog/datadog-ci@latest junit upload \
    --service example \
    --logs \
    --max-concurrency 20 \
    --xpath-tag test.source.file=/testcase/../@name --git-repository-url [email protected]/<myorg>/<myrepo>.git#<commi-sha> \
    report.xml

Additional context

Github action 1.4.0

Command

junit

@rrey rrey added the bug Something isn't working label Nov 29, 2024
@github-actions github-actions bot added the ci-visibility Related to [junit, gate, metric, tag, trace, dora, deployment] label Nov 29, 2024
@juan-fernandez
Copy link
Contributor

hey @rrey ! Thanks for the report. This is indeed confusing, but --git-repository-url is only used in the git upload process. This is the equivalent to the --repository-url option in the git-metadata upload command: https://github.com/DataDog/datadog-ci/tree/master/src/commands/git-metadata#upload

This option will not change the tags reported in the tests (such as git.repository.name).

What's your use case? What do you want to change the repository URL for?

@juan-fernandez juan-fernandez self-assigned this Nov 29, 2024
@rrey
Copy link
Author

rrey commented Dec 2, 2024

Thanks for the fast answer !

The github action is triggered in a repo that is not the repo where the tests are. So when we upload the report, we want the git metadate to be the one from the repo that contains the tests.

I tried setting DD_GIT_REPOSITORY_URL and DD_GIT_COMMIT_SHA environment variable and it is giving the proper results.

I think that you have an error in the doc here because the --git-repository-url option is listed but we are in a section talking about the datadog-ci junit upload command.
Based on your previous comment it should be --repository-url

can you confirm that the --repository-url supports providing the ref (branch or commit) along with the URL ?
Using the env vars works and I can provide the commit, if I go back to the --repository-url I'd like to have the commit provided as well.

@juan-fernandez
Copy link
Contributor

The github action is triggered in a repo that is not the repo where the tests are. So when we upload the report, we want the git metadate to be the one from the repo that contains the tests.

I see. That's a use case that's not supported at all in our product at the moment.

I think that you have an error in the doc here because the --git-repository-url option is listed but we are in a section talking about the datadog-ci junit upload command.
Based on your previous comment it should be --repository-url

the option is indeed --git-repository-url. My comment was to clarify what that flag does, which is the same as what --repository-url does for datadog-ci git-metadata upload. This flag does not support your use case.

@juan-fernandez juan-fernandez added enhancement New feature or request and removed bug Something isn't working labels Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-visibility Related to [junit, gate, metric, tag, trace, dora, deployment] enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants