Skip to content

Commit a590751

Browse files
authored
Pipeline update (#431)
* update pipeline * update * update again * update3 * update4 * Update container cmd
1 parent 6b2ef2a commit a590751

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

azure-pipelines.yml

+16-12
Original file line numberDiff line numberDiff line change
@@ -579,14 +579,6 @@ stages:
579579
pipeline: $(pipelineId)
580580
runVersion: "specific"
581581
runId: ${{ parameters.artifactBuildId }}
582-
- task: PipAuthenticate@1
583-
inputs:
584-
artifactFeeds: 'release/aztfy'
585-
- script: |
586-
set -e
587-
pip install pyOpenSSL --upgrade
588-
pip install pmc-cli
589-
displayName: "Install PMC"
590582
- task: AzureKeyVault@2
591583
displayName: "Get PMC prod certificate"
592584
inputs:
@@ -596,27 +588,39 @@ stages:
596588
RunAsPreJob: false
597589
- script: |
598590
set -e
591+
# Setup the pmc folder at host
599592
pmc_dir=~/.config/pmc
600593
mkdir -p $pmc_dir
594+
601595
echo "$PMC_CERT" > $pmc_dir/aztfexport.pem
596+
597+
pmc_container_dir=/root/.config/pmc
598+
602599
cat << EOF > $pmc_dir/settings.toml
603600
[prod]
604601
base_url = "https://pmc-ingest.trafficmanager.net/api/v4"
605602
msal_client_id = "${PMC_CLIENT_ID}"
606603
msal_scope = "api://d48bb382-20ec-41b9-a0ea-07758a21ccd0/.default"
607-
msal_cert_path = "$pmc_dir/aztfexport.pem"
604+
msal_cert_path = "$pmc_container_dir/aztfexport.pem"
608605
msal_SNIAuth = true
609606
msal_authority = "https://login.microsoftonline.com/MSAzureCloud.onmicrosoft.com"
610607
EOF
608+
609+
# Pull PMC docker image and setup the pmc alias
610+
docker pull mcr.microsoft.com/pmc/pmc-cli
611+
pmc_cmd=(docker run --volume "$pmc_dir:$pmc_container_dir" --rm --network=host mcr.microsoft.com/pmc/pmc-cli)
612+
611613
pkg=(./dist/pkg/*.${TYPE})
612614
[[ ${#pkg[@]} == 1 ]] || { echo "not exactly one target packages found: $(declare -p pkg)" > 2; exit 1; }
613615
pkg=${pkg[0]}
616+
pkg_name=$(basename $pkg)
617+
cp $pkg $pmc_dir/$pkg_name
614618
615619
# Allow error's to occur prior to quit the task, as we are capturing the command output, otherwise, we will have no chance to output that in stdout/stderr.
616620
set +e
617621
618622
# Upload package
619-
ret=$(pmc package upload $pkg)
623+
ret=$("${pmc_cmd[@]}" package upload $pmc_container_dir/$pkg_name)
620624
[[ $? == 0 ]] || { echo "Error: pmc package upload failed: $ret" >&2; exit 1; }
621625
echo -e "pmc package upload returns:\n$ret\n"
622626
@@ -629,12 +633,12 @@ stages:
629633
if [[ $TYPE == deb ]]; then
630634
args+=($REPO_RELEASE)
631635
fi
632-
ret=$(pmc "${args[@]}")
636+
ret=$("${pmc_cmd[@]}" "${args[@]}")
633637
[[ $? == 0 ]] || { echo "Error: pmc repo package update --add-packages: $ret" >&2; exit 1; }
634638
echo -e "pmc repo package update --add-packages returns:\n$ret\n"
635639
636640
# Publish repo
637-
ret=$(pmc repo publish $REPO_ID)
641+
ret=$("${pmc_cmd[@]}" repo publish $REPO_ID)
638642
[[ $? == 0 ]] || { echo "Error: pmc repo publish: $ret" >&2; exit 1; }
639643
echo -e "pmc repo publish returns:\n$ret\n"
640644
displayName: "Publish via pmc"

0 commit comments

Comments
 (0)