-
Notifications
You must be signed in to change notification settings - Fork 494
/
azure-pipelines-ctl-publishing.yml
53 lines (51 loc) · 2.42 KB
/
azure-pipelines-ctl-publishing.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
jobs:
- job: BuildDockerImage
timeoutInMinutes: 20
variables:
- name: ContainerRegistryName
value: 'cosmosdotnetsdkctl'
- name: ContainerRegistryUserName
value: 'cosmosdotnetsdkctl'
- name: ContainerRegistryUrl
value: 'cosmosdotnetsdkctl.azurecr.io'
pool:
name: 'OneES'
demands:
- ImageOverride -equals dotnet-ubuntu-latest
steps:
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
clean: true # if true, execute `execute git clean -ffdx && git reset --hard HEAD` before fetching
- task: CopyFiles@2
displayName: 'Copy docker config files'
inputs:
Contents: '$(build.sourcesdirectory)/Microsoft.Azure.Cosmos.Samples/Tools/CTL/Dockerfile'
TargetFolder: $(Agent.TempDirectory)/ctl
flattenFolders: true
- task: CopyFiles@2
displayName: 'Copy shell files'
inputs:
Contents: '$(build.sourcesdirectory)/Microsoft.Azure.Cosmos.Samples/Tools/CTL/run_ctl.sh'
TargetFolder: $(Agent.TempDirectory)/ctl
flattenFolders: true
- task: DotNetCoreCLI@2
displayName: Build CTL project
condition: succeeded()
inputs:
command: 'publish'
publishWebProjects: false
zipAfterPublish: false
modifyOutputPath: true
projects: '$(build.sourcesdirectory)/Microsoft.Azure.Cosmos.Samples/Tools/CTL/CosmosCTL.csproj'
arguments: '-c Release -o $(Agent.TempDirectory)/ctl/artifacts'
nugetConfigPath: NuGet.config
- pwsh: |
cd $(Agent.TempDirectory)/ctl
Write-Host "Executing docker build . -t cosmos-dotnet-ctl"
docker build -t cosmos-dotnet-ctl -f Dockerfile .
Write-Host "Executing az acr login --name $(ContainerRegistryName) -u $(ContainerRegistryUserName) -p $(dotnet-cosmos-container-registry-pwd)"
az acr login --name $(ContainerRegistryName) -u $(ContainerRegistryUserName) -p $(dotnet-cosmos-container-registry-pwd)
Write-Host "Executing docker tag cosmos-dotnet-ctl $(ContainerRegistryUrl)/cosmos-dotnet-ctl/$(DefaultTag)"
docker tag cosmos-dotnet-ctl $(ContainerRegistryUrl)/cosmos-dotnet-ctl/$(DefaultTag)
Write-Host "Executing docker push $(ContainerRegistryUrl)/cosmos-dotnet-ctl/$(DefaultTag)"
docker push $(ContainerRegistryUrl)/cosmos-dotnet-ctl/$(DefaultTag)
displayName: 'Build and push docker image to registry'