Skip to content

Commit 7e2560f

Browse files
authored
Fix windows certificate store test (#560)
* enable win-cert-store fix * update run_sample_ci script * use builder v0.9.56 * revert local changes * revert print message
1 parent 2eb99f7 commit 7e2560f

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- 'docs'
88

99
env:
10-
BUILDER_VERSION: v0.9.53
10+
BUILDER_VERSION: v0.9.56
1111
BUILDER_SOURCE: releases
1212
BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net
1313
PACKAGE_NAME: aws-iot-device-sdk-python-v2
@@ -63,10 +63,9 @@ jobs:
6363
- name: run PubSub sample
6464
run: |
6565
python ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_pubsub_cfg.json
66-
# TODO Temporarily disable this job. Enable it after the issue is properly fixes.
67-
# - name: run Windows Certificate Connect sample
68-
# run: |
69-
# python ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_windows_cert_connect_cfg.json
66+
- name: run Windows Certificate Connect sample
67+
run: |
68+
python ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_windows_cert_connect_cfg.json
7069
- name: configure AWS credentials (MQTT5 samples)
7170
uses: aws-actions/configure-aws-credentials@v1
7271
with:

utils/run_sample_ci.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,18 @@ def make_windows_pfx_file(certificate_file_path, private_key_path, pfx_file_path
147147

148148
# Import the PFX into the Windows Certificate Store
149149
# (Passing '$mypwd' is required even though it is empty and our certificate has no password. It fails CI otherwise)
150-
import_pfx_arguments = ["powershell.exe", "Import-PfxCertificate", "-FilePath", pfx_file_path, "-CertStoreLocation", "Cert:\\" + pfx_certificate_store_location, "-Password", "$mypwd"]
150+
import_pfx_arguments = [
151+
"powershell.exe",
152+
# Powershell 7.3 introduced an issue where launching powershell from cmd would not set PSModulePath correctly.
153+
# As a workaround, we set `PSModulePath` to empty so powershell would automatically reset the PSModulePath to default.
154+
# More details: https://github.com/PowerShell/PowerShell/issues/18530
155+
"$env:PSModulePath = '';",
156+
"Import-PfxCertificate",
157+
"-FilePath", pfx_file_path,
158+
"-CertStoreLocation",
159+
"Cert:\\" + pfx_certificate_store_location,
160+
"-Password",
161+
"$mypwd"]
151162
import_pfx_run = subprocess.run(args=import_pfx_arguments, shell=True, stdout=subprocess.PIPE)
152163
if (import_pfx_run.returncode != 0):
153164
print ("ERROR: Could not import PFX certificate into Windows store!")

0 commit comments

Comments
 (0)