-
Notifications
You must be signed in to change notification settings - Fork 1
/
azure-pipelines.yml
53 lines (49 loc) · 1.87 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
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- master
pool:
name: 'OpenShift-Agent'
variables:
tag: '$(Build.BuildId)'
project-name: azure-devops
stages:
- stage: Build
displayName: Build
jobs:
- job: BuildJob
steps:
- script: echo Starting Pipeline! $(tag)
displayName: 'Run a one-line script'
- script: oc status
displayName: 'Test oc'
- script: |
oc delete deployment,svc,route --selector app=dot-net-example --ignore-not-found
oc delete bc dot-net-example --ignore-not-found
displayName: 'Clean up previous'
- script: oc new-build --name dot-net-example --binary --strategy source --image-stream dotnet:3.1 --env DOTNET_STARTUP_PROJECT=app/tmp.csproj --env DOTNET_RM_SRC=true --env DOTNET_INCREMENTAL=true
displayName: 'Create a new build for an OpenShift s2i build'
- script: oc start-build dot-net-example --from-dir /_work/1/s/. --wait --follow
displayName: 'Run the build'
- stage: StoreImage
displayName: Store Image in ACR
jobs:
- job: StoreImageJob
steps:
- script: skopeo copy --dest-creds "$ACR_USER:$ACR_PASSWORD" --src-registry-token `oc whoami -t` --src-tls-verify=false docker://image-registry.openshift-image-registry.svc:5000/$(project-name)/dot-net-example:latest docker://bfdemorepo.azurecr.io/dot-net-example:$(tag)
env:
ACR_PASSWORD: $(acr-password)
ACR_USER: $(acr-user)
REGISTRY_AUTH_FILE:
displayName: 'Store image in Azure Container Registry for backup'
- stage: Deploy
displayName: Deploy
jobs:
- job: DeployJob
steps:
- script: oc new-app dot-net-example
displayName: 'Create a new application'
- script: oc expose svc/dot-net-example
displayName: 'Expose service'