From 3283da4265a90ea1ed4adc274fabb307606e7f13 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Tue, 13 Feb 2024 11:41:41 -0800 Subject: [PATCH] update to use builder v0.9.56, fix win cert --- .github/workflows/ci.yml | 9 ++++----- utils/run_in_ci.py | 13 ++++++++++++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a51dec0..3ffd0a7d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ on: - 'docs' env: - BUILDER_VERSION: v0.9.53 + BUILDER_VERSION: v0.9.56 BUILDER_SOURCE: releases BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net PACKAGE_NAME: aws-iot-device-sdk-java-v2 @@ -190,10 +190,9 @@ jobs: - name: run PubSub sample run: | python ./utils/run_in_ci.py --file ./.github/workflows/ci_run_pubsub_cfg.json - # TODO Temporarily disable this job. Enable it after the issue is properly fixes. - # - name: run Windows Certificate Connect sample - # run: | - # python ./utils/run_in_ci.py --file ./.github/workflows/ci_run_windows_cert_connect_cfg.json + - name: run Windows Certificate Connect sample + run: | + python ./utils/run_in_ci.py --file ./.github/workflows/ci_run_windows_cert_connect_cfg.json - name: configure AWS credentials (MQTT5) uses: aws-actions/configure-aws-credentials@v2 with: diff --git a/utils/run_in_ci.py b/utils/run_in_ci.py index ecd86b5a..f87302c3 100644 --- a/utils/run_in_ci.py +++ b/utils/run_in_ci.py @@ -147,7 +147,18 @@ def make_windows_pfx_file(certificate_file_path, private_key_path, pfx_file_path # Import the PFX into the Windows Certificate Store # (Passing '$mypwd' is required even though it is empty and our certificate has no password. It fails CI otherwise) - import_pfx_arguments = ["powershell.exe", "Import-PfxCertificate", "-FilePath", pfx_file_path, "-CertStoreLocation", "Cert:\\" + pfx_certificate_store_location, "-Password", "$mypwd"] + import_pfx_arguments = [ + "powershell.exe", + # Powershell 7.3 introduced an issue where launching powershell from cmd would not set PSModulePath correctly. + # As a workaround, we set `PSModulePath` to empty so powershell would automatically reset the PSModulePath to default. + # More details: https://github.com/PowerShell/PowerShell/issues/18530 + "$env:PSModulePath = '';", + "Import-PfxCertificate", + "-FilePath", pfx_file_path, + "-CertStoreLocation", + "Cert:\\" + pfx_certificate_store_location, + "-Password", + "$mypwd"] import_pfx_run = subprocess.run(args=import_pfx_arguments, shell=True, stdout=subprocess.PIPE) if (import_pfx_run.returncode != 0): print ("ERROR: Could not import PFX certificate into Windows store!")