Skip to content

Commit 7002b34

Browse files
jpayne3506rbtrhuntergregoryvakalapa
authored
ci: [backport] Image related CI/CD (#2814)
* ci: Change ACR Service Connection (#2727) * fix: pin Windows images (#2742) Signed-off-by: Evan Baker <[email protected]> * ci: [WIN-NPM] remove ws19 build (#1844) * remove NPM build for ws19 * set OS versions by variable in manifest-build --------- Co-authored-by: Vamsi Kalapala <[email protected]> --------- Signed-off-by: Evan Baker <[email protected]> Co-authored-by: Evan Baker <[email protected]> Co-authored-by: Hunter Gregory <[email protected]> Co-authored-by: Vamsi Kalapala <[email protected]>
1 parent 7a82718 commit 7002b34

7 files changed

+63
-49
lines changed

.pipelines/cni/cilium/nightly-release-test.yml

+13-8
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ stages:
1616
make docker-operator-generic-image
1717
name: BuildCiliumImage
1818
displayName: "Build Cilium Image"
19-
- task: Docker@2
20-
displayName: Login
19+
- task: AzureCLI@1
20+
displayName: "Login"
2121
inputs:
22-
containerRegistry: $(CONTAINER_REGISTRY)
23-
command: "login"
22+
azureSubscription: $(ACR_ARM_SERVICE_CONNECTION)
23+
scriptLocation: "inlineScript"
24+
inlineScript: |
25+
az acr login -n $(ACR)
2426
- task: AzureCLI@1
2527
inputs:
2628
azureSubscription: $(TEST_SUB_SERVICE_CONNECTION)
@@ -33,11 +35,14 @@ stages:
3335
docker push $(ACR).azurecr.io/cilium/operator-generic:$(DOCKER_IMAGE_TAG)
3436
name: "PushCiliumImage"
3537
displayName: "Push Cilium Image"
36-
- task: Docker@2
37-
displayName: Logout
38+
- task: AzureCLI@1
39+
displayName: "Logout"
3840
inputs:
39-
containerRegistry: $(CONTAINER_REGISTRY)
40-
command: "logout"
41+
azureSubscription: $(ACR_ARM_SERVICE_CONNECTION)
42+
scriptLocation: "inlineScript"
43+
inlineScript: |
44+
docker logout
45+
4146
- stage: cilium_nightly
4247
displayName: E2E - Cilium Nightly
4348
variables:

.pipelines/containers/container-template.yaml

+12-10
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ parameters:
55
os_version: ""
66

77
steps:
8-
- task: Docker@2
9-
displayName: Login
8+
- task: AzureCLI@1
9+
displayName: "Login"
1010
inputs:
11-
containerRegistry: $(ACR_SERVICE_CONNECTION)
12-
command: 'login'
13-
addPipelineData: false
11+
azureSubscription: $(ACR_ARM_SERVICE_CONNECTION)
12+
scriptLocation: "inlineScript"
13+
inlineScript: |
14+
az acr login -n $(ACR)
1415
1516
- script: |
1617
set -e
@@ -20,9 +21,10 @@ steps:
2021
displayName: Image Build
2122
retryCountOnTaskFailure: 3
2223

23-
- task: Docker@2
24-
displayName: Logout
24+
- task: AzureCLI@1
25+
displayName: "Logout"
2526
inputs:
26-
containerRegistry: $(ACR_SERVICE_CONNECTION)
27-
command: 'logout'
28-
addPipelineData: false
27+
azureSubscription: $(ACR_ARM_SERVICE_CONNECTION)
28+
scriptLocation: "inlineScript"
29+
inlineScript: |
30+
docker logout

.pipelines/containers/manifest-template.yaml

+13-10
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ parameters:
44
os_versions: ""
55

66
steps:
7-
- task: Docker@2
8-
displayName: Login
7+
8+
- task: AzureCLI@1
9+
displayName: "Login"
910
inputs:
10-
containerRegistry: $(ACR_SERVICE_CONNECTION)
11-
command: "login"
12-
addPipelineData: false
11+
azureSubscription: $(ACR_ARM_SERVICE_CONNECTION)
12+
scriptLocation: "inlineScript"
13+
inlineScript: |
14+
az acr login -n $(ACR)
1315
1416
- script: |
1517
set -e
@@ -34,12 +36,13 @@ steps:
3436
displayName: Manifest Push
3537
retryCountOnTaskFailure: 3
3638
37-
- task: Docker@2
38-
displayName: Logout
39+
- task: AzureCLI@1
40+
displayName: "Logout"
3941
inputs:
40-
containerRegistry: $(ACR_SERVICE_CONNECTION)
41-
command: "logout"
42-
addPipelineData: false
42+
azureSubscription: $(ACR_ARM_SERVICE_CONNECTION)
43+
scriptLocation: "inlineScript"
44+
inlineScript: |
45+
docker logout
4346
4447
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
4548
displayName: "Add SBOM Generator tool"

.pipelines/pipeline.yaml

+1-6
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,6 @@ stages:
179179
arch: amd64
180180
name: npm
181181
os: linux
182-
npm_windows2019_amd64:
183-
arch: amd64
184-
name: npm
185-
os: windows
186-
os_version: ltsc2019
187182
npm_windows2022_amd64:
188183
arch: amd64
189184
name: npm
@@ -285,7 +280,7 @@ stages:
285280
platforms: linux/amd64 linux/arm64 windows/amd64
286281
npm:
287282
name: npm
288-
os_versions: ltsc2019 ltsc2022
283+
os_versions: ltsc2022
289284
platforms: linux/amd64 linux/arm64 windows/amd64
290285
steps:
291286
- template: containers/manifest-template.yaml

Makefile

+13-13
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ azure-ipam: azure-ipam-binary azure-ipam-archive
140140

141141
revision: ## print the current git revision
142142
@echo $(REVISION)
143-
143+
144144
version: ## prints the root version
145145
@echo $(ACN_VERSION)
146146

@@ -159,15 +159,15 @@ cni-dropgz-test-version: ## prints the cni-dropgz version
159159
@echo $(CNI_DROPGZ_TEST_VERSION)
160160

161161
cns-version:
162-
@echo $(CNS_VERSION)
162+
@echo $(CNS_VERSION)
163163

164164
npm-version:
165-
@echo $(NPM_VERSION)
165+
@echo $(NPM_VERSION)
166166

167167
zapai-version: ## prints the zapai version
168168
@echo $(ZAPAI_VERSION)
169169

170-
##@ Binaries
170+
##@ Binaries
171171

172172
# Build the delegated IPAM plugin binary.
173173
azure-ipam-binary:
@@ -507,8 +507,8 @@ manifest-build: # util target to compose multiarch container manifests from plat
507507
$(MAKE) manifest-add PLATFORM=$(PLATFORM);\
508508
)\
509509
)\
510-
511-
510+
511+
512512

513513
manifest-push: # util target to push multiarch container manifest.
514514
$(CONTAINER_BUILDER) manifest push --all $(IMAGE_REGISTRY)/$(IMAGE):$(TAG) docker://$(IMAGE_REGISTRY)/$(IMAGE):$(TAG)
@@ -532,7 +532,7 @@ acncli-manifest-push: ## push acncli multiplat container manifest
532532
acncli-skopeo-archive: ## export tar archive of acncli multiplat container manifest.
533533
$(MAKE) manifest-skopeo-archive \
534534
IMAGE=$(ACNCLI_IMAGE) \
535-
TAG=$(ACN_VERSION)
535+
TAG=$(ACN_VERSION)
536536

537537
cni-dropgz-manifest-build: ## build cni-dropgz multiplat container manifest.
538538
$(MAKE) manifest-build \
@@ -684,7 +684,7 @@ ifeq ($(GOOS),linux)
684684
endif
685685

686686

687-
##@ Utils
687+
##@ Utils
688688

689689
clean: ## Clean build artifacts.
690690
$(RMDIR) $(OUTPUT_DIR)
@@ -715,7 +715,7 @@ workspace: ## Set up the Go workspace.
715715
go work use ./dropgz
716716
go work use ./zapai
717717

718-
##@ Test
718+
##@ Test
719719

720720
COVER_PKG ?= .
721721
#Restart case is used for cni load test pipeline for restarting the nodes cluster.
@@ -773,7 +773,7 @@ gitconfig: ## configure the local git repository
773773
setup: tools install-hooks gitconfig ## performs common required repo setup
774774

775775

776-
##@ Tools
776+
##@ Tools
777777

778778
$(TOOLS_DIR)/go.mod:
779779
cd $(TOOLS_DIR); go mod init && go mod tidy
@@ -783,7 +783,7 @@ $(CONTROLLER_GEN): $(TOOLS_DIR)/go.mod
783783

784784
controller-gen: $(CONTROLLER_GEN) ## Build controller-gen
785785

786-
protoc:
786+
protoc:
787787
source ${REPO_ROOT}/scripts/install-protoc.sh
788788

789789
$(GOCOV): $(TOOLS_DIR)/go.mod
@@ -816,13 +816,13 @@ $(MOCKGEN): $(TOOLS_DIR)/go.mod
816816

817817
mockgen: $(MOCKGEN) ## Build mockgen
818818

819-
clean-tools:
819+
clean-tools:
820820
rm -r build/tools/bin
821821

822822
tools: acncli gocov gocov-xml go-junit-report golangci-lint gofumpt protoc ## Build bins for build tools
823823

824824

825-
##@ Help
825+
##@ Help
826826

827827
help: ## Display this help
828828
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

cns/windows.Dockerfile

+7-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ WORKDIR /usr/local/src
77
COPY . .
88
RUN GOOS=windows CGO_ENABLED=0 go build -a -o /usr/local/bin/azure-cns.exe -ldflags "-X main.version="$VERSION" -X "$CNS_AI_PATH"="$CNS_AI_ID"" -gcflags="-dwarflocationlists=true" cns/service/*.go
99

10-
FROM mcr.microsoft.com/windows/servercore:${OS_VERSION}
10+
# intermediate for win-ltsc2019
11+
FROM mcr.microsoft.com/windows/servercore@sha256:6fdf140282a2f809dae9b13fe441635867f0a27c33a438771673b8da8f3348a4 as ltsc2019
12+
13+
# intermediate for win-ltsc2022
14+
FROM mcr.microsoft.com/windows/servercore@sha256:45952938708fbde6ec0b5b94de68bcdec3f8c838be018536b1e9e5bd95e6b943 as ltsc2022
15+
16+
FROM ${OS_VERSION}
1117
COPY --from=builder /usr/local/src/cns/kubeconfigtemplate.yaml kubeconfigtemplate.yaml
1218
COPY --from=builder /usr/local/src/npm/examples/windows/setkubeconfigpath.ps1 setkubeconfigpath.ps1
1319
COPY --from=builder /usr/local/bin/azure-cns.exe azure-cns.exe

npm/windows.Dockerfile

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ WORKDIR /usr/local/src
77
COPY . .
88
RUN GOOS=windows CGO_ENABLED=0 go build -v -o /usr/local/bin/azure-npm.exe -ldflags "-X main.version="$VERSION" -X "$NPM_AI_PATH"="$NPM_AI_ID"" -gcflags="-dwarflocationlists=true" npm/cmd/*.go
99

10-
FROM mcr.microsoft.com/windows/servercore:${OS_VERSION}
10+
# intermediate for win-ltsc2022
11+
FROM mcr.microsoft.com/windows/servercore@sha256:45952938708fbde6ec0b5b94de68bcdec3f8c838be018536b1e9e5bd95e6b943 as ltsc2022
12+
13+
FROM ${OS_VERSION}
1114
COPY --from=builder /usr/local/src/npm/examples/windows/kubeconfigtemplate.yaml kubeconfigtemplate.yaml
1215
COPY --from=builder /usr/local/src/npm/examples/windows/setkubeconfigpath.ps1 setkubeconfigpath.ps1
1316
COPY --from=builder /usr/local/bin/azure-npm.exe azure-npm.exe

0 commit comments

Comments
 (0)