forked from Azure-Samples/azure-voting-app
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathazure-pipelines.yml
71 lines (63 loc) · 2.43 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
# Docker
# Build and push an image to Azure Container Registry
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker
trigger:
- master
resources:
- repo: self
variables:
- group: Container Journey
# Agent VM image name
- name: vmImageName
value: 'ubuntu-latest'
stages:
- stage: Build
displayName: Build and push stage
jobs:
- job: Build
displayName: Build
pool:
vmImage: $(vmImageName)
steps:
- checkout: self
persistCredentials: true
clean: true
- bash: |
curl $BEDROCK_BUILD_SCRIPT > build.sh
chmod +x ./build.sh
displayName: Download Bedrock orchestration script
env:
BEDROCK_BUILD_SCRIPT: https://raw.githubusercontent.com/Microsoft/bedrock/master/gitops/azure-devops/build.sh
- task: HelmInstaller@1
inputs:
helmVersionToInstall: "2.16.3"
- task: ShellScript@2
displayName: Validate fabrikate definitions
inputs:
scriptPath: build.sh
condition: eq(variables['Build.Reason'], 'PullRequest')
env:
VERIFY_ONLY: 1
- task: ShellScript@2
displayName: Transform fabrikate definitions and publish to YAML manifests to repo
inputs:
scriptPath: build.sh
condition: ne(variables['Build.Reason'], 'PullRequest')
env:
ACCESS_TOKEN_SECRET: $(ACCESS_TOKEN)
COMMIT_MESSAGE: $(Build.SourceVersionMessage)
REPO: $(MANIFEST_REPO)
BRANCH_NAME: $(Build.SourceBranchName)
- bash: |
cd "$HOME"/${MANIFEST_REPO##*/}
commitId=$(Build.SourceVersion)
commitId=$(echo "${commitId:0:7}")
latest_commit=$(git rev-parse --short HEAD)
echo "Downloading SPK"
curl https://raw.githubusercontent.com/Microsoft/bedrock/master/gitops/azure-devops/build.sh > build.sh
chmod +x build.sh
. ./build.sh --source-only
get_spk_version
download_spk
./spk/spk deployment create -n $(ACCOUNT_NAME) -k $(ACCOUNT_KEY) -t $(TABLE_NAME) -p azure-voting --p3 $(Build.BuildId) --hld-commit-id $commitId --manifest-commit-id $latest_commit
displayName: Update manifest pipeline details in Spektate db