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

oidc: Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable #1594

Open
ssbarnea opened this issue Oct 3, 2024 · 6 comments
Open

oidc: Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable #1594

ssbarnea opened this issue Oct 3, 2024 · 6 comments
Assignees
Labels
Area: Report Upload Issues with pre-ingest report uploading bug Something isn't working high High Priority Issues (to be fixed within 2 sprints)

Comments

@ssbarnea
Copy link

ssbarnea commented Oct 3, 2024

A very recent regression appeared for OIDC in the last couple of days and today I faces same error in two repositories that are using the OIDC authentication for uploading the coverage results.

Codecov: Failed to get OIDC token with url: https://codecov.io/. Error message: Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable

We googled the error and we checked if we have the required permissions as below, but still we seen the failure.

    permissions:
      id-token: write

Considering that https://github.com/codecov/codecov-action/releases/tag/v4.6.0 was release two days ago, I wonder if that regression was not introduce in this release as the upload was working fine before. We use the v4 versioning tag because we assumed that minor version bumps would not introduce breakages.

Examples:

@ssbarnea
Copy link
Author

ssbarnea commented Oct 3, 2024

Apparently v4.6.0 release included a single relevant change well hidden inside the long list of CI/build changes, as #1511 -- and it seems to be related to oidc.

Less important, but I bet others will appreciate if you would tune the changelog generation to at least use sections for the type of changes made or even to hide the non-relevant changes, so they would be easier to read.

@ssbarnea
Copy link
Author

ssbarnea commented Oct 4, 2024

@thomasrockhu-codecov can you please look into this? We have the confirmation that this was a regression introduced by v4.6.0. I would personally unpublish it or at least move the v4 tag to point to v4.5.0 which is last known to work.

Minor version changes are not supposed to break integration.

What makes it worse is the if we switch to @v4.5.0 we will see dependabot try to update to @v4.6.0 later and if that is inside a reusable workflow that is in a different repository, we might never know that it will revert the workaround. We would also have to configure dependabot to prevent it from picking this version.

@njzjz
Copy link

njzjz commented Oct 5, 2024

Another workaround:

      - name: Upload coverage reports to Codecov
        uses: codecov/codecov-action@v4
        with:
          use_oidc: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) }}

The error only happens when the id-token write permission is not granted (i.e. in a PR from a forked repository).

andreascorti added a commit to andreascorti/AgnosUI that referenced this issue Oct 9, 2024
andreascorti added a commit to AmadeusITGroup/AgnosUI that referenced this issue Oct 9, 2024
@drazisil-codecov drazisil-codecov added bug Something isn't working high High Priority Issues (to be fixed within 2 sprints) labels Oct 10, 2024
mergify bot pushed a commit to aws/aws-cdk that referenced this issue Nov 14, 2024
For PR from forks, OIDC doesn't currently work with the latest version of the GitHub Action. 

[Example failure](https://github.com/aws/aws-cdk/actions/runs/11834319601/job/32974759899?pr=32121):

```console
Run codecov/codecov-action@v4
Error: Codecov: Failed to get OIDC token with url: https://codecov.io/. Error message: Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable
```

See codecov/codecov-action#1594

Revert back to token until we validate a fix. 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@thomasrockhu-codecov thomasrockhu-codecov self-assigned this Nov 20, 2024
@thomasrockhu-codecov
Copy link
Contributor

@ssbarnea I'm so sorry this never showed up in my inbox. I see that the workaround given hopefully works, but I wanted to check up and see if this was still an issue. If so, can you point me to a recent CI run that is broken? Also, is v5 working for this instance?

@thomasrockhu-codecov thomasrockhu-codecov added the Area: Report Upload Issues with pre-ingest report uploading label Nov 20, 2024
snejus added a commit to snejus/beets that referenced this issue Nov 23, 2024
snejus added a commit to beetbox/beets that referenced this issue Nov 23, 2024
mrgrain added a commit to iph/cdk-from-cfn that referenced this issue Nov 27, 2024
@mrgrain
Copy link

mrgrain commented Nov 27, 2024

@ssbarnea I'm so sorry this never showed up in my inbox. I see that the workaround given hopefully works, but I wanted to check up and see if this was still an issue. If so, can you point me to a recent CI run that is broken? Also, is v5 working for this instance?

v5 is not working but failing with a seemingly different error:

curl: (3) URL using bad/illegal format or missing URL

https://github.com/cdklabs/cdk-from-cfn/actions/runs/12015198565/job/33492743470?pr=751#step:9:63

Also see #1705

github-merge-queue bot pushed a commit to cdklabs/cdk-from-cfn that referenced this issue Nov 27, 2024
* Revert "chore(deps): bump codecov/codecov-action from 4 to 5 (#747)"

This reverts commit 6c47b8b.

* use 4.5.0

See: codecov/codecov-action#1594 (comment)

---------

Co-authored-by: Momo Kornher <[email protected]>
@ssbarnea
Copy link
Author

ssbarnea commented Nov 27, 2024

Another workaround:

  - name: Upload coverage reports to Codecov
    uses: codecov/codecov-action@v4
    with:
      use_oidc: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) }}

The error only happens when the id-token write permission is not granted (i.e. in a PR from a forked repository).

This is what we had until dependabot updated the action and broke the upload.

Yes, the error does reproduce as the first thing I attempted was to rerun the job.

I should mention that this is using codecov from within a reusable workflow. This means that some environment variables might not be available. Still, https://josh-ops.com/posts/github-actions-oidc-reusable-workflows/ makes me believe it should be.

On the other hand. I seen there something very unstable, adding an url as argument to another url without escaping. Almost for sure this will produce an invalid URL. The code logic needs to be update and maybe make it easier to debug in case of failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Report Upload Issues with pre-ingest report uploading bug Something isn't working high High Priority Issues (to be fixed within 2 sprints)
Projects
None yet
Development

No branches or pull requests

5 participants