forked from ing-bank/baker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-build.yaml
114 lines (99 loc) · 3.06 KB
/
azure-build.yaml
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
trigger:
batch: true
branches:
include:
- master
- feature*
parameters:
- name: ForcePublish
default: false
type: boolean
displayName: Force publish (otherwise nothing is published from PR/branch builds)
pool:
vmImage: 'ubuntu-latest'
variables:
- group: BakeryOSSFeedCredentials
- name: CACHE
value: $(HOME)/.cache
- name: IVY_HOME
value: $(Pipeline.Workspace)/.ivy2
- name: CACHE_RUN_ID
value: "20211019"
steps:
- task: Bash@3
displayName: Scan sources
inputs:
targetType: 'inline'
script: |
echo $(Build.Repository.Name)
failOnStderr: true
- task: DownloadSecureFile@1
displayName: Get source scan script
name: sourceScan
inputs:
secureFile: sourceScan.sh
- task: Bash@3
displayName: Scan sources
condition: ne(variables['System.PullRequest.IsFork'], true)
inputs:
targetType: 'inline'
script: |
bash $(sourceScan.secureFilePath)
failOnStderr: true
- task: CacheBeta@1
displayName: Package resolver cache
inputs:
key: cache_$(CACHE_RUN_ID)
path: '$(CACHE)'
- task: CacheBeta@1
displayName: Ivy resolver cache
inputs:
key: ivy_home_$(CACHE_RUN_ID)
path: '$(IVY_HOME)'
- task: Bash@3
displayName: Generate artifacts' version
inputs:
targetType: 'inline'
script: bash ./set-version.sh
- task: JavaToolInstaller@0
inputs:
versionSpec: '11'
jdkArchitectureOption: 'x64'
jdkSourceOption: 'PreInstalled'
cleanDestinationDirectory: false
- task: Bash@3
displayName: 'Building and testing main Baker'
inputs:
targetType: 'inline'
script: |
sbt -Divy.home=${IVY_HOME} -Dsbt.ivy.home=${IVY_HOME} coverage test coverageReport && bash <(curl -s https://codecov.io/bash)
failOnStderr: false
- ${{ if or(eq(parameters['ForcePublish'],true),eq(variables['Build.SourceBranch'], 'refs/heads/master')) }}:
- task: Bash@3
displayName: 'Prepare publishing credentials'
inputs:
targetType: 'inline'
script: printf "realm=pkgs.dev.azure.com\nhost=pkgs.dev.azure.com\nuser=${FEEDUSER}\npassword=${FEEDPASSWORD}\n" > ~/.credentials
env:
FEEDPASSWORD: $(feedPassword) # secrets extracted explicitly, other vars - from the group
- task: Docker@2
displayName: Login to docker
inputs:
command: login
containerRegistry: INGBakeryAtDockerHub
- task: Bash@3
displayName: 'Prepare docker build environments'
inputs:
targetType: 'inline'
script: |
sbt bakery-state/Docker/stage
VERSION=$(./get-version.sh)
echo "##vso[task.setvariable variable=BAKER_VERSION]${VERSION}"
- task: Docker@2
displayName: 'Build and push baker image'
inputs:
workingDirectory: $(Build.SourcesDirectory)/bakery/state/target/docker
command: buildAndPush
repository: ingbakery/baker
dockerfile: $(Build.SourcesDirectory)/bakery/state/target/docker/stage/Dockerfile
tags: latest,$(BAKER_VERSION)