Skip to content

Commit

Permalink
Update build_test.yaml for Azure Pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyOHart committed Sep 25, 2024
1 parent 1e6e67c commit 8bc4f08
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions ado/build_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ steps:
arguments: './apps/...'
workingDirectory: '$(System.DefaultWorkingDirectory)'
displayName: "Build"
- task: Go@0
inputs:
command: 'test'
arguments: '-race -short ./apps/cache/... ./apps/confidential/... ./apps/public/... ./apps/internal/...'
workingDirectory: '$(System.DefaultWorkingDirectory)'
displayName: "Run Unit Tests"
# - task: Go@0
# inputs:
# command: 'test'
# arguments: '-race -short ./apps/cache/... ./apps/confidential/... ./apps/public/... ./apps/internal/...'
# workingDirectory: '$(System.DefaultWorkingDirectory)'
# displayName: "Run Unit Tests"

- task: AzureKeyVault@2
displayName: 'Connect to Key Vault'
Expand All @@ -36,19 +36,25 @@ steps:
SecretsFilter: 'LabAuth' # string. Required. Specifies the secret to download. Use '*' for all secrets.
#RunAsPreJob: false # boolean. Make secrets available to whole job. Default: false.

- powershell: |
$kvSecretBytes = [System.Convert]::FromBase64String('$(LabAuth)')
$certCollection = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2Collection
$certCollection.Import($kvSecretBytes, $null, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::Exportable)
# - powershell: |
# $kvSecretBytes = [System.Convert]::FromBase64String('$(LabAuth)')
# $certCollection = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2Collection
# $certCollection.Import($kvSecretBytes, $null, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::Exportable)

$protectedCertificateBytes = $certCollection.Export([System.Security.Cryptography.X509Certificates.X509ContentType]::Pkcs12)
$pfxPath = '$(Build.SourcesDirectory)' + "\TestCert.pfx"
[System.IO.File]::WriteAllBytes($pfxPath, $protectedCertificateBytes)
# $protectedCertificateBytes = $certCollection.Export([System.Security.Cryptography.X509Certificates.X509ContentType]::Pkcs12)
# $pfxPath = '$(Build.SourcesDirectory)' + "\TestCert.pfx"
# [System.IO.File]::WriteAllBytes($pfxPath, $protectedCertificateBytes)

Import-PfxCertificate -FilePath $pfxPath -CertStoreLocation Cert:\LocalMachine\My
# Import-PfxCertificate -FilePath $pfxPath -CertStoreLocation Cert:\LocalMachine\My

displayName: 'Install Keyvault Secrets'
# displayName: 'Install Keyvault Secrets'

- script: |
echo $(LabAuth) | base64 -d > cert.pfx
sudo apt-get install -y libnss3-tools
pk12util -i cert.pfx -d sql:/etc/pki/nssdb -W ""
displayName: 'Install Keyvault Secrets'

- task: Go@0
inputs:
command: 'test'
Expand Down

0 comments on commit 8bc4f08

Please sign in to comment.