-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Migrate to Lab Vault Cert for E2E Tests #7085
Merged
Merged
Changes from 22 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
8f0192d
Update Azure SDK Identity to latest version
hectormmg 69fd699
Update gen_env and lab client
hectormmg 492cfc9
Update LabClient and gen_env scripts to use Lab Vault Certificate
hectormmg ada2a59
Merge branch 'dev' into use-lab-cert
hectormmg 71c6aa0
Add 3p-e2e OB pipeline
hectormmg b06a5c4
Fix override parameter for 3p e2e tests
hectormmg fbc8839
Fix repo reference
hectormmg 25fff01
Temporarily use use-lab-cert branch for 1p source
hectormmg 8c719ac
Disable non-browser tests
hectormmg 120e202
Update dependencies
hectormmg c792be6
Update package-lock
hectormmg 735acaa
Update dependencies
hectormmg ac416d9
Revert @azure/identity version
hectormmg cc0f2ad
Add e2e tests for node react and angular
hectormmg 4fd34f7
Add node versions to node e2e tests
hectormmg 0f65c32
Use randomUUID for express session secret in msal-node samples
hectormmg 4560b1c
Revert to environment variable for express session secret
hectormmg 8e24127
Add express session secret variable to auth-code sample
hectormmg 9db4b94
Update 1p e2e test yml
hectormmg 8a13106
Use SourceBranchName instead of SourceBranch
hectormmg c9b4f44
Test new source branch for tags
hectormmg 0e1cf72
Fix template
hectormmg 8a12b37
Update 3p e2e
hectormmg d78dcf0
Update pull request branch logic
hectormmg ec14467
Update ref logic
hectormmg 2a09074
Add params
hectormmg a92294c
Fix template
hectormmg 042f8ee
Empty commit to trigger CI
hectormmg bdf769b
Revert 1p-e2e pipeline changes
hectormmg 0dd6ba4
Add angular17-standalone-sample
hectormmg 13a12df
Trigger CI
hectormmg 530da5c
Add jest-junit to angular17 standalone sample
hectormmg bc915e5
Trigger CI
hectormmg 1a182f6
Update package-lock
hectormmg c010af2
Remove GitHub e2e workflows
hectormmg 197178f
Remove todos
hectormmg e1fc2b0
Trigger build
hectormmg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
variables: | ||
CDP_DEFINITION_BUILD_COUNT: $[counter('', 0)] # needed for onebranch.pipeline.version task https://aka.ms/obpipelines/versioning | ||
LinuxContainerImage: "mcr.microsoft.com/onebranch/cbl-mariner/build:2.0" # Docker image which is used to build the project https://aka.ms/obpipelines/containers | ||
DEBIAN_FRONTEND: noninteractive | ||
${{ if startsWith(variables['Build.SourceBranch'], 'refs/heads/') }}: | ||
sourceBranchName: ${{ replace(variables['Build.SourceBranch'], 'refs/heads/', '') }} | ||
${{ if startsWith(variables['Build.SourceBranch'], 'refs/pull/') }}: | ||
sourceBranchName: ${{ replace(variables['System.PullRequest.SourceBranch'], 'refs/heads/', '') }} | ||
|
||
resources: | ||
repositories: | ||
- repository: templates | ||
type: git | ||
name: OneBranch.Pipelines/GovernedTemplates | ||
ref: refs/heads/main | ||
- repository: 1P | ||
type: git | ||
name: IDDP/msal-javascript-1p | ||
ref: use-lab-cert # TODO: replace with master before merging | ||
extends: | ||
template: v2/OneBranch.NonOfficial.CrossPlat.yml@templates # https://aka.ms/obpipelines/templates | ||
parameters: | ||
globalSdl: | ||
policheck: | ||
break: true | ||
|
||
stages: | ||
- stage: e2e_test | ||
displayName: "3P E2E Tests" | ||
jobs: | ||
- template: .pipelines/templates/msal-browser-e2e.yml@1P | ||
parameters: | ||
jobName: "validate_msal_browser" | ||
poolType: "linux" | ||
publishFlagName: "publishMsalBrowser" | ||
sourceBranchName: ${{ variables.sourceBranchName }} | ||
stage: "PR" | ||
override: true | ||
samples: | ||
- "client-capabilities" | ||
- "onPageLoad" | ||
- "pop" | ||
- "customizable-e2e-test" | ||
- template: .pipelines/templates/msal-node-e2e.yml@1P | ||
parameters: | ||
jobName: "validate_msal_node" | ||
poolType: "windows" | ||
publishFlagName: "publishMsalNode" | ||
sourceBranchName: ${{ variables.sourceBranchName }} | ||
stage: "PR" | ||
override: true | ||
node: [16, 18, 20, 22] | ||
samples: | ||
- "auth-code" | ||
- "auth-code-cli-app" | ||
- "client-credentials" | ||
- "device-code" | ||
- "silent-flow" | ||
- "b2c-user-flows" | ||
- template: .pipelines/templates/msal-react-e2e.yml@1P | ||
parameters: | ||
jobName: "validate_msal_react" | ||
poolType: "linux" | ||
publishFlagName: "publishMsalReact" | ||
sourceBranchName: ${{ variables.sourceBranchName }} | ||
stage: "PR" | ||
override: true | ||
samples: | ||
- "nextjs-sample" | ||
- "react-router-sample" | ||
- "gatsby-sample" | ||
- "typescript-sample" | ||
- "b2c-sample" | ||
- template: .pipelines/templates/msal-angular-e2e.yml@1P | ||
parameters: | ||
jobName: "validate_msal_angular" | ||
poolType: "linux" | ||
publishFlagName: "publishMsalAngular" | ||
sourceBranchName: ${{ variables.sourceBranchName }} | ||
stage: "PR" | ||
override: true | ||
samples: | ||
- "angular15-sample-app" | ||
- "angular16-sample-app" | ||
- "angular-b2c-sample-app" | ||
- "angular-standalone-sample" | ||
hectormmg marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Variables | ||
$dotEnvFileName = ".env" | ||
$tenantIdInfo = 'AZURE_TENANT_ID="72f988bf-86f1-41af-91ab-2d7cd011db47"' | ||
$clientIdName = "AZURE_CLIENT_ID=" | ||
$clientCertPathName = "AZURE_CLIENT_CERT_PATH=" | ||
$sessionSecretName = "SESSION_SECRET=" | ||
|
||
# Create file if it doesn't exist | ||
if (-Not (Test-Path $dotEnvFileName)) { | ||
Write-Output "Creating $dotEnvFileName file..." | ||
New-Item -Path . -Name $dotEnvFileName -ItemType "file" | ||
} | ||
else { | ||
Write-Output "$dotEnvFileName file already exists..." | ||
} | ||
|
||
# Output Tenant Id to dotEnv file | ||
$tenantIdInfo | Out-File -File $dotEnvFileName -Append | ||
# login - you should have permission already to ready the necessary keyvault | ||
# if not, ask your manager to help with onboarding | ||
az login --output none | ||
|
||
# Get the lab app id | ||
$clientIdValue = $(az keyvault secret show --name "LabVaultAppId" --vault-name "msidlabs" --query "value") | ||
|
||
$pfxPath = "LabCert.pfx"; | ||
$pemPath = "LabCert.pem"; | ||
# get the lab app cert | ||
az keyvault secret download --vault-name "msidlabs" -n "LabVaultAccessCert" --file $pfxPath --encoding base64 | ||
# convert pfx file to pem | ||
openssl pkcs12 -in $pfxPath -out $pemPath -nodes --passin pass: | ||
|
||
$fullPemPath = (Get-Location).Path + "\" + $pemPath | ||
|
||
# Used to secure sessions for samples that use express-session | ||
$sessionSecret = New-Guid | ||
$sessionSecretNameValue = "$sessionSecretName" + '"' + $sessionSecret + '"' | ||
|
||
$clientIdNameValue = "$clientIdName$clientIdValue" | ||
$clientCertPathNameValue = "$clientCertPathName" + '"' + $fullPemPath + '"' | ||
|
||
|
||
$clientIdNameValue | Out-File -File $dotEnvFileName -Append | ||
$clientCertPathNameValue | Out-File -File $dotEnvFileName -Append | ||
$sessionSecretNameValue | Out-File -File $dotEnvFileName -Append | ||
|
||
# Dotenv will not parse CLRF correctly, so we need to replace it with LF | ||
(Get-Content $dotEnvFileName -Raw).Replace("`r`n", "`n") | Set-Content $dotEnvFileName -Force | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,4 @@ | ||
#!/bin/bash | ||
|
||
# Remember to make executable | ||
|
||
# Variables | ||
dotEnvFileName=".env" | ||
tenantIdInfo="AZURE_TENANT_ID=\"72f988bf-86f1-41af-91ab-2d7cd011db47\"" | ||
clientIdName="AZURE_CLIENT_ID=" | ||
clientSecretName="AZURE_CLIENT_SECRET=" | ||
|
||
# Create file if it doesn't exist | ||
touch $dotEnvFileName | ||
|
||
# Output Tenant Id to dotEnv file | ||
echo $tenantIdInfo >> $dotEnvFileName | ||
|
||
# login - you should have permission already to ready the necessary keyvault | ||
# if not, ask your manager to help with onboarding | ||
az login | ||
|
||
# Get the lab app id | ||
clientIdValue=$(az keyvault secret show --name "LabVaultAppId" --vault-name "msidlabs" --query "value") | ||
|
||
# get the lab app secret | ||
clientSecretValue=$(az keyvault secret show --name "LabVaultAppSecret" --vault-name "msidlabs" --query "value") | ||
|
||
clientIdNameValue=$clientIdName$clientIdValue | ||
clientSecretNameValue=$clientSecretName$clientSecretValue | ||
|
||
echo $clientIdNameValue >> $dotEnvFileName | ||
echo $clientSecretNameValue >> $dotEnvFileName | ||
Powershell.exe -file gen_env.ps1 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be
${{ if startsWith(variables['System.PullRequest.SourceBranch'], 'refs/pull/') }}:
instead?