* test gsi

* gsi

* change condition

* update gsi

* add dir path

* check for gsi complete

* PR comments
This commit is contained in:
Rebecca (Makar) McHugh 2021-12-10 16:24:30 -05:00 коммит произвёл GitHub
Родитель d4efc7359e
Коммит b71da5e5fd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 124 добавлений и 0 удалений

Просмотреть файл

@ -375,6 +375,66 @@ write_files:
echo "DONE: end of $0"
- path: /opt/upload_gsi.sh
permissions: '0755'
content: |
#!/bin/bash
function error() {
>&2 echo "echo >< ERROR: $* See log for details."
exit 1
}
export AZURE_SUBSCRIPTION='<sub_id>'
export ARM_SUBSCRIPTION_ID='<sub_id>'
export ARM_CLIENT_ID='<arm_client_id>'
export ARM_CLIENT_SECRET='<arm_client_scrt>'
export ARM_TENANT_ID='<arm_tenant_id>'
export REGION='<region>'
export RESOURCE_GROUP_NAME='<resource_group_name>'
export GSI_URL='<gsi_url>'
export TF_VFXT_CONFIG='<terraform_file_config>'
echo "cd to file path"
cd /tf/src/terraform/examples/vfxt/${TF_VFXT_CONFIG}
[ $? -ne 0 ] && error "cd to directory: $TF_VFXT_CONFIG"
MANAGEMENT_IP=$(terraform output -json | jq -r ".management_ip.value")
echo "ssh - initial connection needed for below following cmds"
ssh -o "StrictHostKeyChecking=no" -oProxyCommand="ssh -oStrictHostKeyChecking=no -W %h:%p admin@${MANAGEMENT_IP}" root@${MANAGEMENT_IP} ls
[ $? -ne 0 ] && error "ssh for initial connection"
echo "ssh to run averecmd accept terms"
ssh -J admin@${MANAGEMENT_IP} root@${MANAGEMENT_IP} "/support/bin/averecmd support.acceptTerms yes"
[ $? -ne 0 ] && error "ssh to run averecmd accept terms"
echo "ssh to run averecmd setCustomSetting"
ssh -J admin@${MANAGEMENT_IP} root@${MANAGEMENT_IP} "/support/bin/averecmd support.setCustomSetting 'gsiInfo.url' 'LB' '${GSI_URL}'"
[ $? -ne 0 ] && error "ssh to run averecmd setCustomSetting"
echo "ssh to run averecmd gsi"
job_id=$(ssh -J admin@${MANAGEMENT_IP} root@${MANAGEMENT_IP} "/support/bin/averecmd support.executeNormalMode cluster gsimin")
[ $? -ne 0 ] && error "ssh to run averecmd gsi"
response=False
while [ "${response}" != "True" ] ; do
response=$(ssh -J admin@${MANAGEMENT_IP} root@${MANAGEMENT_IP} "/support/bin/averecmd support.taskIsDone $job_id")
if [ "${response}" == "False" ]; then
echo "INFO: gsi collect is still active. Re-check in 30 seconds."
sleep 30
continue
elif [ "${response}" == "True" ]; then
echo "INFO: gsi collect is no longer active"
echo "gsi_complete" > /tmp/gsi_results.done
break
else
error "Response was not True or False for averecmd support.taskIsDone"
fi
done
echo "DONE: end of $0"
runcmd:
- "echo '# STEP: Setup SSH key.'"
- "cp -v /root/.ssh/id_rsa /home/<vm_admin_user>/.ssh/id_rsa"

Просмотреть файл

@ -93,6 +93,7 @@ steps:
-e "s,<build_sourcebranch>,${BUILD_SOURCEBRANCH}," \
-e "s/<vdbench_config>/${{ parameters.vdbench_config }}/" \
-e "s,<vdbench_download_url>,${vdbench_sed_url//&/\\&}," \
-e "s,<gsi_url>,$GSI_URL," \
${cloud_init_file}
check_rc.sh $? "Preparing cloud-init file (sed)" || exit
@ -155,4 +156,5 @@ steps:
ARM_CLIENT_SECRET: $(AZURE-CLIENT-SECRET)
ARM_TENANT_ID: $(AZURE-TENANT-ID)
ARM_SUBSCRIPTION_ID: $(AZURE-SUBSCRIPTION-ID)
GSI_URL: $(GSI-URL)
VDBENCH_URL: $(VDBENCH-URL)

61
templates/upload_gsi.yml Normal file
Просмотреть файл

@ -0,0 +1,61 @@
# Copyright (C) Microsoft Corporation. All rights reserved.
# https://aka.ms/yaml
steps:
- script: |
export PATH=$PATH:${BUILD_SOURCESDIRECTORY}/test/utils
TMUX_SESSION=upload_gsi
echo "##vso[task.setvariable variable=TMUX_SESSION]${TMUX_SESSION}"
cmdokmsg="CMD_OK_$(date -u '+%m%dx%H%M%S')"
cmdlog=/tmp/vm_runcmd.log
az vm run-command invoke \
--resource-group ${RESOURCE_GROUP_NAME} \
--name ${VM_NAME} \
--command-id RunShellScript \
--scripts "tmux new-session -d -s ${TMUX_SESSION} /opt/upload_gsi.sh && echo ${cmdokmsg}" \
--query 'value[0].message' --output tsv |& tee ${cmdlog}
check_rc.sh ${PIPESTATUS[0]} " ${TMUX_SESSION} command" || exit 0
grep -q ${cmdokmsg} ${cmdlog}
check_rc.sh $? "Check for CMD_OK (${cmdokmsg}) in cmdlog (${cmdlog}) for ${TMUX_SESSION}" || exit 0
cmdokmsg2="CMD_OK_$(date -u '+%m%dx%H%M%S')"
cmdlog2=/tmp/vm_runcmd2.log
polling_secs=60
while [ 1 ]; do
az vm run-command invoke \
--resource-group ${RESOURCE_GROUP_NAME} \
--name ${VM_NAME} \
--command-id RunShellScript \
--scripts "tmux has-session -t ${TMUX_SESSION} || echo ${cmdokmsg2}" \
--query 'value[0].message' --output tsv |& tee ${cmdlog2}
check_rc.sh ${PIPESTATUS[0]} "Checking for tmux session ${TMUX_SESSION}" || exit
grep -q ${cmdokmsg2} ${cmdlog2}
if [ $? -ne 0 ]; then
echo "INFO: tmux session ${TMUX_SESSION} still active. Re-check in ${polling_secs} seconds."
sleep ${polling_secs}
continue
else
echo "INFO: tmux session ${TMUX_SESSION} no longer active"
break
fi
done
cmdlog3=/tmp/vm_runcmd2.log
az vm run-command invoke \
--resource-group ${RESOURCE_GROUP_NAME} \
--name ${VM_NAME} \
--command-id RunShellScript \
--scripts "cat /tmp/gsi_results.done" \
--query 'value[0].message' --output tsv |& tee ${cmdlog3}
check_rc.sh ${PIPESTATUS[0]} "Checking for file /tmp/gsi_results.done" || exit
grep -q 'gsi_complete' ${cmdlog3}
check_rc.sh $? "Check for (gsi_complete) in cmdlog (${cmdlog3})" || exit 0
displayName: "Run GSI script for gsi and check for complete"
timeoutInMinutes: 45
condition: always()
env:
ARM_CLIENT_ID: $(AZURE-CLIENT-ID)
ARM_CLIENT_SECRET: $(AZURE-CLIENT-SECRET)
ARM_TENANT_ID: $(AZURE-TENANT-ID)
ARM_SUBSCRIPTION_ID: $(AZURE-SUBSCRIPTION-ID)

Просмотреть файл

@ -162,6 +162,7 @@ jobs:
- template: templates/vdbench_save.yml
parameters:
vdbench_config: ${{ parameters.vdbench_config }}
- template: templates/upload_gsi.yml
- ${{ if eq(parameters.run_destroy_and_cleanup, true) }}:
- ${{ if eq(parameters.run_vdbench, true) }}:
- ${{ if eq(parameters.tf_config, 'azureblobfiler') }}: