Skip to content

Add a credentials provider for Github Azure OIDC#965

Merged
renaudhartert-db merged 1 commit intomainfrom
rh/azure-github-oidc-verified
Jul 5, 2024
Merged

Add a credentials provider for Github Azure OIDC#965
renaudhartert-db merged 1 commit intomainfrom
rh/azure-github-oidc-verified

Conversation

@renaudhartert-db
Copy link
Copy Markdown
Contributor

@renaudhartert-db renaudhartert-db commented Jul 5, 2024

Note: this PR is a copy of PR #950 which could not be merged because of some unverified commits. Please check PR #950 for the original review and comments.

Changes

This PR adds a CredentialsProvider to authenticate with Azure from Github workflows.

The code is inspired by a similar feature already implemented in the Python SDK. It works as follows:

  1. Obtain an ID token from Azure leveraging the env variables ACTIONS_ID_TOKEN_REQUEST_URL and ACTIONS_ID_TOKEN_REQUEST_TOKEN as explained here.
  2. Exchange that ID token for an auth token.

Tests

Added a test suite which covers all the added code paths. I've also confirmed in my own Github Action that the code is properly able to authenticate.

Note: I'm not super happy with how errors are compared (i.e. using a prefix) which is a little brittle. A better approach would be to leverage errors.As or errors.Is. However, it is difficult to do that at the moment without adding ad hoc new error types. A longer term solution would probably involve standardizing the package around a set of clearly defined error types shared by all implementations of CredentialsProvider in config. That is out of the scope of this PR though.

  • make test passing
  • make fmt applied
  • relevant integration tests applied

@renaudhartert-db renaudhartert-db changed the title Copy changes from PR 950 Add a credentials provider for Github Azure OIDC Jul 5, 2024
@renaudhartert-db renaudhartert-db requested a review from mgyucht July 5, 2024 12:05
@renaudhartert-db renaudhartert-db marked this pull request as ready for review July 5, 2024 12:05
@renaudhartert-db renaudhartert-db added this pull request to the merge queue Jul 5, 2024
Merged via the queue into main with commit 78b367a Jul 5, 2024
@renaudhartert-db renaudhartert-db deleted the rh/azure-github-oidc-verified branch July 5, 2024 12:20
tanmay-db added a commit that referenced this pull request Jul 8, 2024
### Internal Changes

 * Improve Changelog by grouping changes ([#962](#962)).

### Other Changes

 * Add ChangelogConfig to Generator struct ([#967](#967)).
 * Add DataPlane API Support ([#936](#936)).
 * Add a credentials provider for Github Azure OIDC ([#965](#965)).
 * Added more error messages for retriable errors (timeouts, etc.) ([#963](#963)).
 * Parse API Error messages with `int` error codes ([#960](#960)).
@tanmay-db tanmay-db mentioned this pull request Jul 8, 2024
github-merge-queue bot pushed a commit that referenced this pull request Jul 8, 2024
## 0.43.1

### Major Changes and Improvements:
* Add a credentials provider for Github Azure OIDC
([#965](#965)).
* Add DataPlane API Support
([#936](#936)).
* Added more error messages for retriable errors (timeouts, etc.)
([#963](#963)).

### Internal Changes
* Add ChangelogConfig to Generator struct
([#967](#967)).
* Improve Changelog by grouping changes
([#962](#962)).
* Parse API Error messages with `int` error codes
([#960](#960)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants