Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log in before deploy #7238

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion builds/e2e/nested-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ stages:
inputs:
targetType: inline
script: |
az login --service-principal -p $(edgebuild-service-principal-secret) -u $(servicePrincipal.clientId) --tenant $(servicePrincipal.tenantId)
sudo az login --service-principal -p $(edgebuild-service-principal-secret) -u $(servicePrincipal.clientId) --tenant $(servicePrincipal.tenantId)

- template: templates/nested-get-root-ca.yaml
- template: templates/nested-get-device-name.yaml
Expand All @@ -103,13 +103,19 @@ stages:
changeDeployConfigOnly: true
level: 5
name: 5
spsecret: $(edgebuild-service-principal-secret)
spclientid: $(servicePrincipal.clientId)
sptenantid: $(servicePrincipal.tenantId)
- template: templates/nested-deploy-config.yaml
parameters:
deviceId: $(parentDeviceId)
deploymentFile: nestededge_middleLayer_e2e_amqp.json
changeDeployConfigOnly: true
level: 4
name: 4
spsecret: $(edgebuild-service-principal-secret)
spclientid: $(servicePrincipal.clientId)
sptenantid: $(servicePrincipal.tenantId)
- template: templates/e2e-run.yaml
parameters:
EventHubCompatibleEndpoint: '$(IotHub-EventHubConnStr)'
Expand Down
3 changes: 3 additions & 0 deletions builds/e2e/templates/nested-deploy-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,7 @@ steps:
-proxyAddress "$(proxyAddress)" \
-changeDeployConfigOnly "${{ parameters.changeDeployConfigOnly }}" \
-waitForTestComplete \
-servicePrincipalSecret "${{ parameters.spsecret }}" \
-servicePrincipalClientId "${{ parameters.spclientid }}" \
-servicePrincipalTenantId "${{ parameters.sptenantid }}" \
-cleanAll
16 changes: 14 additions & 2 deletions scripts/linux/nested-edge-deploy-agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ function prepare_test_from_artifacts() {
sudo cat ${deployment_working_file}

#deploy the config in azure portal
az iot edge set-modules --device-id ${DEVICE_ID} --hub-name ${IOT_HUB_NAME} --content ${deployment_working_file} --output none
# az login --service-principal -p $(SP_SECRET) -u $(SP_CLIENTID) --tenant $(SP_TENANT)
sudo az iot edge set-modules --device-id ${DEVICE_ID} --hub-name ${IOT_HUB_NAME} --content ${deployment_working_file} --output none
}

function process_args() {
Expand Down Expand Up @@ -191,6 +192,15 @@ function process_args() {
elif [ $saveNextArg -eq 20 ]; then
CHANGE_DEPLOY_CONFIG_ONLY="$arg"
saveNextArg=0
elif [ $saveNextArg -eq 21 ]; then
SP_SECRET="$arg"
saveNextArg=0
elif [ $saveNextArg -eq 22 ]; then
SP_CLIENTID="$arg"
saveNextArg=0
elif [ $saveNextArg -eq 23 ]; then
SP_TENANT="$arg"
saveNextArg=0
else
case "$arg" in
'-h' | '--help' ) usage;;
Expand All @@ -214,9 +224,11 @@ function process_args() {
'-iotHubName' ) saveNextArg=18;;
'-proxyAddress' ) saveNextArg=19;;
'-changeDeployConfigOnly' ) saveNextArg=20;;
'-servicePrincipalSecret' ) saveNextArg=21;;
'-servicePrincipalClientId' ) saveNextArg=22;;
'-servicePrincipalTenantId' ) saveNextArg=23;;
'-waitForTestComplete' ) WAIT_FOR_TEST_COMPLETE=1;;
'-cleanAll' ) CLEAN_ALL=1;;

* )
echo "Unsupported argument: $saveNextArg $arg"
usage
Expand Down