Skip to content

Commit 22c2d68

Browse files
mauriciopoppetonyzhc
authored andcommitted
Pin buildx builder image to v0.16.0
1 parent 18af03a commit 22c2d68

File tree

5 files changed

+29
-9
lines changed

5 files changed

+29
-9
lines changed

Dockerfile.Windows

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ WORKDIR /code
2121
ADD . /code/
2222
RUN cd /code/ && GOARCH=$(echo $TARGETPLATFORM | cut -f2 -d '/') GCE_PD_CSI_STAGING_VERSION=${STAGINGVERSION} make gce-pd-driver-windows
2323

24-
FROM --platform=$TARGETPLATFORM ${BASE_IMAGE}
24+
FROM ${BASE_IMAGE}
2525
LABEL description="PD CSI driver"
2626
COPY --from=builder /code/bin/gce-pd-csi-driver.exe /gce-pd-csi-driver.exe
2727

Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ DRIVERWINDOWSBINARY=${DRIVERBINARY}.exe
2323

2424
DOCKER=DOCKER_CLI_EXPERIMENTAL=enabled docker
2525

26-
BASE_IMAGE_LTSC2019=mcr.microsoft.com/windows/servercore:ltsc2022
26+
BASE_IMAGE_LTSC2019=mcr.microsoft.com/windows/servercore:ltsc2019
2727

2828
# Both arrays MUST be index aligned.
29-
WINDOWS_IMAGE_TAGS=ltsc2022
29+
WINDOWS_IMAGE_TAGS=ltsc2019
3030
WINDOWS_BASE_IMAGES=$(BASE_IMAGE_LTSC2019)
3131

3232
GCFLAGS=""
@@ -61,12 +61,14 @@ build-and-push-windows-container-ltsc2019: require-GCE_PD_CSI_STAGING_IMAGE init
6161
--build-arg STAGINGVERSION=$(STAGINGVERSION) --push --provenance=false .
6262

6363
build-and-push-multi-arch: build-and-push-container-linux-amd64 build-and-push-container-linux-arm64 build-and-push-windows-container-ltsc2019
64-
$(DOCKER) manifest create --amend $(STAGINGIMAGE):$(STAGINGVERSION) $(STAGINGIMAGE):$(STAGINGVERSION)_linux_amd64 $(STAGINGIMAGE):$(STAGINGVERSION)_linux_arm64 $(STAGINGIMAGE):$(STAGINGVERSION)_ltsc2019
64+
$(DOCKER) manifest create $(STAGINGIMAGE):$(STAGINGVERSION) $(STAGINGIMAGE):$(STAGINGVERSION)_linux_amd64 $(STAGINGIMAGE):$(STAGINGVERSION)_linux_arm64 $(STAGINGIMAGE):$(STAGINGVERSION)_ltsc2019
65+
# $(DOCKER) manifest annotate --os linux --arch arm64 $(STAGINGIMAGE):$(STAGINGVERSION) $(STAGINGIMAGE):$(STAGINGVERSION)_linux_arm64
6566
STAGINGIMAGE="$(STAGINGIMAGE)" STAGINGVERSION="$(STAGINGVERSION)" WINDOWS_IMAGE_TAGS="$(WINDOWS_IMAGE_TAGS)" WINDOWS_BASE_IMAGES="$(WINDOWS_BASE_IMAGES)" ./manifest_osversion.sh
6667
$(DOCKER) manifest push -p $(STAGINGIMAGE):$(STAGINGVERSION)
6768
$(DOCKER) manifest inspect $(STAGINGIMAGE):$(STAGINGVERSION)
6869

6970
build-and-push-multi-arch-debug: build-and-push-container-linux-debug build-and-push-windows-container-ltsc2019
71+
# TODO: make this command the same as the above
7072
$(DOCKER) manifest create --amend $(STAGINGIMAGE):$(STAGINGVERSION) $(STAGINGIMAGE):$(STAGINGVERSION)_linux $(STAGINGIMAGE):$(STAGINGVERSION)_ltsc2019
7173
STAGINGIMAGE="$(STAGINGIMAGE)" STAGINGVERSION="$(STAGINGVERSION)" WINDOWS_IMAGE_TAGS="ltsc2019" WINDOWS_BASE_IMAGES="$(BASE_IMAGE_LTSC2019)" ./manifest_osversion.sh
7274
$(DOCKER) manifest push -p $(STAGINGIMAGE):$(STAGINGVERSION)
@@ -131,7 +133,7 @@ init-buildx:
131133
$(DOCKER) run --rm --privileged multiarch/qemu-user-static --reset --credential yes --persistent yes
132134
# Ensure we use a builder that can leverage it (the default on linux will not)
133135
-$(DOCKER) buildx rm multiarch-multiplatform-builder
134-
$(DOCKER) buildx create --use --name=multiarch-multiplatform-builder --driver-opt network=host --driver-opt image=moby/buildkit:v0.14.1
136+
$(DOCKER) buildx create --use --name=multiarch-multiplatform-builder --driver-opt network=host --driver-opt image=moby/buildkit:v0.16.0
135137
# Register gcloud as a Docker credential helper.
136138
# Required for "docker buildx build --push".
137139
gcloud auth configure-docker --quiet

manifest_osversion.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@ for ((i=0;i<${#imagetags[@]};++i)); do
2525
BASEIMAGE="${baseimages[i]}"
2626
echo $BASEIIMAGE
2727

28-
full_version=$(docker manifest inspect ${BASEIMAGE} | grep "os.version" | head -n 1 | awk '{print $2}') || true
28+
full_version=$(docker manifest inspect ${BASEIMAGE} | grep "os.version" | head -n 1 | awk '{print $2}' | sed 's/^\"//' | sed 's/\",$//') || true
2929
echo $full_version
3030

3131
IMAGETAG=${STAGINGIMAGE}:${STAGINGVERSION}_${imagetags[i]}
3232
image_folder=$(echo "${IMAGETAG}" | sed "s|/|_|g" | sed "s/:/-/")
3333
echo ${manifest_folder}
3434

35+
docker manifest annotate --os windows --arch amd64 --os-version ${full_version} ${STAGINGIMAGE}:${STAGINGVERSION} ${IMAGETAG}
3536
# sed -i -r "s/(\"os\"\:\"windows\")/\0,\"os.version\":$full_version/" \
3637
# "${HOME}/.docker/manifests/${manifest_folder}/${image_folder}"
3738

test/k8s-integration/cluster.go

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,27 @@ func clusterDownGKE(gceZone, gceRegion string) error {
5959
return nil
6060
}
6161

62+
const hardcodeBuildChange = `/template:/,/spec:/s/spec:$/spec:\n\ \ \ \ \ \ nodeSelector:\n\ \ \ \ \ \ \ \ kubernetes.io\/os: linux/`
63+
6264
func buildKubernetes(k8sDir, command string) error {
63-
cmd := exec.Command("make", "-C", k8sDir, command)
65+
// TODO: REMOVE THESE HARDCODED LINES
66+
cmd := exec.Command("sed", "-i", hardcodeBuildChange, fmt.Sprintf("%s/cluster/addons/node-problem-detector/npd.yaml", k8sDir))
67+
cmd.Env = os.Environ()
68+
err := runCommand(fmt.Sprintf("Make hardcoded change in path=%s", k8sDir), cmd)
69+
if err != nil {
70+
return fmt.Errorf("failed to make hardcoded changes before building Kubernetes: %w", err)
71+
}
72+
73+
cmd = exec.Command("cat", fmt.Sprintf("%s/cluster/addons/node-problem-detector/npd.yaml", k8sDir))
74+
cmd.Env = os.Environ()
75+
err = runCommand(fmt.Sprintf("Check hardcoded change in path=%s", k8sDir), cmd)
76+
if err != nil {
77+
return fmt.Errorf("failed to check hardcoded changes before building Kubernetes: %w", err)
78+
}
79+
80+
cmd = exec.Command("make", "-C", k8sDir, command)
6481
cmd.Env = os.Environ()
65-
err := runCommand(fmt.Sprintf("Running command in kubernetes/kubernetes path=%s", k8sDir), cmd)
82+
err = runCommand(fmt.Sprintf("Running command in kubernetes/kubernetes path=%s", k8sDir), cmd)
6683
if err != nil {
6784
return fmt.Errorf("failed to build Kubernetes: %w", err)
6885
}

test/run-windows-k8s-integration.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export KUBE_BUILD_PLATFORMS=${KUBE_BUILD_PLATFORMS:-"linux/amd64 windows/amd64"}
2828
make -C "${PKGDIR}" test-k8s-integration
2929

3030
if [ "$use_kubetest2" = true ]; then
31-
kt2_version=0e09086b60c122e1084edd2368d3d27fe36f384f
31+
kt2_version=22d5b1410bef09ae679fa5813a5f0d196b6079de
3232
go install sigs.k8s.io/kubetest2@${kt2_version}
3333
go install sigs.k8s.io/kubetest2/kubetest2-gce@${kt2_version}
3434
go install sigs.k8s.io/kubetest2/kubetest2-gke@${kt2_version}

0 commit comments

Comments
 (0)