microsoft / agogosml

agogosml is a flexible data processing pipeline that addresses the common need for operationalizing ML models at scale
MIT License
33 stars 16 forks source link

[WIP - NO MERGE] Moves subscription ID to a ENV variable on the Pipeline and a fast fail check if not set. #259

Closed cicorias closed 5 years ago

cicorias commented 5 years ago

This adds a step in the pipeline to verify if the Azure Subscription endpoint is set as a Env variable. This removes the need to add the Subscription ID at Generate time in cookie cutter.

This is based off of the YAML support branch as well.

Ideally, and will add another work item - this should be encapsulated into a vsts task - as the following code "could" be added - but if these were tasks and installable better encpasulation and reuse.

echo "calling DevOps REST API"

body=$(curl --request GET \
  --url $SYSTEM_TEAMFOUNDATIONCOLLECTIONURI/$SYSTEM_TEAMPROJECT/_apis/serviceendpoint/endpoints/$endpointId?api-version=5.0-preview.2 \
  --header "Authorization: Bearer ${SYSTEM_ACCESSTOKEN}" \
  --header 'cache-control: no-cache')

echo $body

echo "parsing json"

result=$(echo $body | jq ". |  select( .id | test(\"^${endpointId}$\"; \"i\")) ")

echo "checking result"
if [ -z "$result" ]; then
    echo 'not found'
    exit 1
else
    echo $result
    exit 0
fi

closes: https://tigna.visualstudio.com/TIEM_Welding_ML_Pilot/_workitems/edit/277/

All Submissions:

sayar commented 5 years ago

@cicorias can you please rebase against master? It's hard to see the diff at the moment against master.

cicorias commented 5 years ago

this is bsaed off the yaml-pipeline-switch - so, best to await that merge. @sayar