|
1 | | -trigger: |
2 | | - - main |
| 1 | +trigger: |
| 2 | + - main |
3 | 3 |
|
4 | 4 | pool: |
5 | | - vmImage: 'ubuntu-latest' |
6 | | - |
7 | | -steps: |
8 | | -- task: GoTool@0 |
9 | | - inputs: |
10 | | - version: '1.22.3' |
11 | | -- task: Go@0 |
12 | | - inputs: |
13 | | - command: 'get' |
14 | | - arguments: '-d -v -t -d ./...' |
15 | | - workingDirectory: '$(System.DefaultWorkingDirectory)' |
16 | | - displayName: "Install dependencies" |
17 | | -- task: Go@0 |
18 | | - inputs: |
19 | | - command: 'build' |
20 | | - arguments: './apps/...' |
21 | | - workingDirectory: '$(System.DefaultWorkingDirectory)' |
22 | | - displayName: "Build" |
23 | | -# - task: Go@0 |
24 | | -# inputs: |
25 | | -# command: 'test' |
26 | | -# arguments: '-race -short ./apps/cache/... ./apps/confidential/... ./apps/public/... ./apps/internal/...' |
27 | | -# workingDirectory: '$(System.DefaultWorkingDirectory)' |
28 | | -# displayName: "Run Unit Tests" |
29 | | - |
30 | | -- task: AzureKeyVault@2 |
31 | | - displayName: 'Connect to Key Vault' |
32 | | - inputs: |
33 | | - azureSubscription: 'AuthSdkResourceManager' # string. Workload identity service connection to use managed identity authentication |
34 | | - KeyVaultName: 'msidlabs' # string. Required. The name of the Key Vault containing the secrets. |
35 | | - #setting secrets filter to fetch only MSIDLABCertificate cert from the vault |
36 | | - SecretsFilter: 'LabAuth' # string. Required. Specifies the secret to download. Use '*' for all secrets. |
37 | | - #RunAsPreJob: false # boolean. Make secrets available to whole job. Default: false. |
38 | | - |
39 | | -# - powershell: | |
40 | | -# $kvSecretBytes = [System.Convert]::FromBase64String('$(LabAuth)') |
41 | | -# $certCollection = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2Collection |
42 | | -# $certCollection.Import($kvSecretBytes, $null, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::Exportable) |
43 | | - |
44 | | -# $protectedCertificateBytes = $certCollection.Export([System.Security.Cryptography.X509Certificates.X509ContentType]::Pkcs12) |
45 | | -# $pfxPath = '$(Build.SourcesDirectory)' + "\TestCert.pfx" |
46 | | -# [System.IO.File]::WriteAllBytes($pfxPath, $protectedCertificateBytes) |
47 | | - |
48 | | -# Import-PfxCertificate -FilePath $pfxPath -CertStoreLocation Cert:\LocalMachine\My |
49 | | - |
50 | | -# displayName: 'Install Keyvault Secrets' |
51 | | - |
52 | | -- script: | |
53 | | - echo $(LabAuth) | base64 -d > cert.pfx |
54 | | - sudo apt-get install -y libnss3-tools openssl |
55 | | - mkdir -p ~/.pki/nssdb |
56 | | - certutil -N -d sql:$HOME/.pki/nssdb --empty-password |
57 | | - openssl pkcs12 -in cert.pfx -out cert.pem -nodes |
58 | | - certutil -A -d sql:$HOME/.pki/nssdb -n "labCert" -t "P,," -i cert.pem |
59 | | - displayName: 'Install Keyvault Secrets' |
60 | | - |
61 | | -- task: Go@0 |
62 | | - inputs: |
63 | | - command: 'test' |
64 | | - arguments: '-race ./apps/tests/integration/...' |
65 | | - workingDirectory: '$(System.DefaultWorkingDirectory)' |
66 | | - displayName: "Run Integration Tests" |
67 | | - |
68 | | - |
| 5 | + vmImage: "ubuntu-latest" |
| 6 | + |
| 7 | +steps: |
| 8 | + - task: GoTool@0 |
| 9 | + inputs: |
| 10 | + version: "1.22.3" |
| 11 | + - task: Go@0 |
| 12 | + inputs: |
| 13 | + command: "get" |
| 14 | + arguments: "-d -v -t -d ./..." |
| 15 | + workingDirectory: "$(System.DefaultWorkingDirectory)" |
| 16 | + displayName: "Install dependencies" |
| 17 | + - task: Go@0 |
| 18 | + inputs: |
| 19 | + command: "build" |
| 20 | + arguments: "./apps/..." |
| 21 | + workingDirectory: "$(System.DefaultWorkingDirectory)" |
| 22 | + displayName: "Build" |
| 23 | + - task: Go@0 |
| 24 | + inputs: |
| 25 | + command: "test" |
| 26 | + arguments: "-race -short ./apps/cache/... ./apps/confidential/... ./apps/public/... ./apps/internal/..." |
| 27 | + workingDirectory: "$(System.DefaultWorkingDirectory)" |
| 28 | + displayName: "Run Unit Tests" |
| 29 | + - task: AzureKeyVault@2 |
| 30 | + displayName: "Connect to Key Vault" |
| 31 | + inputs: |
| 32 | + azureSubscription: "AuthSdkResourceManager" |
| 33 | + KeyVaultName: "msidlabs" |
| 34 | + SecretsFilter: "LabAuth" |
| 35 | + - task: Bash@3 |
| 36 | + displayName: Installing certificate |
| 37 | + inputs: |
| 38 | + targetType: "inline" |
| 39 | + script: | |
| 40 | + echo $(LabAuth) | base64 -d > $(Build.SourcesDirectory)/cert.pfx |
| 41 | + openssl pkcs12 -in $(Build.SourcesDirectory)/cert.pfx -out $(Build.SourcesDirectory)/cert.pem -nodes -passin pass:'' |
| 42 | +
|
| 43 | + - task: Go@0 |
| 44 | + inputs: |
| 45 | + command: "test" |
| 46 | + arguments: "-race ./apps/tests/integration/..." |
| 47 | + workingDirectory: "$(System.DefaultWorkingDirectory)" |
| 48 | + displayName: "Run Integration Tests" |
0 commit comments