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

azure-pipelines: Add workflow identity federation to the test pipeline template #1724

Merged
merged 30 commits into from
May 14, 2024

Conversation

hossam-nasr
Copy link
Contributor

@hossam-nasr hossam-nasr commented May 6, 2024

Modify the test.yml pipeline template to add support for workflow identity federation for nightly testing pipelines. We do this by adding two new steps, one dummy keyvault step to connect to the newly-created AzCodeE2ETests service connection for this purpose. The other is a "real" Key Vault step connecting to the AzCodeE2ETestsCredsKV key vault, to obtain the identifiers required to connect to the AzCodeE2ETests service connection and obtain an OIDC token in code. Then, the needed environment variables are manually propagated to the Test step.

@hossam-nasr hossam-nasr requested a review from a team as a code owner May 6, 2024 22:37
azure-pipelines/templates/test.yml Outdated Show resolved Hide resolved
azure-pipelines/templates/test.yml Outdated Show resolved Hide resolved
@hossam-nasr
Copy link
Contributor Author

Updated the main 1esmain.yml pipeline such that it accepts a useAzureFederatedCredentials parameter, which is passed all the way down to the test.yml template, which includes the relevant key vault steps (and sets the relevant env vars) only if useAzureFederatedCredentials is set to true. I tested this on a few pipelines and confirmed that if useAzureFederatedCredentials is false (the default, basically no change on the client extensions side), the pipeline runs the same test step as before, and without prompting for permissions. If useAzureFederatedCredentials parameter is set to true, that's when the Key Vault steps are included and env vars are propagated, and that's when permissions are prompted. Since this is a template parameter and not a runtime condition, this is figured out at "compile time", no two .yml files needed! @alexweininger Who's the plumber now? 😎

@alexweininger
Copy link
Member

Updated the main 1esmain.yml pipeline such that it accepts a useAzureFederatedCredentials parameter, which is passed all the way down to the test.yml template, which includes the relevant key vault steps (and sets the relevant env vars) only if useAzureFederatedCredentials is set to true. I tested this on a few pipelines and confirmed that if useAzureFederatedCredentials is false (the default, basically no change on the client extensions side), the pipeline runs the same test step as before, and without prompting for permissions. If useAzureFederatedCredentials parameter is set to true, that's when the Key Vault steps are included and env vars are propagated, and that's when permissions are prompted. Since this is a template parameter and not a runtime condition, this is figured out at "compile time", no two .yml files needed!

That is epic, great work.

Who's the plumber now? 😎

I'm happy to hand over my denim overalls and tool box 👷 🪠 🧰

alexweininger
alexweininger previously approved these changes May 14, 2024
Copy link
Member

@alexweininger alexweininger left a comment

Choose a reason for hiding this comment

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

tiny feedback, otherwise looks good to go

azure-pipelines/1esmain.yml Outdated Show resolved Hide resolved
@hossam-nasr hossam-nasr changed the title [azure-pipelines] Add workflow identity federation to the test pipeline template azure-pipelines: Add workflow identity federation to the test pipeline template May 14, 2024
@hossam-nasr hossam-nasr merged commit ccfbb7e into main May 14, 2024
4 checks passed
@hossam-nasr hossam-nasr deleted the hossamnasr/federated-pipeline branch May 14, 2024 23:44
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.

3 participants