Skip to content

Commit c5613d2

Browse files
author
Sheyla Trudo
committed
fixup! Separate Build Changes
1 parent 8f628cf commit c5613d2

File tree

4 files changed

+62
-106
lines changed

4 files changed

+62
-106
lines changed
Lines changed: 35 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,48 @@
11
parameters:
22
- name: arch
33
type: string
4-
values:
5-
- amd64
6-
- arm64
74

85
- name: os
96
type: string
10-
values:
11-
- windows
12-
- linux
137

148
- name: images
159
type: object
1610

1711

1812
jobs:
19-
- ${{ each image in parameters.images }}:
20-
- job: ${{ replace(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-
templateContext:
33-
authenticatedContainerRegistries:
34-
- serviceConnection: 'Azure Container Networking - ACN Public Registry - Retina'
35-
- registry: onebranch.azurecr.io
36-
tenant: AME
37-
identity: 1ESPipelineIdentity
38-
containers:
39-
${{ if eq(parameters.os, 'windows') }}:
40-
default_windows_container:
41-
image: onebranch.azurecr.io/windows/ltsc2019/vse2022:latest
42-
${{ elseif eq(parameters.os, 'linux') }}:
43-
default_linux_container:
44-
image: onebranch.azurecr.io/linux/ubuntu-2204:latest
45-
outputs:
46-
- output: pipelineArtifact
47-
targetPath: $(System.DefaultWorkingDirectory)/output
48-
artifactName: output
49-
type: containerBuildJob
50-
arguments:
51-
pipelineArtifact: output
52-
image: $(IMAGE_NAME_AND_TAG_${{ parameters.name }})
53-
dockerfile: $(DOCKERFILE_PATH_${{ parameters.name }})
54-
path: $(BUILD_CONTEXT_${{ parameters.name }})
55-
buildArguments: TARGET=${{ parameters.os }} OS=${{ parameters.os }} PLATFORM=${{ parameters.os }} ARCH=${{ parameters.arch }} $(EXTRA_BUILD_ARGS_${{ parameters.name }})
56-
enableNetwork: true # Optional. Default: false
57-
enablePull: false # Optional. Default: true
58-
enableCache: true # Optional. Default: false
59-
useBuildKit: true
60-
13+
- ${{ each image in split(parameters.images, '\n') }}:
14+
- job: ${{ image }}_${{ parameters.os }}_${{ parameters.arch }}
15+
displayName: Build Image - (${{ image }} ${{ parameters.os }}/${{ parameters.arch }})
16+
6117
steps:
62-
- task: GoTool@0
63-
inputs:
64-
version: $(GO_VERSION)
65-
- bash: |
66-
set -e
67-
68-
BUILD_CONTEXT=$(make "$MAKE_BUILD_CONTEXT")
69-
echo >&2 "##vso[task.setvariable variable=BUILD_CONTEXT_${VAR_ID};]$BUILD_CONTEXT"
70-
71-
IMAGE_NAME_AND_TAG=$(make "$MAKE_IMG_NAME_AND_TAG")
72-
echo >&2 "##vso[task.setvariable variable=IMAGE_NAME_AND_TAG_${VAR_ID};]$IMAGE_NAME_AND_TAG"
73-
74-
DOCKERFILE_PATH=$(make "$MAKE_DOCKERFILE_PATH")
75-
echo >&2 "##vso[task.setvariable variable=DOCKERFILE_PATH_${VAR_ID};]$DOCKERFILE_PATH"
76-
77-
EXTRA_BUILD_ARGS=$(make "$MAKE_EXTRA_BUILD_ARGS")
78-
echo >&2 "##vso[task.setvariable variable=EXTRA_BUILD_ARGS_${VAR_ID};]$EXTRA_BUILD_ARGS"
79-
displayName: "Get Image Name"
80-
env:
81-
VAR_ID: ${{ parameters.name }}
82-
MAKE_BUILD_CONTEXT: ${{ parameters.name }}-image-build-context
83-
MAKE_IMG_NAME_AND_TAG: ${{ parameters.name }}-image-name-and-tag
84-
MAKE_DOCKERFILE_PATH: ${{ parameters.name }}-image-dockerfile-path
85-
MAKE_EXTRA_BUILD_ARGS: ${{ parameters.name }}-image-build-args
18+
- task: GoTool@0
19+
inputs:
20+
version: $(GO_VERSION)
21+
22+
- bash: |
23+
set -e
24+
25+
BUILD_CONTEXT=$(make "$MAKE_BUILD_CONTEXT")
26+
echo >&2 "##vso[task.setvariable variable=BUILD_CONTEXT_${VAR_ID};]$BUILD_CONTEXT"
27+
28+
IMAGE_NAME_AND_TAG=$(make "$MAKE_IMG_NAME_AND_TAG")
29+
echo >&2 "##vso[task.setvariable variable=IMAGE_NAME_AND_TAG_${VAR_ID};]$IMAGE_NAME_AND_TAG"
30+
31+
DOCKERFILE_PATH=$(make "$MAKE_DOCKERFILE_PATH")
32+
echo >&2 "##vso[task.setvariable variable=DOCKERFILE_PATH_${VAR_ID};]$DOCKERFILE_PATH"
33+
34+
EXTRA_BUILD_ARGS=$(make "$MAKE_EXTRA_BUILD_ARGS")
35+
echo >&2 "##vso[task.setvariable variable=EXTRA_BUILD_ARGS_${VAR_ID};]$EXTRA_BUILD_ARGS"
36+
displayName: "Get Image Name"
37+
env:
38+
VAR_ID: ${{ parameters.name }}
39+
MAKE_BUILD_CONTEXT: ${{ parameters.name }}-image-build-context
40+
MAKE_IMG_NAME_AND_TAG: ${{ parameters.name }}-image-name-and-tag
41+
MAKE_DOCKERFILE_PATH: ${{ parameters.name }}-image-dockerfile-path
42+
MAKE_EXTRA_BUILD_ARGS: ${{ parameters.name }}-image-build-args
43+
44+
- template: containers/container-template.steps.yaml
45+
parameters:
46+
arch: ${{ parameters.arch }}
47+
name: ${{ parameters.name }}
48+
os: ${{ parameters.os }}

.pipelines/containers/container-template.steps.yaml

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,38 @@
11
parameters:
2-
arch: ""
3-
name: ""
4-
os: ""
2+
- name: name
3+
type: string
4+
values:
5+
- azure-ipam
6+
- cni
7+
- cns
8+
- ipv6-hp-bpf
9+
- npm
510

6-
steps:
7-
- bash: |
8-
set -e
9-
10-
BUILD_CONTEXT=$(make "$MAKE_BUILD_CONTEXT")
11-
echo >&2 "##vso[task.setvariable variable=BUILD_CONTEXT_${VAR_ID};]$BUILD_CONTEXT"
11+
- name: arch
12+
type: string
13+
values:
14+
- amd64
15+
- arm64
1216

13-
IMAGE_NAME_AND_TAG=$(make "$MAKE_IMG_NAME_AND_TAG")
14-
echo >&2 "##vso[task.setvariable variable=IMAGE_NAME_AND_TAG_${VAR_ID};]$IMAGE_NAME_AND_TAG"
17+
- name: os
18+
type: string
19+
default: ""
20+
values:
21+
- windows
22+
- linux
1523

16-
DOCKERFILE_PATH=$(make "$MAKE_DOCKERFILE_PATH")
17-
echo >&2 "##vso[task.setvariable variable=DOCKERFILE_PATH_${VAR_ID};]$DOCKERFILE_PATH"
18-
19-
EXTRA_BUILD_ARGS=$(make "$MAKE_EXTRA_BUILD_ARGS")
20-
echo >&2 "##vso[task.setvariable variable=EXTRA_BUILD_ARGS_${VAR_ID};]$EXTRA_BUILD_ARGS"
21-
displayName: "Get Image Name"
22-
env:
23-
VAR_ID: ${{ parameters.name }}
24-
MAKE_BUILD_CONTEXT: ${{ parameters.name }}-image-build-context
25-
MAKE_IMG_NAME_AND_TAG: ${{ parameters.name }}-image-name-and-tag
26-
MAKE_DOCKERFILE_PATH: ${{ parameters.name }}-image-dockerfile-path
27-
MAKE_EXTRA_BUILD_ARGS: ${{ parameters.name }}-image-build-args
2824

25+
steps:
2926
- task: 1ES.BuildContainerImage@1
3027
retryCountOnTaskFailure: 3
3128
inputs:
3229
image: $(IMAGE_NAME_AND_TAG_${{ parameters.name }})
3330
dockerfile: $(DOCKERFILE_PATH_${{ parameters.name }})
3431
path: $(BUILD_CONTEXT_${{ parameters.name }})
3532
buildArguments: TARGET=${{ parameters.os }} OS=${{ parameters.os }} PLATFORM=${{ parameters.os }} ARCH=${{ parameters.arch }} $(EXTRA_BUILD_ARGS_${{ parameters.name }})
36-
enableNetwork: true # Optional. Default: false
37-
enablePull: false # Optional. Default: true
38-
enableCache: true # Optional. Default: false
33+
enableNetwork: true
34+
enablePull: false
35+
enableCache: true
3936
useBuildKit: true
4037

4138
- task: 1ES.PushContainerImage@1

.pipelines/run-pipeline.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ stages:
8585
- cns
8686
- ipv6-hp-bpf
8787
- npm
88+
pushAcr: acnpublic
8889
- template: containers/container-template.jobs.yaml
8990
parameters:
9091
arch: arm64
@@ -95,6 +96,7 @@ stages:
9596
- cns
9697
- ipv6-hp-bpf
9798
- npm
99+
pushAcr: acnpublic
98100
- template: containers/container-template.jobs.yaml
99101
parameters:
100102
arch: amd64
@@ -104,6 +106,7 @@ stages:
104106
- cni
105107
- cns
106108
- npm
109+
pushAcr: acnpublic
107110

108111

109112
- stage: publish

.pipelines/trigger.yaml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ resources:
2828
name: 1ESPipelineTemplates/1ESPipelineTemplates
2929
ref: refs/tags/stable
3030

31-
- repository: azure-container-networking
32-
type: github
33-
name: Azure/azure-container-networking
34-
endpoint: 'Azure-ACN RO Service Connection'
35-
ref: refs/heads/feature/ob-onboard-2
36-
3731

3832
variables:
3933
REPO_REF: $[ resources.repositories['azure-container-networking'].ref ]
@@ -52,7 +46,6 @@ extends:
5246
os: linux
5347
image: acn-runner-vmss-image-1es-v3.0
5448
authenticatedContainerRegistries:
55-
- serviceConnection: 'Azure Container Networking - ACN Public Registry - Retina'
5649
- registry: onebranch.azurecr.io
5750
tenant: AME
5851
identity: 1ESPipelineIdentity
@@ -69,4 +62,4 @@ extends:
6962
${{ if startsWith(variables['Build.SourceBranch'], 'refs/pull/') }}:
7063
enabledOnNonDefaultBranches: true
7164
stages:
72-
- template: /.pipelines/run-pipeline.yaml@azure-container-networking
65+
- template: /.pipelines/run-pipeline.yaml

0 commit comments

Comments
 (0)