From 855f000f63d8cf7baa76d0d9b76d8067fcdcd8e3 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Fri, 27 May 2022 12:17:43 -0700 Subject: [PATCH] Vcpkg sample (#3670) * one commit to rule them all * main merge * error * all smoke * typo * 120 minutes * timeout param missing on job * actual url * Update samples/integration/vcpkg-all-smoke/src/main.cpp Co-authored-by: Larry Osterman * actual creds Co-authored-by: Larry Osterman --- eng/pipelines/templates/jobs/live.tests.yml | 4 +-- .../templates/stages/archetype-sdk-client.yml | 2 +- .../templates/stages/archetype-sdk-tests.yml | 2 +- .../integration/vcpkg-all-smoke/src/main.cpp | 25 ++++++++++++------- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/eng/pipelines/templates/jobs/live.tests.yml b/eng/pipelines/templates/jobs/live.tests.yml index 5d3ae87fa..e5272766e 100644 --- a/eng/pipelines/templates/jobs/live.tests.yml +++ b/eng/pipelines/templates/jobs/live.tests.yml @@ -19,7 +19,7 @@ parameters: default: sdk/*/*/*cov_xml.xml - name: TimeoutInMinutes type: number - default: 60 + default: 120 - name: DependsOn type: string default: '' @@ -41,7 +41,7 @@ jobs: - job: ValidateLive dependsOn: ${{ parameters.DependsOn }} condition: ne(${{ parameters.Matrix }}, '{}') - + timeoutInMinutes: ${{ parameters.TimeoutInMinutes }} pool: name: $(Pool) vmImage: $(OSVmImage) diff --git a/eng/pipelines/templates/stages/archetype-sdk-client.yml b/eng/pipelines/templates/stages/archetype-sdk-client.yml index 3c478076b..a9bc6a575 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-client.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -25,7 +25,7 @@ parameters: default: 'sdk/*/*/*cov_xml.xml' - name: LiveTestTimeoutInMinutes type: number - default: 90 + default: 120 - name: LineCoverageTarget type: number default: 95 diff --git a/eng/pipelines/templates/stages/archetype-sdk-tests.yml b/eng/pipelines/templates/stages/archetype-sdk-tests.yml index 7cc6edb92..737de7b29 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-tests.yml @@ -13,7 +13,7 @@ parameters: default: sdk/*/*/*cov_xml.xml - name: TimeoutInMinutes type: number - default: 60 + default: 120 - name: Location type: string default: '' diff --git a/samples/integration/vcpkg-all-smoke/src/main.cpp b/samples/integration/vcpkg-all-smoke/src/main.cpp index 83681dbd1..282389483 100644 --- a/samples/integration/vcpkg-all-smoke/src/main.cpp +++ b/samples/integration/vcpkg-all-smoke/src/main.cpp @@ -9,6 +9,7 @@ #include "get_env.hpp" #include #include +#include #include #include #include @@ -30,11 +31,15 @@ using namespace Azure::Security::Attestation; int main() { - const std::string tenantId = "tenant"; - const std::string clientId = "client"; - const std::string clientSecret = "secret"; + auto tenantId = std::getenv("AZURE_TENANT_ID"); + auto clientId = std::getenv("AZURE_CLIENT_ID"); + auto clientSecret = std::getenv("AZURE_CLIENT_SECRET"); const std::string leaseID = "leaseID"; const std::string smokeUrl = "https://blob.com"; + // Creating an attestation service instance requires contacting the attestation service (to retrieve validation collateral). + // Use the West US Shared client (which should always be available) as an anonymous service instance. + const std::string attestationUrl = "https://sharedwus.wus.attest.azure.net"; + auto credential = std::make_shared(tenantId, clientId, clientSecret); @@ -43,9 +48,9 @@ int main() { std::cout << "Creating Keyvault Clients" << std::endl; // keyvault - KeyClient keyClient(std::getenv("AZURE_KEYVAULT_URL"), credential); - SecretClient secretClient(std::getenv("AZURE_KEYVAULT_URL"), credential); - CertificateClient certificateClient(std::getenv("AZURE_KEYVAULT_URL"), credential); + KeyClient keyClient(smokeUrl, credential); + SecretClient secretClient(smokeUrl, credential); + CertificateClient certificateClient(smokeUrl, credential); std::cout << "Creating Storage Clients" << std::endl; // Storage @@ -69,10 +74,12 @@ int main() // Attestation std::cout << "Creating Attestation Clients" << std::endl; - std::unique_ptr attestationClient( - AttestationClientFactory::Create(std::getenv("ATTESTATION_AAD_URL"))); + std::unique_ptr attestationAdminClient( - AttestationAdministrationClientFactory::Create(std::getenv("ATTESTATION_AAD_URL"), credential)); + AttestationAdministrationClientFactory::Create(attestationUrl, credential)); + + std::unique_ptr attestationClient( + AttestationClientFactory::Create(attestationUrl)); std::cout << "Successfully Created the Clients" << std::endl; }