diff --git a/.pipelines/containers/container-template.steps.yaml b/.pipelines/containers/container-template.steps.yaml index 2378ac7cb..df65cbf85 100644 --- a/.pipelines/containers/container-template.steps.yaml +++ b/.pipelines/containers/container-template.steps.yaml @@ -7,6 +7,9 @@ steps: - bash: | set -e + BUILD_CONTEXT=$(make "$MAKE_BUILD_CONTEXT") + echo >&2 "##vso[task.setvariable variable=BUILD_CONTEXT_${VAR_ID};]$BUILD_CONTEXT" + IMAGE_NAME_AND_TAG=$(make "$MAKE_IMG_NAME_AND_TAG") echo >&2 "##vso[task.setvariable variable=IMAGE_NAME_AND_TAG_${VAR_ID};]$IMAGE_NAME_AND_TAG" @@ -18,6 +21,7 @@ steps: displayName: "Get Image Name" env: VAR_ID: ${{ parameters.name }} + MAKE_BUILD_CONTEXT: ${{ parameters.name }}-image-build-context MAKE_IMG_NAME_AND_TAG: ${{ parameters.name }}-image-name-and-tag MAKE_DOCKERFILE_PATH: ${{ parameters.name }}-image-dockerfile-path MAKE_EXTRA_BUILD_ARGS: ${{ parameters.name }}-image-build-args @@ -27,6 +31,7 @@ steps: inputs: image: $(IMAGE_NAME_AND_TAG_${{ parameters.name }}) dockerfile: $(DOCKERFILE_PATH_${{ parameters.name }}) + path: $(BUILD_CONTEXT_${{ parameters.name }}) buildArguments: TARGET=${{ parameters.os }} OS=${{ parameters.os }} PLATFORM=${{ parameters.os }} ARCH=${{ parameters.arch }} $(EXTRA_BUILD_ARGS_${{ parameters.name }}) enableNetwork: true # Optional. Default: false enablePull: false # Optional. Default: true diff --git a/Makefile b/Makefile index 5b4fcf141..d9088a7cc 100644 --- a/Makefile +++ b/Makefile @@ -337,6 +337,10 @@ acncli-image-name: # util target to print the CNI manager image name. acncli-image-name-and-tag: # util target to print the CNI manager image name and tag. @echo $(IMAGE_REGISTRY)/$(ACNCLI_IMAGE):$(ACNCLI_PLATFORM_TAG) +acncli-image-build-context: + $(eval BUILD_CONTEXT := $(REPO_ROOT)) + @echo "$(BUILD_CONTEXT)" + acncli-dockerfile-path: $(eval DOCKERFILE_PATH := $(ACNCLI_DIR)/Dockerfile) @echo "$(DOCKERFILE_PATH)" @@ -371,6 +375,10 @@ azure-ipam-image-name: # util target to print the azure-ipam image name. azure-ipam-image-name-and-tag: # util target to print the azure-ipam image name and tag. @echo $(IMAGE_REGISTRY)/$(AZURE_IPAM_IMAGE):$(AZURE_IPAM_PLATFORM_TAG) +azure-ipam-image-build-context: + $(eval BUILD_CONTEXT := $(REPO_ROOT)) + @echo "$(BUILD_CONTEXT)" + azure-ipam-dockerfile-path: $(eval DOCKERFILE_PATH := $(AZURE_IPAM_DIR)/Dockerfile) @echo "$(DOCKERFILE_PATH)" @@ -408,6 +416,10 @@ ipv6-hp-bpf-image-name: # util target to print the ipv6-hp-bpf image name. ipv6-hp-bpf-image-name-and-tag: # util target to print the ipv6-hp-bpf image name and tag. @echo $(IMAGE_REGISTRY)/$(IPV6_HP_BPF_IMAGE):$(IPV6_HP_BPF_IMAGE_PLATFORM_TAG) +ipv6-hp-bpf-image-build-context: + $(eval BUILD_CONTEXT := $(REPO_ROOT)) + @echo "$(BUILD_CONTEXT)" + ipv6-hp-bpf-dockerfile-path: $(eval DOCKERFILE_PATH := $(IPV6_HP_BPF_DIR)/$(OS).Dockerfile) @echo "$(DOCKERFILE_PATH)" @@ -445,6 +457,10 @@ cni-image-name: # util target to print the cni image name. cni-image-name-and-tag: # util target to print the cni image name and tag. @echo $(IMAGE_REGISTRY)/$(CNI_IMAGE):$(CNI_PLATFORM_TAG) +cni-image-build-context: + $(eval BUILD_CONTEXT := $(REPO_ROOT)) + @echo "$(BUILD_CONTEXT)" + cni-image-dockerfile-path: $(eval DOCKERFILE_PATH := $(CNI_BUILD_DIR)/Dockerfile) @echo "$(DOCKERFILE_PATH)" @@ -483,6 +499,10 @@ cns-image-name: # util target to print the CNS image name cns-image-name-and-tag: # util target to print the CNS image name and tag. @echo $(IMAGE_REGISTRY)/$(CNS_IMAGE):$(CNS_PLATFORM_TAG) +cns-image-build-context: + $(eval BUILD_CONTEXT := $(REPO_ROOT)) + @echo "$(BUILD_CONTEXT)" + cns-image-dockerfile-path: $(eval DOCKERFILE_PATH := $(CNS_BUILD_DIR)/Dockerfile) @echo "$(DOCKERFILE_PATH)" @@ -520,6 +540,10 @@ npm-image-name: # util target to print the NPM image name npm-image-name-and-tag: # util target to print the NPM image name and tag. @echo $(IMAGE_REGISTRY)/$(NPM_IMAGE):$(NPM_PLATFORM_TAG) +npm-image-build-context: + $(eval BUILD_CONTEXT := $(REPO_ROOT)) + @echo "$(BUILD_CONTEXT)" + npm-image-dockerfile-path: $(eval DOCKERFILE_PATH := $(NPM_BUILD_DIR)/$(OS).Dockerfile) @echo "$(DOCKERFILE_PATH)"