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

CI tests for OIDC authentication #3074

Merged
merged 10 commits into from
Dec 20, 2023
Merged

CI tests for OIDC authentication #3074

merged 10 commits into from
Dec 20, 2023

Conversation

thomas11
Copy link
Contributor

@thomas11 thomas11 commented Dec 1, 2023

Test web identity (OIDC) authentication in CI for regression testing.

The approach is to pick one of the existing tests in examples and run it two additional times, authenticating via web identity/OIDC:

  1. via the GH action aws-actions/configure-aws-credentials
  2. manually via retrieving the token from GH and configuring the provider with it.

I don't love the duplication of much of the workflow definition for YAML but maybe that's the trade-off here for using ci-mgmt?

Related: #3084, pulumi/registry#3567

Copy link

github-actions bot commented Dec 1, 2023

Does the PR have any schema changes?

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

Maintainer note: consult the runbook for dealing with any breaking changes.

@thomas11 thomas11 force-pushed the tkappler/oidc branch 4 times, most recently from af1b52d to 1c96bd6 Compare December 4, 2023 10:25
@thomas11 thomas11 force-pushed the tkappler/oidc branch 3 times, most recently from c6b0e4d to edac482 Compare December 4, 2023 18:28
@thomas11 thomas11 marked this pull request as ready for review December 4, 2023 19:52
@thomas11 thomas11 marked this pull request as draft December 4, 2023 19:52
@thomas11 thomas11 changed the title [EXP] try OIDC auth for CI tests [EXP] OIDC auth for CI tests Dec 4, 2023
@thomas11 thomas11 force-pushed the tkappler/oidc branch 3 times, most recently from 711c018 to 1cb2033 Compare December 6, 2023 14:11
@thomas11 thomas11 marked this pull request as ready for review December 7, 2023 08:34
@thomas11 thomas11 requested review from iwahbe, a team and t0yv0 December 7, 2023 08:34
@t0yv0 t0yv0 closed this Dec 8, 2023
@t0yv0 t0yv0 reopened this Dec 8, 2023
@thomas11 thomas11 changed the title [EXP] OIDC auth for CI tests CI tests for OIDC authentication Dec 11, 2023
@@ -538,25 +538,22 @@ func arrayValue(vars resource.PropertyMap, prop resource.PropertyKey, envs []str
return vals
}

func durationFromConfig(vars resource.PropertyMap, prop resource.PropertyKey, envs []string) (time.Duration, error) {
// returns a pointer so we can distinguish between a zero value and a missing value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: slight preference of adding more Go files in under ./provider instead of growing "resources.go" it's very big already, but certainly not blocking on this!

version: v2.4.0
- name: Make upstream
run: make upstream
- name: Run selected tests with manual web identity/OIDC auth
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this works I guess but do we have any alternatives that don't create a brand new test target for this particular test to keep the workflows a little simper?

What are the extra requirements for the test? I see you need OIDC_ROLE_ARN but perhaps this could have been exposed to all tests? Then you got aws-actions/configure-aws-credentials@v4 that's assuming the role with role-to-assume. Is that the only way to do it?

Can Pulumi program under test assume this role, perhaps by using explicit provider configuration?

If it can't, can the test harness take care of it in the Go code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a copy of the test job because it runs aws-actions/configure-aws-credentials and I want to run it, too, but with a different configuration. If I could edit this file directly, I could just append the steps to the existing test job but in ci-mgmt, I can't.

This new OIDC test job runs two go test runs:

  1. with manual OIDC configuration
  2. with aws-actions/configure-aws-credentials

I believe I could port (1) to the existing test job. Since (1) proves that OIDC works, (2) mainly tests the OIDC part of aws-actions/configure-aws-credentials which we don't own. So I guess we could just drop it, although I would have liked to have an e2e test for a common user scenario.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup. It makes sense to have an e2e test for a common user scenario.

Copy link
Member

@t0yv0 t0yv0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have a few suggestions to simplify but not blocking, this looks super useful.

@thomas11 thomas11 merged commit 385a96a into master Dec 20, 2023
18 checks passed
@thomas11 thomas11 deleted the tkappler/oidc branch December 20, 2023 08:43
VenelinMartinov added a commit that referenced this pull request Dec 22, 2023
VenelinMartinov added a commit that referenced this pull request Dec 22, 2023
This reverts commit 385a96a.

Looks like the github action doesn't quite work and this prevents us
from releasing the provider.
thomas11 added a commit that referenced this pull request Dec 22, 2023
thomas11 added a commit that referenced this pull request Dec 27, 2023
Revert "Revert "CI tests for OIDC authentication (#3074)" (#3175)". The
other test jobs have no guarding conditions, so this one shouldn't need
any either.
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