Skip to content

Commit 9e61166

Browse files
authored
Merge pull request #1 from Microsoft/master
fork refresh
2 parents 5216af8 + 81a3159 commit 9e61166

File tree

5 files changed

+98
-94
lines changed

5 files changed

+98
-94
lines changed

azure-pipelines.yml

Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,76 @@
1-
pool:
2-
vmImage: 'Ubuntu 16.04'
3-
#Your build pipeline references a secret variable named ‘sp_username’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it secret. See https://go.microsoft.com/fwlink/?linkid=865972
4-
#Your build pipeline references a secret variable named ‘sp_password’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it secret. See https://go.microsoft.com/fwlink/?linkid=865972
5-
#Your build pipeline references a secret variable named ‘sp_tenantid’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it secret. See https://go.microsoft.com/fwlink/?linkid=865972
6-
#Your build pipeline references a secret variable named ‘subscription_id’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it secret. See https://go.microsoft.com/fwlink/?linkid=865972
7-
8-
variables:
9-
- group: AzureKeyVaultSecrets
10-
11-
trigger:
12-
- master
13-
- releases/*
14-
- develop
15-
16-
steps:
17-
- task: UsePythonVersion@0
18-
inputs:
19-
versionSpec: '3.6'
20-
architecture: 'x64'
21-
22-
- task: Bash@3
23-
displayName: 'Install Requirements'
24-
inputs:
25-
targetType: filePath
26-
filePath: 'environment_setup/install_requirements.sh'
27-
workingDirectory: 'environment_setup'
28-
29-
- script: |
30-
az login --service-principal -u $(spidentity) -p $(spsecret) --tenant $(sptenant)
31-
32-
displayName: 'Login to Azure'
33-
34-
- script: |
35-
sed -i 's#"subscription_id": "<>"#"subscription_id": "$(subscription_id)"#g' aml_config/config.json
36-
37-
displayName: 'replace subscription value'
38-
39-
- script: 'pytest tests/unit/data_test.py'
40-
displayName: 'Data Quality Check'
41-
42-
- script: 'python aml_service/00-WorkSpace.py'
43-
displayName: 'Get or Create Workspace'
44-
45-
- script: 'python aml_service/03-AttachAmlCluster.py'
46-
displayName: 'Create AML Compute Cluster'
47-
48-
- script: 'python aml_service/04-AmlPipelines.py'
49-
displayName: 'Create and Test AML Pipeline'
50-
51-
- script: 'python aml_service/04-AmlPipelines.py --pipeline_action publish'
52-
displayName: 'Publish AML Pipeline as Endpoint'
53-
54-
- task: CopyFiles@2
55-
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
56-
inputs:
57-
SourceFolder: '$(Build.SourcesDirectory)'
58-
TargetFolder: '$(Build.ArtifactStagingDirectory)'
59-
Contents: '**'
60-
61-
- task: PublishBuildArtifacts@1
62-
displayName: 'Publish Artifact: devops-for-ai'
63-
inputs:
64-
ArtifactName: 'devops-for-ai'
65-
publishLocation: 'container'
66-
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
67-
TargetPath: '$(Build.ArtifactStagingDirectory)'
68-
69-
- task: PublishBuildArtifacts@1
70-
displayName: 'Publish Artifact: AML Pipeline Config'
71-
inputs:
72-
ArtifactName: 'devops-for-ai-aml-pipeline'
73-
publishLocation: 'container'
74-
pathtoPublish: '$(Build.ArtifactStagingDirectory)/aml_config/pipeline_config.json'
75-
TargetPath: '$(Build.ArtifactStagingDirectory)/aml_config/pipeline_config.json'
76-
1+
pool:
2+
vmImage: 'Ubuntu 16.04'
3+
#Your build pipeline references a secret variable named ‘sp_username’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it secret. See https://go.microsoft.com/fwlink/?linkid=865972
4+
#Your build pipeline references a secret variable named ‘sp_password’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it secret. See https://go.microsoft.com/fwlink/?linkid=865972
5+
#Your build pipeline references a secret variable named ‘sp_tenantid’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it secret. See https://go.microsoft.com/fwlink/?linkid=865972
6+
#Your build pipeline references a secret variable named ‘subscription_id’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it secret. See https://go.microsoft.com/fwlink/?linkid=865972
7+
8+
variables:
9+
- group: AzureKeyVaultSecrets
10+
11+
trigger:
12+
- master
13+
- releases/*
14+
- develop
15+
16+
steps:
17+
- task: UsePythonVersion@0
18+
inputs:
19+
versionSpec: '3.6'
20+
architecture: 'x64'
21+
22+
- task: Bash@3
23+
displayName: 'Install Requirements'
24+
inputs:
25+
targetType: filePath
26+
filePath: 'environment_setup/install_requirements.sh'
27+
workingDirectory: 'environment_setup'
28+
29+
- script: |
30+
az login --service-principal -u $(spidentity) -p $(spsecret) --tenant $(sptenant)
31+
32+
displayName: 'Login to Azure'
33+
34+
- script: |
35+
sed -i 's#"subscription_id": "<>"#"subscription_id": "$(subscriptionid)"#g' aml_config/config.json
36+
37+
displayName: 'replace subscription value'
38+
39+
- script: 'pytest tests/unit/data_test.py'
40+
displayName: 'Data Quality Check'
41+
42+
- script: 'python aml_service/00-WorkSpace.py'
43+
displayName: 'Get or Create Workspace'
44+
45+
- script: 'python aml_service/03-AttachAmlCluster.py'
46+
displayName: 'Create AML Compute Cluster'
47+
48+
- script: 'python aml_service/04-AmlPipelines.py'
49+
displayName: 'Create and Test AML Pipeline'
50+
51+
- script: 'python aml_service/04-AmlPipelines.py --pipeline_action publish'
52+
displayName: 'Publish AML Pipeline as Endpoint'
53+
54+
- task: CopyFiles@2
55+
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
56+
inputs:
57+
SourceFolder: '$(Build.SourcesDirectory)'
58+
TargetFolder: '$(Build.ArtifactStagingDirectory)'
59+
Contents: '**'
60+
61+
- task: PublishBuildArtifacts@1
62+
displayName: 'Publish Artifact: devops-for-ai'
63+
inputs:
64+
ArtifactName: 'devops-for-ai'
65+
publishLocation: 'container'
66+
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
67+
TargetPath: '$(Build.ArtifactStagingDirectory)'
68+
69+
- task: PublishBuildArtifacts@1
70+
displayName: 'Publish Artifact: AML Pipeline Config'
71+
inputs:
72+
ArtifactName: 'devops-for-ai-aml-pipeline'
73+
publishLocation: 'container'
74+
pathtoPublish: '$(Build.ArtifactStagingDirectory)/aml_config/pipeline_config.json'
75+
TargetPath: '$(Build.ArtifactStagingDirectory)/aml_config/pipeline_config.json'
76+

docs/getting_started.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
### 2. Create Azure DevOps account
99
We use Azure DevOps for running our build(CI), retraining trigger and release (CD) pipelines. If you don't already have Azure DevOps account, create one by following the instructions [here](https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/create-organization?view=azure-devops)
1010

11-
If you already have Azure DevOps account, create a new project.
11+
If you already have Azure DevOps account, create a [new project](https://docs.microsoft.com/en-us/azure/devops/organizations/projects/create-project?view=azure-devops).
1212

1313
**Note:** Make sure you have the right permissions in Azure DevOps to do so.
1414

@@ -17,10 +17,9 @@ If you already have Azure DevOps account, create a new project.
1717
To create service principal, register an application entity in Azure Active Directory (Azure AD) and grant it the Contributor or Owner role of the subscription or the resource group where the web service belongs to. See [how to create service principal](https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal) and assign permissions to manage Azure resource.
1818
Please make note the following values after creating a service principal, we will need them in subsequent steps
1919
- Azure subscription id (subscriptionid)
20-
- Service principal username (spidentity)(application id)
21-
- Service principal password (spsecret) (auth_key)
22-
- Service principal tenant id (sptenant)
23-
-
20+
- Service principal username (spidentity)([application id](https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal#get-application-id-and-authentication-key))
21+
- Service principal password (spsecret) ([auth_key](https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal#get-application-id-and-authentication-key))
22+
- Service principal [tenant id](https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal#get-tenant-id) (sptenant)
2423

2524
**Note:** You must have sufficient permissions to register an application with your Azure AD tenant, and assign the application to a role in your Azure subscription. Contact your subscription adminstator if you don't have the permissions. Normally a subscription admin can create a Service principal and can provide you the details.
2625

@@ -36,42 +35,47 @@ We noted the value of these variables in previous steps.
3635

3736
**NOTE:** These values should be treated as secret as they allow access to your subscription.
3837

39-
We make use of variable group inside Azure DevOps to store variables and their values that we want to make available across multiple pipelines. You can either store the values directly here or connect to an Azure Key Vault in your subscription. Please refer to the documentation [here](https://docs.microsoft.com/en-us/azure/devops/pipelines/library/variable-groups?view=azure-devops&tabs=yaml#link-secrets-from-an-azure-key-vault) to learn more about how to create a variable group and [link](https://docs.microsoft.com/en-us/azure/devops/pipelines/library/variable-groups?view=azure-devops&tabs=designer#link-secrets-from-an-azure-key-vault) it to your pipeline.
38+
We make use of variable group inside Azure DevOps to store variables and their values that we want to make available across multiple pipelines. You can either store the values directly in [Azure DevOps](https://docs.microsoft.com/en-us/azure/devops/pipelines/library/variable-groups?view=azure-devops&tabs=designer#create-a-variable-group) or connect to an Azure Key Vault in your subscription. Please refer to the documentation [here](https://docs.microsoft.com/en-us/azure/devops/pipelines/library/variable-groups?view=azure-devops&tabs=designer#create-a-variable-group) to learn more about how to create a variable group and [link](https://docs.microsoft.com/en-us/azure/devops/pipelines/library/variable-groups?view=azure-devops&tabs=designer#use-a-variable-group) it to your pipeline.
4039

4140
Please name your variable group **AzureKeyVaultSecrets**, we are using this name within our build yaml file.
4241

4342
Up until now you shouls have
44-
- forked (or cloned) the repo,
45-
- created a devops account or use an existing one
46-
- got service principal details and subscription id.
47-
- set them as variable group within devops.
43+
- Forked (or cloned) the repo
44+
- Created a devops account or use an existing one
45+
- Got service principal details and subscription id
46+
- Set them as variable group within devops
4847

4948
We now have 3 pipelines that we would set up
50-
- Build Pipeline (azure-pipelines.yml): Runs tests and sets up infrastructure
51-
- Retraining trigger pipeline(/template/retraining-template.json): This pipeline submits a pipeline job to Azure ML Pipelines and trains a new model and publishes image, if new model is better after evaluation.
52-
- Release pipeline(/template/release-template.json) : This pipeline releases our image and deploys it to QA and Prod environment.
49+
- **Build Pipeline (azure-pipelines.yml)**: Runs tests and sets up infrastructure
50+
- **Retraining trigger pipeline(/template/retraining-template.json)**: This pipeline triggers Azure ML Pipeline (training/retraining) which trains a new model and publishes model image, if new model performs better
51+
- **Release pipeline(/template/release-template.json)**: This pipeline deploys and tests model image as web service in QA and Prod environment
5352

5453

5554

5655
### 5. Set up Build Pipeline
5756
1. Select your devops organization and project by clicking dev.azure.com
5857
2. Once you are in the right devops project, click Pipelines on the left hand menu and select Builds
59-
3. In the Build Menu, click **New** dropdown and then select **New build pipeline**
60-
![new build pipeline](./images/new-build-pipeline.png)
58+
3. Click **New pipeline** to create new pipeline
59+
![new build pipeline](./images/new-build-pipeline1.png)
6160
4. On the Connect option page, select **GitHub**
6261
![build connnect step](./images/build-connect.png)
6362

6463
5. On the Select option page, select the GitHub repository where you forked the code.
6564
![select repo](./images/build-selectrepo.png)
6665

67-
6. Since the repository contains azure-pipelines.yml at the root level, Azure DevOps recognizes it and auto imports it. Click run and this will start the build pipeline.
68-
![select repo](./images/build-createpipeline.png)
66+
6. Authorize Azure Pipelines to access your git account
67+
![select repo](./images/Install_Azure_pipeline.png)
6968

70-
7. Your build run would look similar to the following image
69+
7. Since the repository contains azure-pipelines.yml at the root level, Azure DevOps recognizes it and auto imports it. Click **Run** and this will start the build pipeline.
70+
![select repo](./images/build-createpipeline1.png)
71+
72+
8. Your build run would look similar to the following image
7173
![select repo](./images/build-run.png)
7274

7375
Great, you now have the build pipeline setup, you can either manually trigger it or it gets automatically triggered everytime there is a change in the master branch.
7476

77+
**Note:** The build pipeline will perform basic test on the code and provision infrastructure on azure. This can take around 10 mins to complete.
78+
7579
### 6. Set up Retraining trigger release pipeline
7680

7781
**Note:** For setting up release pipelines, first download the [release-pipelines](../release-pipelines) to your local filesystem so you can import it.
38.2 KB
Loading
82.5 KB
Loading
114 KB
Loading

0 commit comments

Comments
 (0)