forked from liupeirong/MLOpsManufacturing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish-model-artifact-template.yml
29 lines (24 loc) · 1.14 KB
/
publish-model-artifact-template.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Pipeline template to check if a model was registered for the build and publishes an artifact with the model JSON
parameters:
- name: workingDirectory
displayName: Working Directory for sample
type: string
steps:
- task: AzureCLI@1
inputs:
azureSubscription: '$(WORKSPACE_SVC_CONNECTION)'
scriptLocation: inlineScript
workingDirectory: ${{ parameters.workingDirectory }}
inlineScript: |
az extension show --name azure-cli-ml
set -e # fail on error
# Get the model using the build ID tag
# FOUND_MODEL=$(az ml model list -g $(RESOURCE_GROUP) --workspace-name $(WORKSPACE_NAME) --tag BuildId=$(Build.BuildId) --query '[0]')
FOUND_MODEL=$(az ml model list -g $(RESOURCE_GROUP) --workspace-name $(WORKSPACE_NAME) --tag BuildId=585 --query '[0]')
# If the variable is empty, print and fail
[[ -z "$FOUND_MODEL" ]] && { echo "Model was not registered for this run." ; exit 1; }
echo $FOUND_MODEL >model.json
name: 'getversion'
displayName: "Determine if evaluation succeeded and new model is registered (CLI)"
- publish: ${{ parameters.workingDirectory }}/model.json
artifact: model