Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .pipelines/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ stages:
arch: amd64
os: linux
name: cni-dropgz
cni_dropgz_test_linux_amd64:
arch: amd64
os: linux
name: cni-dropgz-test
cns_linux_amd64:
arch: amd64
os: linux
Expand Down Expand Up @@ -187,6 +191,10 @@ stages:
arch: arm64
os: linux
name: cni-dropgz
cni_dropgz_test_linux_arm64:
arch: arm64
os: linux
name: cni-dropgz-test
cns_linux_arm64:
arch: arm64
os: linux
Expand Down Expand Up @@ -240,6 +248,9 @@ stages:
cni_dropgz:
name: cni-dropgz
platforms: linux/amd64 linux/arm64
cni_dropgz_test:
name: cni-dropgz-test
platforms: linux/amd64 linux/arm64
cns:
name: cns
platforms: linux/amd64 linux/arm64 windows/amd64
Expand Down
48 changes: 48 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ ACN_VERSION ?= $(shell git describe --exclude "azure-ipam*" --exclude "cni-
AZURE_IPAM_VERSION ?= $(notdir $(shell git describe --match "azure-ipam*" --tags --always))
CNI_VERSION ?= $(ACN_VERSION)
CNI_DROPGZ_VERSION ?= $(notdir $(shell git describe --match "cni-dropgz*" --tags --always))
CNI_DROPGZ_TEST_VERSION ?= $(notdir $(shell git describe --match "cni-dropgz-test*" --tags --always))
CNS_VERSION ?= $(ACN_VERSION)
NPM_VERSION ?= $(ACN_VERSION)
ZAPAI_VERSION ?= $(notdir $(shell git describe --match "zapai*" --tags --always))
Expand Down Expand Up @@ -153,6 +154,9 @@ cni-version: ## prints the cni version
cni-dropgz-version: ## prints the cni-dropgz version
@echo $(CNI_DROPGZ_VERSION)

cni-dropgz-test-version: ## prints the cni-dropgz version
@echo $(CNI_DROPGZ_TEST_VERSION)

cns-version:
@echo $(CNS_VERSION)

Expand Down Expand Up @@ -223,12 +227,14 @@ endif
## Image name definitions.
ACNCLI_IMAGE = acncli
CNI_DROPGZ_IMAGE = cni-dropgz
CNI_DROPGZ_TEST_IMAGE = cni-dropgz-test
CNS_IMAGE = azure-cns
NPM_IMAGE = azure-npm

## Image platform tags.
ACNCLI_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(ACN_VERSION)
CNI_DROPGZ_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(CNI_DROPGZ_VERSION)
CNI_DROPGZ_TEST_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(CNI_DROPGZ_TEST_VERSION)
CNS_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(CNS_VERSION)
NPM_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(NPM_VERSION)

Expand Down Expand Up @@ -326,6 +332,32 @@ cni-dropgz-skopeo-export:
$(MAKE) skopeo-export \
REF=$(IMAGE_REGISTRY)/$(CNI_DROPGZ_IMAGE):$(CNI_DROPGZ_PLATFORM_TAG)

# cni-dropgz-test

cni-dropgz-test-image-name: # util target to print the CNI dropgz test image name.
@echo $(CNI_DROPGZ_TEST_IMAGE)

cni-dropgz-test-image: ## build cni-dropgz-test container image.
$(MAKE) container \
DOCKERFILE=dropgz/build/cniTest.Dockerfile \
EXTRA_BUILD_ARGS='--build-arg OS=$(OS)' \
IMAGE=$(CNI_DROPGZ_TEST_IMAGE) \
TAG=$(CNI_DROPGZ_TEST_PLATFORM_TAG)

cni-dropgz-test-image-push: ## push cni-dropgz-test container image.
$(MAKE) container-push \
IMAGE=$(CNI_DROPGZ_TEST_IMAGE) \
TAG=$(CNI_DROPGZ_TEST_PLATFORM_TAG)

cni-dropgz-test-image-pull: ## pull cni-dropgz-test container image.
$(MAKE) container-pull \
IMAGE=$(CNI_DROPGZ_TEST_IMAGE) \
TAG=$(CNI_DROPGZ_TEST_PLATFORM_TAG)

cni-dropgz-test-skopeo-export:
$(MAKE) skopeo-export \
REF=$(IMAGE_REGISTRY)/$(CNI_DROPGZ_TEST_IMAGE):$(CNI_DROPGZ_TEST_PLATFORM_TAG)

# cns

cns-image-name: # util target to print the CNS image name
Expand Down Expand Up @@ -493,6 +525,22 @@ cni-dropgz-skopeo-archive: ## export tar archive of cni-dropgz multiplat contain
IMAGE=$(CNI_DROPGZ_IMAGE) \
TAG=$(CNI_DROPGZ_VERSION)

cni-dropgz-test-manifest-create: ## build cni-dropgz multiplat container manifest.
$(MAKE) manifest-create \
PLATFORMS="$(PLATFORMS)" \
IMAGE=$(CNI_DROPGZ_TEST_IMAGE) \
TAG=$(CNI_DROPGZ_TEST_VERSION)

cni-dropgz-test-manifest-push: ## push cni-dropgz multiplat container manifest
$(MAKE) manifest-push \
IMAGE=$(CNI_DROPGZ_TEST_IMAGE) \
TAG=$(CNI_DROPGZ_TEST_VERSION)

cni-dropgz-test-skopeo-archive: ## export tar archive of cni-dropgz multiplat container manifest.
$(MAKE) manifest-skopeo-archive \
IMAGE=$(CNI_DROPGZ_TEST_IMAGE) \
TAG=$(CNI_DROPGZ_TEST_VERSION)

cns-manifest-create: ## build azure-cns multiplat container manifest.
$(MAKE) manifest-create \
PLATFORMS="$(PLATFORMS)" \
Expand Down
32 changes: 32 additions & 0 deletions dropgz/build/cniTest.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.19 AS azure-ipam
ARG VERSION
WORKDIR /azure-ipam
COPY ./azure-ipam .
RUN CGO_ENABLED=0 go build -a -o bin/azure-ipam -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" .

FROM mcr.microsoft.com/oss/go/microsoft/golang:1.19 AS azure-vnet
ARG VERSION
WORKDIR /azure-container-networking
COPY . .
RUN CGO_ENABLED=0 go build -a -o bin/azure-vnet -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/network/plugin/main.go

FROM mcr.microsoft.com/cbl-mariner/base/core:2.0 AS compressor
ARG OS
WORKDIR /dropgz
COPY dropgz .
COPY --from=azure-ipam /azure-ipam/*.conflist pkg/embed/fs
COPY --from=azure-ipam /azure-ipam/bin/* pkg/embed/fs
COPY --from=azure-vnet /azure-container-networking/cni/azure-$OS-swift.conflist pkg/embed/fs/azure-swift.conflist
COPY --from=azure-vnet /azure-container-networking/bin/* pkg/embed/fs
RUN cd pkg/embed/fs/ && sha256sum * > sum.txt
RUN gzip --verbose --best --recursive pkg/embed/fs && for f in pkg/embed/fs/*.gz; do mv -- "$f" "${f%%.gz}"; done

FROM mcr.microsoft.com/oss/go/microsoft/golang:1.19 AS dropgz
ARG VERSION
WORKDIR /dropgz
COPY --from=compressor /dropgz .
RUN CGO_ENABLED=0 go build -a -o bin/dropgz -trimpath -ldflags "-X github.com/Azure/azure-container-networking/dropgz/internal/buildinfo.Version="$VERSION"" -gcflags="-dwarflocationlists=true" main.go

FROM scratch
COPY --from=dropgz /dropgz/bin/dropgz /dropgz
ENTRYPOINT [ "/dropgz" ]
2 changes: 1 addition & 1 deletion test/integration/manifests/cns/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ spec:
fieldPath: spec.nodeName
initContainers:
- name: init-cni-dropgz
image: acnpublic.azurecr.io/cni-dropgz:v1.4.28-41-g3ecb7fb1
image: acnpublic.azurecr.io/cni-dropgz-test:latest
imagePullPolicy: Always
command: ["/dropgz"]
volumeMounts:
Expand Down