Skip to content

Commit b895437

Browse files
committed
use local proto go packages for ci
Signed-off-by: Humair Khan <[email protected]>
1 parent 94eca21 commit b895437

File tree

7 files changed

+53
-8
lines changed

7 files changed

+53
-8
lines changed

.github/resources/scripts/build-images.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,38 +22,39 @@ REGISTRY="${REGISTRY:-kind-registry:5000}"
2222
echo "REGISTRY=$REGISTRY"
2323
TAG="${TAG:-latest}"
2424
EXIT_CODE=0
25+
BUILD_LOCAL_MODE=true
2526

2627
docker system prune -a -f
2728

28-
docker build --progress=plain -t "${REGISTRY}/apiserver:${TAG}" -f backend/Dockerfile . && docker push "${REGISTRY}/apiserver:${TAG}" || EXIT_CODE=$?
29+
docker build --progress=plain --build-arg LOCAL_MODE=${BUILD_LOCAL_MODE} -t "${REGISTRY}/apiserver:${TAG}" -f backend/Dockerfile . && docker push "${REGISTRY}/apiserver:${TAG}" || EXIT_CODE=$?
2930
if [[ $EXIT_CODE -ne 0 ]]
3031
then
3132
echo "Failed to build apiserver image."
3233
exit $EXIT_CODE
3334
fi
3435

35-
docker build --progress=plain -t "${REGISTRY}/persistenceagent:${TAG}" -f backend/Dockerfile.persistenceagent . && docker push "${REGISTRY}/persistenceagent:${TAG}" || EXIT_CODE=$?
36+
docker build --progress=plain --build-arg LOCAL_MODE=${BUILD_LOCAL_MODE} -t "${REGISTRY}/persistenceagent:${TAG}" -f backend/Dockerfile.persistenceagent . && docker push "${REGISTRY}/persistenceagent:${TAG}" || EXIT_CODE=$?
3637
if [[ $EXIT_CODE -ne 0 ]]
3738
then
3839
echo "Failed to build persistenceagent image."
3940
exit $EXIT_CODE
4041
fi
4142

42-
docker build --progress=plain -t "${REGISTRY}/scheduledworkflow:${TAG}" -f backend/Dockerfile.scheduledworkflow . && docker push "${REGISTRY}/scheduledworkflow:${TAG}" || EXIT_CODE=$?
43+
docker build --progress=plain --build-arg LOCAL_MODE=${BUILD_LOCAL_MODE} -t "${REGISTRY}/scheduledworkflow:${TAG}" -f backend/Dockerfile.scheduledworkflow . && docker push "${REGISTRY}/scheduledworkflow:${TAG}" || EXIT_CODE=$?
4344
if [[ $EXIT_CODE -ne 0 ]]
4445
then
4546
echo "Failed to build scheduledworkflow image."
4647
exit $EXIT_CODE
4748
fi
4849

49-
docker build --progress=plain -t "${REGISTRY}/driver:${TAG}" -f backend/Dockerfile.driver . && docker push "${REGISTRY}/driver:${TAG}" || EXIT_CODE=$?
50+
docker build --progress=plain --build-arg LOCAL_MODE=${BUILD_LOCAL_MODE} -t "${REGISTRY}/driver:${TAG}" -f backend/Dockerfile.driver . && docker push "${REGISTRY}/driver:${TAG}" || EXIT_CODE=$?
5051
if [[ $EXIT_CODE -ne 0 ]]
5152
then
5253
echo "Failed to build driver image."
5354
exit $EXIT_CODE
5455
fi
5556

56-
docker build --progress=plain -t "${REGISTRY}/launcher:${TAG}" -f backend/Dockerfile.launcher . && docker push "${REGISTRY}/launcher:${TAG}" || EXIT_CODE=$?
57+
docker build --progress=plain --build-arg LOCAL_MODE=${BUILD_LOCAL_MODE} -t "${REGISTRY}/launcher:${TAG}" -f backend/Dockerfile.launcher . && docker push "${REGISTRY}/launcher:${TAG}" || EXIT_CODE=$?
5758
if [[ $EXIT_CODE -ne 0 ]]
5859
then
5960
echo "Failed to build launcher image."

backend/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515
# 1. Build api server application
1616
FROM golang:1.22.10-bookworm as builder
17+
18+
ARG LOCAL_MODE=false
19+
1720
RUN apt-get update && apt-get install -y cmake clang musl-dev openssl
1821
WORKDIR /go/src/github.com/kubeflow/pipelines
1922

@@ -23,6 +26,13 @@ COPY ./go.sum ./
2326
RUN GO111MODULE=on go mod download
2427

2528
COPY . .
29+
30+
RUN if [ "$LOCAL_MODE" = "true" ]; then \
31+
echo "DEV MODE ENABVLED" && \
32+
go mod edit -replace github.com/kubeflow/pipelines/kubernetes_platform=./kubernetes_platform && \
33+
go mod edit -replace github.com/kubeflow/pipelines/api=./api && \
34+
go mod tidy; fi
35+
2636
RUN GO111MODULE=on go build -o /bin/apiserver backend/src/apiserver/*.go
2737

2838
# 2. Compile preloaded pipeline samples

backend/Dockerfile.driver

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
FROM golang:1.22.10-alpine3.21 as builder
1616

1717
ARG GCFLAGS=""
18+
ARG LOCAL_MODE=false
1819

1920
WORKDIR /go/src/github.com/kubeflow/pipelines
2021

@@ -25,6 +26,12 @@ RUN GO111MODULE=on go mod download
2526

2627
COPY . .
2728

29+
RUN if [ "$LOCAL_MODE" = "true" ]; then \
30+
echo "DEV MODE ENABVLED" && \
31+
go mod edit -replace github.com/kubeflow/pipelines/kubernetes_platform=./kubernetes_platform && \
32+
go mod edit -replace github.com/kubeflow/pipelines/api=./api && \
33+
go mod tidy; fi
34+
2835
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags netgo -gcflags="${GCFLAGS}" -ldflags '-extldflags "-static"' -o /bin/driver ./backend/src/v2/cmd/driver/*.go
2936

3037
FROM alpine:3.19

backend/Dockerfile.launcher

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
FROM golang:1.22.10-alpine3.21 as builder
1616

17+
ARG LOCAL_MODE=false
18+
1719
WORKDIR /go/src/github.com/kubeflow/pipelines
1820

1921
COPY ./go.mod ./
@@ -23,6 +25,12 @@ RUN GO111MODULE=on go mod download
2325

2426
COPY . .
2527

28+
RUN if [ "$LOCAL_MODE" = "true" ]; then \
29+
echo "DEV MODE ENABVLED" && \
30+
go mod edit -replace github.com/kubeflow/pipelines/kubernetes_platform=./kubernetes_platform && \
31+
go mod edit -replace github.com/kubeflow/pipelines/api=./api && \
32+
go mod tidy; fi
33+
2634
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags netgo -ldflags '-extldflags "-static"' -o /bin/launcher-v2 ./backend/src/v2/cmd/launcher-v2/*.go
2735

2836
FROM alpine:3.19

backend/Dockerfile.persistenceagent

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
FROM golang:1.22.10-alpine3.21 as builder
1616

17+
ARG LOCAL_MODE=false
18+
1719
WORKDIR /go/src/github.com/kubeflow/pipelines
1820

1921
COPY ./go.mod ./
@@ -23,6 +25,12 @@ RUN GO111MODULE=on go mod download
2325

2426
COPY . .
2527

28+
RUN if [ "$LOCAL_MODE" = "true" ]; then \
29+
echo "DEV MODE ENABVLED" && \
30+
go mod edit -replace github.com/kubeflow/pipelines/kubernetes_platform=./kubernetes_platform && \
31+
go mod edit -replace github.com/kubeflow/pipelines/api=./api && \
32+
go mod tidy; fi
33+
2634
# Needed musl-dev for github.com/mattn/go-sqlite3
2735
RUN apk update && apk upgrade && \
2836
apk add --no-cache bash git openssh gcc musl-dev

backend/Dockerfile.scheduledworkflow

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
FROM golang:1.22.10-alpine3.21 as builder
1616

17+
ARG LOCAL_MODE=false
18+
1719
WORKDIR /go/src/github.com/kubeflow/pipelines
1820

1921
COPY ./go.mod ./
@@ -23,6 +25,12 @@ RUN GO111MODULE=on go mod download
2325

2426
COPY . .
2527

28+
RUN if [ "$LOCAL_MODE" = "true" ]; then \
29+
echo "DEV MODE ENABVLED" && \
30+
go mod edit -replace github.com/kubeflow/pipelines/kubernetes_platform=./kubernetes_platform && \
31+
go mod edit -replace github.com/kubeflow/pipelines/api=./api && \
32+
go mod tidy; fi
33+
2634
# Needed musl-dev for github.com/mattn/go-sqlite3
2735
RUN apk update && apk upgrade && \
2836
apk add --no-cache bash git openssh gcc musl-dev

test/presubmit-backend-test.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@ set -ex
2020
# Add installed go binaries to PATH.
2121
export PATH="${PATH}:$(go env GOPATH)/bin"
2222

23-
# 1. Check go modules are tidy
23+
# 1. Reference local proto packages
24+
go mod edit -replace github.com/kubeflow/pipelines/kubernetes_platform=./kubernetes_platform
25+
go mod edit -replace github.com/kubeflow/pipelines/api=./api
26+
27+
# 2. Check go modules are tidy
2428
# Reference: https://github.com/golang/go/issues/27005#issuecomment-564892876
2529
go mod download
2630
go mod tidy
27-
git diff --exit-code -- go.mod go.sum || (echo "go modules are not tidy, run 'go mod tidy'." && exit 1)
2831

29-
# 2. Run tests in the backend directory
32+
# 1. Run tests in the backend directory
3033
go test -v -cover ./backend/...

0 commit comments

Comments
 (0)