Skip to content

Commit 37b44d0

Browse files
author
Sheyla Trudo
committed
fixup! Separate Build Changes
1 parent bb05d25 commit 37b44d0

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
parameters:
2+
- name: arch
3+
type: string
4+
values:
5+
- amd64
6+
- arm64
7+
8+
- name: os
9+
type: string
10+
values:
11+
- windows
12+
- linux
13+
14+
- name: images
15+
type: object
16+
17+
18+
jobs:
19+
- ${{ each image in parameters.images }}:
20+
- job: ${{ image }}_${{ parameters.os }}_${{ parameters.arch }}
21+
displayName: Build Images
22+
pool:
23+
arch: ${{ parameters.arch }}
24+
os: ${{ parameters.os }}
25+
${{ if eq(parameters.os, 'windows' }}:
26+
name: $(BUILD_POOL_NAME_DEFAULT_WINDOWS)
27+
${{ elseif eq(parameters.os, 'linux' }}:
28+
${{ if eq(parameters.arch, 'amd64') }}:
29+
name: $(BUILD_POOL_NAME_DEFAULT)
30+
${{ elseif eq(parameters.arch, 'arm64') }}:
31+
name: $(BUILD_POOL_NAME_LINUX_ARM64)
32+
33+
templateContext:
34+
type: containerBuildJob
35+
arguments:
36+
image: $(IMAGE_NAME_AND_TAG_${{ parameters.name }})
37+
dockerfile: $(DOCKERFILE_PATH_${{ parameters.name }})
38+
path: $(BUILD_CONTEXT_${{ parameters.name }})
39+
buildArguments: TARGET=${{ parameters.os }} OS=${{ parameters.os }} PLATFORM=${{ parameters.os }} ARCH=${{ parameters.arch }} $(EXTRA_BUILD_ARGS_${{ parameters.name }})
40+
enableNetwork: true # Optional. Default: false
41+
enablePull: false # Optional. Default: true
42+
enableCache: true # Optional. Default: false
43+
useBuildKit: true
44+
45+
steps:
46+
- task: GoTool@0
47+
inputs:
48+
version: $(GO_VERSION)
49+
- bash: |
50+
set -e
51+
52+
BUILD_CONTEXT=$(make "$MAKE_BUILD_CONTEXT")
53+
echo >&2 "##vso[task.setvariable variable=BUILD_CONTEXT_${VAR_ID};]$BUILD_CONTEXT"
54+
55+
IMAGE_NAME_AND_TAG=$(make "$MAKE_IMG_NAME_AND_TAG")
56+
echo >&2 "##vso[task.setvariable variable=IMAGE_NAME_AND_TAG_${VAR_ID};]$IMAGE_NAME_AND_TAG"
57+
58+
DOCKERFILE_PATH=$(make "$MAKE_DOCKERFILE_PATH")
59+
echo >&2 "##vso[task.setvariable variable=DOCKERFILE_PATH_${VAR_ID};]$DOCKERFILE_PATH"
60+
61+
EXTRA_BUILD_ARGS=$(make "$MAKE_EXTRA_BUILD_ARGS")
62+
echo >&2 "##vso[task.setvariable variable=EXTRA_BUILD_ARGS_${VAR_ID};]$EXTRA_BUILD_ARGS"
63+
displayName: "Get Image Name"
64+
env:
65+
VAR_ID: ${{ parameters.name }}
66+
MAKE_BUILD_CONTEXT: ${{ parameters.name }}-image-build-context
67+
MAKE_IMG_NAME_AND_TAG: ${{ parameters.name }}-image-name-and-tag
68+
MAKE_DOCKERFILE_PATH: ${{ parameters.name }}-image-dockerfile-path
69+
MAKE_EXTRA_BUILD_ARGS: ${{ parameters.name }}-image-build-args

0 commit comments

Comments
 (0)