Skip to content

Commit

Permalink
skip arm build in Prow e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
songjiaxun committed Sep 20, 2023
1 parent 52cbf96 commit 3898265
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 10 deletions.
26 changes: 19 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export REGISTRY ?= jiaxun
export STAGINGVERSION ?= $(shell git describe --long --tags --match='v*' --dirty 2>/dev/null || git rev-list -n1 HEAD)
export OVERLAY ?= stable
export BUILD_GCSFUSE_FROM_SOURCE ?= false
export BUILD_ARM ?= false
BINDIR ?= $(shell pwd)/bin
GCSFUSE_PATH ?= $(shell cat cmd/sidecar_mounter/gcsfuse_binary)
LDFLAGS ?= -s -w -X main.version=${STAGINGVERSION} -extldflags '-static'
Expand Down Expand Up @@ -78,7 +79,8 @@ ifeq (${BUILD_GCSFUSE_FROM_SOURCE}, true)
-v ${BINDIR}/linux/amd64:/release \
gcsfuse-release:${GCSFUSE_VERSION}-amd \
cp /gcsfuse_${GCSFUSE_VERSION}_amd64/usr/bin/gcsfuse /release


ifeq (${BUILD_ARM}, true)
docker buildx build \
--load \
--file ${BINDIR}/Dockerfile.gcsfuse \
Expand All @@ -93,16 +95,20 @@ ifeq (${BUILD_GCSFUSE_FROM_SOURCE}, true)
-v ${BINDIR}/linux/arm64:/release \
gcsfuse-release:${GCSFUSE_VERSION}-arm \
cp /gcsfuse_${GCSFUSE_VERSION}_arm64/usr/bin/gcsfuse /release
endif

else
gsutil cp ${GCSFUSE_PATH}/linux/amd64/gcsfuse ${BINDIR}/linux/amd64/gcsfuse
gsutil cp ${GCSFUSE_PATH}/linux/arm64/gcsfuse ${BINDIR}/linux/arm64/gcsfuse
endif

chmod +x ${BINDIR}/linux/amd64/gcsfuse
chmod +x ${BINDIR}/linux/arm64/gcsfuse

chmod 0555 ${BINDIR}/linux/amd64/gcsfuse

ifeq (${BUILD_ARM}, true)
chmod +x ${BINDIR}/linux/arm64/gcsfuse
chmod 0555 ${BINDIR}/linux/arm64/gcsfuse
endif

${BINDIR}/linux/$(shell dpkg --print-architecture)/gcsfuse --version

Expand All @@ -115,14 +121,20 @@ init-buildx:
# Required for "docker buildx build --push".
gcloud auth configure-docker --quiet

build-image-and-push-multi-arch: init-buildx download-gcsfuse build-image-linux-amd64 build-image-linux-arm64
build-image-and-push-multi-arch: init-buildx download-gcsfuse build-image-linux-amd64
ifeq (${BUILD_ARM}, true)
make build-image-linux-arm64
docker manifest create ${DRIVER_IMAGE}:${STAGINGVERSION} ${DRIVER_IMAGE}:${STAGINGVERSION}_linux_amd64 ${DRIVER_IMAGE}:${STAGINGVERSION}_linux_arm64
docker manifest push --purge ${DRIVER_IMAGE}:${STAGINGVERSION}

docker manifest create ${SIDECAR_IMAGE}:${STAGINGVERSION} ${SIDECAR_IMAGE}:${STAGINGVERSION}_linux_amd64 ${SIDECAR_IMAGE}:${STAGINGVERSION}_linux_arm64
docker manifest push --purge ${SIDECAR_IMAGE}:${STAGINGVERSION}
else
docker manifest create ${DRIVER_IMAGE}:${STAGINGVERSION} ${DRIVER_IMAGE}:${STAGINGVERSION}_linux_amd64
docker manifest create ${SIDECAR_IMAGE}:${STAGINGVERSION} ${SIDECAR_IMAGE}:${STAGINGVERSION}_linux_amd64
endif

docker manifest create ${WEBHOOK_IMAGE}:${STAGINGVERSION} ${WEBHOOK_IMAGE}:${STAGINGVERSION}_linux_amd64

docker manifest push --purge ${DRIVER_IMAGE}:${STAGINGVERSION}
docker manifest push --purge ${SIDECAR_IMAGE}:${STAGINGVERSION}
docker manifest push --purge ${WEBHOOK_IMAGE}:${STAGINGVERSION}

build-image-linux-amd64:
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ var (
imageRegistry = flag.String("image-registry", "", "name of image to stage to")
buildGcsFuseCsiDriver = flag.Bool("build-gcs-fuse-csi-driver", false, "whether or not to build GCS FUSE CSI Driver images")
buildGcsFuseFromSource = flag.Bool("build-gcs-fuse-from-source", false, "whether or not to build GCS FUSE from source code")
buildArm = flag.Bool("build-arm", false, "whether or not to build the image for Arm nodes")
deployOverlayName = flag.String("deploy-overlay-name", "stable", "which kustomize overlay to deploy the driver with")
useGKEManagedDriver = flag.Bool("use-gke-managed-driver", false, "use GKE managed GCS FUSE CSI driver for the tests")

Expand Down Expand Up @@ -93,6 +94,7 @@ func main() {
DeployOverlayName: *deployOverlayName,
BuildGcsFuseCsiDriver: *buildGcsFuseCsiDriver,
BuildGcsFuseFromSource: *buildGcsFuseFromSource,
BuildArm: *buildArm,
GinkgoFocus: *ginkgoFocus,
GinkgoSkip: *ginkgoSkip,
GinkgoProcs: *ginkgoProcs,
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/utils/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type TestParameters struct {
ImageRegistry string
BuildGcsFuseCsiDriver bool
BuildGcsFuseFromSource bool
BuildArm bool
DeployOverlayName string
UseGKEManagedDriver bool

Expand Down Expand Up @@ -123,7 +124,7 @@ func Handle(testParams *TestParameters) error {
if !testParams.UseGKEManagedDriver {
if testParams.BuildGcsFuseCsiDriver {
klog.Infof("Building GCS FUSE CSI Driver")
if err := buildAndPushImage(testParams.PkgDir, testParams.ImageRegistry, testParams.BuildGcsFuseFromSource); err != nil {
if err := buildAndPushImage(testParams.PkgDir, testParams.ImageRegistry, testParams.BuildGcsFuseFromSource, testParams.BuildArm); err != nil {
return fmt.Errorf("failed pushing GCS FUSE CSI Driver images: %w", err)
}

Expand Down
8 changes: 6 additions & 2 deletions test/e2e/utils/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ import (
"strconv"
)

func buildAndPushImage(pkgDir, registry string, buildGcsFuseFromSource bool) error {
func buildAndPushImage(pkgDir, registry string, buildGcsFuseFromSource, buildArm bool) error {
//nolint:gosec
cmd := exec.Command("make", "-C", pkgDir, "build-image-and-push-multi-arch", fmt.Sprintf("REGISTRY=%s", registry), "BUILD_GCSFUSE_FROM_SOURCE="+strconv.FormatBool(buildGcsFuseFromSource))
cmd := exec.Command("make", "-C", pkgDir,
"build-image-and-push-multi-arch",
"REGISTRY="+registry,
"BUILD_GCSFUSE_FROM_SOURCE="+strconv.FormatBool(buildGcsFuseFromSource),
"BUILD_ARM="+strconv.FormatBool(buildArm))
if err := runCommand("Pushing image to REGISTRY "+registry, cmd); err != nil {
return fmt.Errorf("failed to run push image: %w", err)
}
Expand Down

0 comments on commit 3898265

Please sign in to comment.