forked from aronchick/kubeflow-and-mlops
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
87 lines (75 loc) · 3.5 KB
/
azure-pipelines.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Kubeflow Container Build Pipeline
trigger:
- master
pr: none
stages:
- stage: ContainerConfig
displayName: 'Configure and Register Containers'
jobs:
- job: Containers
pool:
name: default
steps:
- task: AzureCLI@1
inputs:
azureSubscription: 'Shared Data Platform - R+D (1308a130-d549-44e1-ba66-ce8c487d76e3)'
scriptLocation: 'inlineScript'
inlineScript: '
sudo az acr login -n kubeflowregistry &&
cd code &&
cd preprocess &&
sudo docker build -t kubeflowregistry.azurecr.io/kubeflow/preprocess:$BUILD_SOURCEVERSION . &&
sudo docker push kubeflowregistry.azurecr.io/kubeflow/preprocess:$BUILD_SOURCEVERSION '
displayName: 'Build & Push Preprocess Image'
- task: AzureCLI@1
inputs:
azureSubscription: 'Shared Data Platform - R+D (1308a130-d549-44e1-ba66-ce8c487d76e3)'
scriptLocation: 'inlineScript'
inlineScript: '
cd code &&
cd training &&
sudo docker build -t kubeflowregistry.azurecr.io/kubeflow/training:$BUILD_SOURCEVERSION . &&
sudo docker push kubeflowregistry.azurecr.io/kubeflow/training:$BUILD_SOURCEVERSION '
displayName: 'Build & Push Training Image'
- task: AzureCLI@1
inputs:
azureSubscription: 'Shared Data Platform - R+D (1308a130-d549-44e1-ba66-ce8c487d76e3)'
scriptLocation: 'inlineScript'
inlineScript: '
cd code &&
cd register &&
sudo docker build -t kubeflowregistry.azurecr.io/kubeflow/register:$BUILD_SOURCEVERSION . &&
sudo docker push kubeflowregistry.azurecr.io/kubeflow/register:$BUILD_SOURCEVERSION '
displayName: 'Build & Push Register Image'
# Moved KF step to build
- stage: KubeflowTrigger
dependsOn: ContainerConfig
displayName: 'Trigger Kubeflow Pipeline'
variables:
- group: kf-variables
jobs:
- job: Kubeflow
pool:
name: default
steps:
- task: AzureCLI@1
env:
KF_MAPPED_SERVICE_PRINCIPAL_PASSWORD: $(KF_SERVICE_PRINCIPAL_PASSWORD)
inputs:
azureSubscription: 'Shared Data Platform - R+D (1308a130-d549-44e1-ba66-ce8c487d76e3)'
scriptLocation: 'inlineScript'
inlineScript: |
az aks get-credentials -g kubeflow-mlops-rg -n kubeflow-mlops-cluster
kubectl port-forward --namespace kubeflow svc/ml-pipeline 8888:8888 &
kubepid=$!
sudo apt-get install python3-setuptools
pip3 install wheel
pip3 install kfp
touch script.py
echo "import kfp" >> script.py
echo "client = kfp.Client(host='localhost:8888')" >> script.py
echo "client.run_pipeline('$KF_EXPERIMENT_ID', 'Run ${BUILD_BUILDID}', params={'imagetag': '${BUILD_SOURCEVERSION}', 'tenant-id': '$KF_TENANT_ID', 'service-principal-id': '$KF_SERVICE_PRINCIPAL_ID', 'service-principal-password': '$KF_MAPPED_SERVICE_PRINCIPAL_PASSWORD', 'subscription-id': '$KF_SUBSCRIPTION_ID', 'resource-group': '$KF_RESOURCE_GROUP', 'workspace': '$KF_WORKSPACE', 'persistent-volume-name': '$KF_PERSISTENT_VOLUME_NAME', 'persistent-volume-path': '$KF_PERSISTENT_VOLUME_PATH', 'data-download': '$KF_DATA_DOWNLOAD', 'epochs': '$KF_EPOCHS', 'batch': '$KF_BATCH', 'learning-rate': '$KF_LEARNING_RATE', 'model-name': '$KF_MODEL_NAME'}, pipeline_id='$KF_PIPELINE_ID')" >> script.py
cat script.py
python3 script.py
kill $kubepid
displayName: 'Trigger Kubeflow Pipeline'