Skip to content

Commit 15fdb8d

Browse files
authored
Change run_sample_ci.py to be more generic (#502)
* Change run_sample_ci.py to be more generic * Run fleet provisioning sample via script
1 parent 1d06bf1 commit 15fdb8d

24 files changed

+205
-129
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -187,18 +187,18 @@ jobs:
187187
aws-region: ${{ env.AWS_DEFAULT_REGION }}
188188
- name: run PubSub sample
189189
run: |
190-
python ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_pubsub_cfg.json
190+
python ./utils/run_in_ci.py --file ./.github/workflows/ci_run_pubsub_cfg.json
191191
- name: run Windows Certificate Connect sample
192192
run: |
193-
python ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_windows_cert_connect_cfg.json
193+
python ./utils/run_in_ci.py --file ./.github/workflows/ci_run_windows_cert_connect_cfg.json
194194
- name: configure AWS credentials (MQTT5)
195195
uses: aws-actions/configure-aws-credentials@v2
196196
with:
197197
role-to-assume: ${{ env.CI_MQTT5_ROLE }}
198198
aws-region: ${{ env.AWS_DEFAULT_REGION }}
199199
- name: run MQTT5 PubSub sample
200200
run: |
201-
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_mqtt5_pubsub_cfg.json
201+
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_mqtt5_pubsub_cfg.json
202202
- name: configure AWS credentials (Device Advisor)
203203
uses: aws-actions/configure-aws-credentials@v2
204204
with:
@@ -259,22 +259,22 @@ jobs:
259259
aws-region: ${{ env.AWS_DEFAULT_REGION }}
260260
- name: run PubSub sample
261261
run: |
262-
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_pubsub_cfg.json
262+
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_pubsub_cfg.json
263263
- name: run PKCS12 Connect sample
264264
run: |
265265
cert=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/PubSub/cert" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$cert" > /tmp/certificate.pem
266266
key=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/PubSub/key" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$key" > /tmp/privatekey.pem
267267
pkcs12_password=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/PubSub/key_pkcs12_password" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\")
268268
openssl pkcs12 -export -in /tmp/certificate.pem -inkey /tmp/privatekey.pem -out ./pkcs12-key.p12 -name PubSub_Thing_Alias -password pass:$pkcs12_password
269-
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_pkcs12_connect_cfg.json
269+
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_pkcs12_connect_cfg.json
270270
- name: configure AWS credentials (MQTT5)
271271
uses: aws-actions/configure-aws-credentials@v2
272272
with:
273273
role-to-assume: ${{ env.CI_MQTT5_ROLE }}
274274
aws-region: ${{ env.AWS_DEFAULT_REGION }}
275275
- name: run MQTT5 PubSub sample
276276
run: |
277-
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_mqtt5_pubsub_cfg.json
277+
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_mqtt5_pubsub_cfg.json
278278
- name: configure AWS credentials (Device Advisor)
279279
uses: aws-actions/configure-aws-credentials@v2
280280
with:
@@ -334,15 +334,15 @@ jobs:
334334
aws-region: ${{ env.AWS_DEFAULT_REGION }}
335335
- name: run PubSub sample
336336
run: |
337-
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_pubsub_cfg.json
337+
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_pubsub_cfg.json
338338
- name: configure AWS credentials (MQTT5)
339339
uses: aws-actions/configure-aws-credentials@v2
340340
with:
341341
role-to-assume: ${{ env.CI_MQTT5_ROLE }}
342342
aws-region: ${{ env.AWS_DEFAULT_REGION }}
343343
- name: run MQTT5 PubSub sample
344344
run: |
345-
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_mqtt5_pubsub_cfg.json
345+
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_mqtt5_pubsub_cfg.json
346346
- name: configure AWS credentials (Device Advisor)
347347
uses: aws-actions/configure-aws-credentials@v2
348348
with:
@@ -478,109 +478,103 @@ jobs:
478478
aws-region: ${{ env.AWS_DEFAULT_REGION }}
479479
- name: run Basic Connect sample
480480
run: |
481-
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_basic_connect_cfg.json
481+
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_basic_connect_cfg.json
482482
- name: run Websocket Connect sample
483483
run: |
484-
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_websocket_connect_cfg.json
484+
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_websocket_connect_cfg.json
485485
- name: run PubSub sample
486486
run: |
487-
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_pubsub_cfg.json
487+
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_pubsub_cfg.json
488488
- name: run CustomKeyOperations sample
489489
run: |
490-
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_custom_key_ops_cfg.json
490+
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_custom_key_ops_cfg.json
491491
- name: run PKCS11 Connect sample
492492
run: |
493493
mkdir -p /tmp/tokens
494494
export SOFTHSM2_CONF=/tmp/softhsm2.conf
495495
echo "directories.tokendir = /tmp/tokens" > /tmp/softhsm2.conf
496-
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_pkcs11_connect_cfg.json
496+
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_pkcs11_connect_cfg.json
497497
- name: run Java keystore Connect sample
498498
run: |
499499
cert=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/PubSub/cert" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$cert" > /tmp/certificate.pem
500500
key=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/PubSub/key" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$key" > /tmp/privatekey.pem
501501
pkcs12_password=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/PubSub/key_pkcs12_password" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\")
502502
openssl pkcs12 -export -in /tmp/certificate.pem -inkey /tmp/privatekey.pem -out /tmp/pkcs12-key.p12 -name PubSub_Thing_Alias -password pass:$pkcs12_password
503503
keytool -importkeystore -srckeystore /tmp/pkcs12-key.p12 -destkeystore ./java_keystore.keys -srcstoretype PKCS12 -alias PubSub_Thing_Alias -srcstorepass $pkcs12_password -deststorepass $pkcs12_password
504-
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_keystore_connect_cfg.json
504+
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_keystore_connect_cfg.json
505505
- name: configure AWS credentials (Cognito)
506506
uses: aws-actions/configure-aws-credentials@v2
507507
with:
508508
role-to-assume: ${{ env.CI_COGNITO_ROLE }}
509509
aws-region: ${{ env.AWS_DEFAULT_REGION }}
510510
- name: run CognitoConnect sample
511511
run: |
512-
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_cognito_connect_cfg.json
512+
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_cognito_connect_cfg.json
513513
- name: configure AWS credentials (Custom Authorizer)
514514
uses: aws-actions/configure-aws-credentials@v2
515515
with:
516516
role-to-assume: ${{ env.CI_CUSTOM_AUTHORIZER_ROLE }}
517517
aws-region: ${{ env.AWS_DEFAULT_REGION }}
518518
- name: run CustomAuthorizerConnect sample
519519
run: |
520-
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_custom_authorizer_connect_cfg.json
520+
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_custom_authorizer_connect_cfg.json
521521
- name: configure AWS credentials (Shadow)
522522
uses: aws-actions/configure-aws-credentials@v2
523523
with:
524524
role-to-assume: ${{ env.CI_SHADOW_ROLE }}
525525
aws-region: ${{ env.AWS_DEFAULT_REGION }}
526526
- name: run Shadow sample
527527
run: |
528-
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_shadow_cfg.json
528+
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_shadow_cfg.json
529529
- name: run Mqtt5 Shadow sample
530530
run: |
531-
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_shadow_mqtt5_cfg.json
531+
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_shadow_mqtt5_cfg.json
532532
- name: configure AWS credentials (Jobs)
533533
uses: aws-actions/configure-aws-credentials@v2
534534
with:
535535
role-to-assume: ${{ env.CI_JOBS_ROLE }}
536536
aws-region: ${{ env.AWS_DEFAULT_REGION }}
537537
- name: run Jobs sample
538538
run: |
539-
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_jobs_cfg.json
539+
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_jobs_cfg.json
540540
- name: run Mqtt5 Jobs sample
541541
run: |
542-
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_jobs_mqtt5_cfg.json
542+
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_jobs_mqtt5_cfg.json
543543
- name: configure AWS credentials (Fleet provisioning)
544544
uses: aws-actions/configure-aws-credentials@v2
545545
with:
546546
role-to-assume: ${{ env.CI_FLEET_PROVISIONING_ROLE }}
547547
aws-region: ${{ env.AWS_DEFAULT_REGION }}
548548
- name: run Fleet Provisioning sample
549549
run: |
550-
echo "Generating UUID for IoT thing"
551-
Sample_UUID=$(python3 -c "import uuid; print (uuid.uuid4())")
552-
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_fleet_provisioning_cfg.json --input_uuid ${Sample_UUID}
553-
python3 utils/delete_iot_thing_ci.py --thing_name "Fleet_Thing_${Sample_UUID}" --region "us-east-1"
550+
python3 ./utils/run_fleet_provisioning_sample.py --file ./.github/workflows/ci_run_fleet_provisioning_cfg.json --thing-name-prefix "Fleet_Thing_"
554551
- name: run Mqtt5 Fleet Provisioning sample
555552
run: |
556-
echo "Generating UUID for IoT thing"
557-
Sample_UUID=$(python3 -c "import uuid; print (uuid.uuid4())")
558-
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_fleet_provisioning_mqtt5_cfg.json --input_uuid ${Sample_UUID}
559-
python3 utils/delete_iot_thing_ci.py --thing_name "Fleet_Thing_${Sample_UUID}" --region "us-east-1"
553+
python3 ./utils/run_fleet_provisioning_sample.py --file ./.github/workflows/ci_run_fleet_provisioning_mqtt5_cfg.json --thing-name-prefix "Fleet_Thing_"
560554
- name: configure AWS credentials (X509)
561555
uses: aws-actions/configure-aws-credentials@v2
562556
with:
563557
role-to-assume: ${{ env.CI_X509_ROLE }}
564558
aws-region: ${{ env.AWS_DEFAULT_REGION }}
565559
- name: run X509 sample
566560
run: |
567-
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_x509_connect_cfg.json
561+
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_x509_connect_cfg.json
568562
- name: configure AWS credentials (MQTT5)
569563
uses: aws-actions/configure-aws-credentials@v2
570564
with:
571565
role-to-assume: ${{ env.CI_MQTT5_ROLE }}
572566
aws-region: ${{ env.AWS_DEFAULT_REGION }}
573567
- name: run MQTT5 PubSub sample
574568
run: |
575-
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_mqtt5_pubsub_cfg.json
569+
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_mqtt5_pubsub_cfg.json
576570
- name: run MQTT5 Shared Subscription sample
577571
run: |
578-
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_mqtt5_shared_subscription_cfg.json
572+
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_mqtt5_shared_subscription_cfg.json
579573
- name: configure AWS credentials (Greengrass)
580574
uses: aws-actions/configure-aws-credentials@v2
581575
with:
582576
role-to-assume: ${{ env.CI_GREENGRASS_ROLE }}
583577
aws-region: ${{ env.AWS_DEFAULT_REGION }}
584578
- name: run Greengrass Discovery sample
585579
run: |
586-
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_greengrass_discovery_cfg.json
580+
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_greengrass_discovery_cfg.json

.github/workflows/ci_run_basic_connect_cfg.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"language": "Java",
3-
"sample_file": "samples/BasicConnect",
4-
"sample_region": "us-east-1",
5-
"sample_main_class": "basicconnect.BasicConnect",
3+
"runnable_file": "samples/BasicConnect",
4+
"runnable_region": "us-east-1",
5+
"runnable_main_class": "basicconnect.BasicConnect",
66
"arguments": [
77
{
88
"name": "--endpoint",

.github/workflows/ci_run_cognito_connect_cfg.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"language": "Java",
3-
"sample_file": "samples/CognitoConnect",
4-
"sample_region": "us-east-1",
5-
"sample_main_class": "cognitoconnect.CognitoConnect",
3+
"runnable_file": "samples/CognitoConnect",
4+
"runnable_region": "us-east-1",
5+
"runnable_main_class": "cognitoconnect.CognitoConnect",
66
"arguments": [
77
{
88
"name": "--endpoint",

.github/workflows/ci_run_custom_authorizer_connect_cfg.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"language": "Java",
3-
"sample_file": "samples/CustomAuthorizerConnect",
4-
"sample_region": "us-east-1",
5-
"sample_main_class": "customauthorizerconnect.CustomAuthorizerConnect",
3+
"runnable_file": "samples/CustomAuthorizerConnect",
4+
"runnable_region": "us-east-1",
5+
"runnable_main_class": "customauthorizerconnect.CustomAuthorizerConnect",
66
"arguments": [
77
{
88
"name": "--endpoint",

.github/workflows/ci_run_custom_key_ops_cfg.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"language": "Java",
3-
"sample_file": "samples/CustomKeyOpsConnect",
4-
"sample_region": "us-east-1",
5-
"sample_main_class": "customkeyopsconnect.CustomKeyOpsConnect",
3+
"runnable_file": "samples/CustomKeyOpsConnect",
4+
"runnable_region": "us-east-1",
5+
"runnable_main_class": "customkeyopsconnect.CustomKeyOpsConnect",
66
"arguments": [
77
{
88
"name": "--endpoint",

.github/workflows/ci_run_fleet_provisioning_cfg.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"language": "Java",
3-
"sample_file": "samples/FleetProvisioning",
4-
"sample_region": "us-east-1",
5-
"sample_main_class": "fleetprovisioning.FleetProvisioningSample",
3+
"runnable_file": "samples/FleetProvisioning",
4+
"runnable_region": "us-east-1",
5+
"runnable_main_class": "fleetprovisioning.FleetProvisioningSample",
66
"arguments": [
77
{
88
"name": "--endpoint",

.github/workflows/ci_run_fleet_provisioning_mqtt5_cfg.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"language": "Java",
3-
"sample_file": "samples/FleetProvisioning",
4-
"sample_region": "us-east-1",
5-
"sample_main_class": "fleetprovisioning.Mqtt5FleetProvisioningSample",
3+
"runnable_file": "samples/FleetProvisioning",
4+
"runnable_region": "us-east-1",
5+
"runnable_main_class": "fleetprovisioning.Mqtt5FleetProvisioningSample",
66
"arguments": [
77
{
88
"name": "--endpoint",

.github/workflows/ci_run_greengrass_discovery_cfg.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"language": "Java",
3-
"sample_file": "samples/Greengrass",
4-
"sample_region": "us-east-1",
5-
"sample_main_class": "greengrass.BasicDiscovery",
3+
"runnable_file": "samples/Greengrass",
4+
"runnable_region": "us-east-1",
5+
"runnable_main_class": "greengrass.BasicDiscovery",
66
"arguments": [
77
{
88
"name": "--cert",

.github/workflows/ci_run_jobs_cfg.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"language": "Java",
3-
"sample_file": "samples/Jobs",
4-
"sample_region": "us-east-1",
5-
"sample_main_class": "jobs.JobsSample",
3+
"runnable_file": "samples/Jobs",
4+
"runnable_region": "us-east-1",
5+
"runnable_main_class": "jobs.JobsSample",
66
"arguments": [
77
{
88
"name": "--endpoint",

.github/workflows/ci_run_jobs_mqtt5_cfg.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"language": "Java",
3-
"sample_file": "samples/Jobs",
4-
"sample_region": "us-east-1",
5-
"sample_main_class": "jobs.Mqtt5JobsSample",
3+
"runnable_file": "samples/Jobs",
4+
"runnable_region": "us-east-1",
5+
"runnable_main_class": "jobs.Mqtt5JobsSample",
66
"arguments": [
77
{
88
"name": "--endpoint",

0 commit comments

Comments
 (0)