Skip to content

Commit

Permalink
Infer GOOS and GOARCH from environment (#550)
Browse files Browse the repository at this point in the history
* Infer GOOS and GOARCH from environment

Signed-off-by: Jeev B <[email protected]>

* Multiarch builds for flytescheduler

Signed-off-by: Jeev B <[email protected]>

* fix makefile to read variables from environment and overrides

Signed-off-by: Jeev B <[email protected]>

---------

Signed-off-by: Jeev B <[email protected]>
  • Loading branch information
jeevb authored Apr 12, 2023
1 parent eb695b1 commit 97a6aa4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
1 change: 0 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ jobs:
FLYTE_BOT_PAT: ${{ secrets.FLYTE_BOT_PAT }}
FLYTE_BOT_USERNAME: ${{ secrets.FLYTE_BOT_USERNAME }}


push-docker-image-flytescheduler:
name: Build & Push Flytescheduler Image
needs: [ bump_version ]
Expand Down
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ docker_build_scheduler:
docker build -t $$FLYTE_SCHEDULER_REPOSITORY:$(GIT_HASH) -f Dockerfile.scheduler .

.PHONY: integration
integration: export CGO_ENABLED ?= 0
integration: export GOFLAGS ?= -count=1
integration:
CGO_ENABLED=0 GOFLAGS="-count=1" go test -v -tags=integration ./tests/...
go test -v -tags=integration ./tests/...

.PHONY: k8s_integration
k8s_integration:
Expand Down Expand Up @@ -51,12 +53,16 @@ compile_scheduler_debug:


.PHONY: linux_compile
linux_compile: export CGO_ENABLED ?= 0
linux_compile: export GOOS ?= linux
linux_compile:
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o /artifacts/flyteadmin -ldflags=$(LD_FLAGS) ./cmd/
go build -o /artifacts/flyteadmin -ldflags=$(LD_FLAGS) ./cmd/

.PHONY: linux_compile_scheduler
linux_compile_scheduler: export CGO_ENABLED ?= 0
linux_compile_scheduler: export GOOS ?= linux
linux_compile_scheduler:
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o /artifacts/flytescheduler -ldflags=$(LD_FLAGS) ./cmd/scheduler/
go build -o /artifacts/flytescheduler -ldflags=$(LD_FLAGS) ./cmd/scheduler/


.PHONY: server
Expand All @@ -77,4 +83,3 @@ seed_projects:
go run cmd/main.go migrate seed-projects project admintests flytekit --server.kube-config ~/.kube/config --config flyteadmin_config.yaml

all: compile

7 changes: 6 additions & 1 deletion scheduler.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
#
# TO OPT OUT OF UPDATES, SEE https://github.com/lyft/boilerplate/blob/master/Readme.rst

FROM golang:1.18-alpine3.15 as builder
FROM --platform=${BUILDPLATFORM} golang:1.18-alpine3.15 as builder

ARG TARGETARCH
ENV GOARCH "${TARGETARCH}"
ENV GOOS linux

RUN apk add git openssh-client make curl

# COPY only the go mod files for efficient caching
Expand Down

0 comments on commit 97a6aa4

Please sign in to comment.