-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
118 lines (110 loc) · 4.19 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
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
115
116
117
118
pr: none
trigger:
batch: true
branches:
include:
- '*'
tags:
include:
- 'dev-*'
pool:
vmImage: ubuntu-latest
stages:
- stage: build
displayName: Build
dependsOn: []
jobs:
- job: build
displayName: Build Docker Images
steps:
- script: docker build --target=base --tag keboola/job-runner .
displayName: Build Docker images
- template: azure-pipelines/steps/store-docker-artifact.yml
- stage: tests
displayName: Tests
dependsOn: build
pool:
name: Default # run on custom worker, tests needs Docker socket
jobs:
- template: azure-pipelines/jobs/run-tests.yml
parameters:
displayName: Run Tests
envName: aws
secrets:
TEST_STORAGE_API_TOKEN: $(TEST_STORAGE_API_TOKEN)
TEST_STORAGE_API_TOKEN_MASTER: $(TEST_STORAGE_API_TOKEN_MASTER)
# push to testing
- stage: publishImages_testing
displayName: Publish Testing Images
dependsOn: [build, tests]
jobs:
- job:
displayName: Publish Docker Images
steps:
- template: azure-pipelines/steps/restore-docker-artifact.yml
- template: azure-pipelines/steps/push-docker-image.yml
parameters:
displayName: Testing
awsCredentials: Testing - ECR Distribution
awsRegionName: eu-central-1
acrRegistry: keboolapes.azurecr.io
sourceImage: keboola/job-runner
targetImage: job-runner
tags:
- build-$(Build.SourceVersion)
- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}:
- latest
# push to production (dev-* tags)
- ${{ if startsWith(variables['Build.SourceBranch'], 'refs/tags/dev-') }}:
- stage: publishImages_production
displayName: Publish Production Images (dev tag)
dependsOn: [build, tests]
jobs:
- job:
displayName: Publish Docker Images
steps:
- template: azure-pipelines/steps/restore-docker-artifact.yml
- template: azure-pipelines/steps/push-docker-image.yml
parameters:
displayName: Production
awsCredentials: Production - ECR Distribution
awsRegionName: us-east-1
acrRegistry: keboola.azurecr.io
garPushEnabled: True
garRegistry: Keboola GAR
garRepository: us-central1-docker.pkg.dev/keboola-prod-artifacts
garRepositoryProjectId: keboola-prod-artifacts
sourceImage: keboola/job-runner
targetImage: job-runner
tags:
- ${{ replace(variables['Build.SourceBranch'],'refs/tags/','') }}
# push to production (main branch)
- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}:
- stage: publishImages_production
displayName: Publish Production Images (main branch)
dependsOn: [build, tests]
jobs:
- job:
displayName: Publish Docker Images
steps:
- template: azure-pipelines/steps/restore-docker-artifact.yml
- template: azure-pipelines/steps/push-docker-image.yml
parameters:
displayName: Production
awsCredentials: Production - ECR Distribution
awsRegionName: us-east-1
acrRegistry: keboola.azurecr.io
garPushEnabled: True
garRegistry: Keboola GAR
garRepository: us-central1-docker.pkg.dev/keboola-prod-artifacts
garRepositoryProjectId: keboola-prod-artifacts
sourceImage: keboola/job-runner
targetImage: job-runner
tags:
- production-$(Build.SourceVersion)
- script: echo "production-$(Build.SourceVersion)" > artifact
displayName: Create artifact
- task: PublishPipelineArtifact@1
inputs:
targetPath: artifact
artifact: keboola.job-runner.latest-build