Skip to content

Commit bf28ef1

Browse files
authored
fix(dashboard): centraldashboard-angular build with common-lib fetch (#92)
The migration from `kubeflow/kubeflow` to `kubeflow/dashboard` resulted in a broken build process for `centraldashboard-angular` application. This PR provides the following functionality to allow local builds and docker builds to return successfully: - `COMMON_LIB_COMMIT` file to designate a deterministic mechanism to referencing `kubeflow/kubeflow` `kubeflow-common-lib` dependency - new helper methods in `Makefile` to fetch and build `kubeflow-common-lib` - reworked `Dockerfile` to only pass `.` as context - all required files now exist in the `components/centraldashboard-angular` directory - default logic for `kubeflowversion` `Dockerfile` `ARG` - no tags exist on `kubeflow/dashboard` which breaks existing logic! - fixed typo `git verions` on docker label Signed-off-by: Andy Stoneberg <[email protected]>
1 parent 5f2b653 commit bf28ef1

File tree

5 files changed

+37
-12
lines changed

5 files changed

+37
-12
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# dependencies
2+
/kubeflow-common-lib

components/centraldashboard-angular/Dockerfile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# --- Build the backend ---
22
FROM node:16.20.2-bullseye as backend
33

4-
COPY ./centraldashboard-angular/backend/ ./src
4+
COPY ./backend/ ./src
55
WORKDIR /src
66

77
RUN npm ci && \
@@ -14,22 +14,22 @@ FROM node:16.20.2-bullseye as frontend-kubeflow-lib
1414
WORKDIR /src
1515

1616
ENV NG_CLI_ANALYTICS "ci"
17-
COPY ./crud-web-apps/common/frontend/kubeflow-common-lib/package.json ./
18-
COPY ./crud-web-apps/common/frontend/kubeflow-common-lib/package-lock.json ./
17+
COPY ./kubeflow-common-lib/package.json ./
18+
COPY ./kubeflow-common-lib/package-lock.json ./
1919
RUN npm ci
2020

21-
COPY ./crud-web-apps/common/frontend/kubeflow-common-lib/projects ./projects
22-
COPY ./crud-web-apps/common/frontend/kubeflow-common-lib/angular.json .
23-
COPY ./crud-web-apps/common/frontend/kubeflow-common-lib/tsconfig.json .
21+
COPY ./kubeflow-common-lib/projects ./projects
22+
COPY ./kubeflow-common-lib/angular.json .
23+
COPY ./kubeflow-common-lib/tsconfig.json .
2424
RUN npm run build
2525

2626
# --- Build the frontend ---
2727
FROM node:16.20.2-bullseye as frontend
2828

29-
ARG kubeflowversion
29+
ARG kubeflowversion=unknown
3030
ENV BUILD_VERSION=$kubeflowversion
3131

32-
COPY ./centraldashboard-angular/frontend ./src
32+
COPY ./frontend /src
3333
WORKDIR /src
3434

3535
ENV NG_CLI_ANALYTICS "ci"

components/centraldashboard-angular/Makefile

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,34 @@ IMG ?= ghcr.io/kubeflow/kubeflow/centraldashboard-angular
22
TAG ?= $(shell git describe --tags --always --dirty)
33
COMMIT = $(shell git rev-parse HEAD)
44

5+
COMMON_LIB_COMMIT ?= $(shell head -n 1 frontend/COMMON_LIB_COMMIT)
6+
COMMON_LIB_TARGET_DIR = kubeflow-common-lib
7+
COMMON_LIB_TMP_TGZ := /tmp/kubeflow-$(COMMON_LIB_COMMIT).tar.gz
8+
9+
.PHONY:fetch-common-lib
10+
fetch-common-lib:
11+
curl -L -f -o $(COMMON_LIB_TMP_TGZ) https://github.com/kubeflow/kubeflow/archive/$(COMMON_LIB_COMMIT).tar.gz
12+
13+
rm -rf $(COMMON_LIB_TARGET_DIR)
14+
mkdir -p $(COMMON_LIB_TARGET_DIR)
15+
tar -C /tmp -xzf $(COMMON_LIB_TMP_TGZ) kubeflow-$(COMMON_LIB_COMMIT)/components/crud-web-apps/common/frontend/kubeflow-common-lib/
16+
mv /tmp/kubeflow-$(COMMON_LIB_COMMIT)/components/crud-web-apps/common/frontend/kubeflow-common-lib/* $(COMMON_LIB_TARGET_DIR)/
17+
18+
rm -f $(COMMON_LIB_TMP_TGZ)
19+
rm -rf /tmp/kubeflow-$(COMMON_LIB_COMMIT)
20+
21+
.PHONY: build-common-lib
22+
build-common-lib: fetch-common-lib
23+
cd $(COMMON_LIB_TARGET_DIR) && npm i && npm run build && cd dist/kubeflow && npm link
24+
25+
526
# To build without the cache set the environment variable
627
# export DOCKER_BUILD_OPTS=--no-cache
7-
docker-build:
8-
docker build ${DOCKER_BUILD_OPTS} -t $(IMG):$(TAG) -f Dockerfile .. \
9-
--build-arg kubeflowversion=$(shell git describe --abbrev=0 --tags) \
28+
docker-build: fetch-common-lib
29+
docker build ${DOCKER_BUILD_OPTS} -t $(IMG):$(TAG) -f Dockerfile . \
30+
--build-arg kubeflowversion=$(shell git describe --abbrev=0 --tags || git rev-parse --abbrev-ref HEAD) \
1031
--build-arg commit=$(COMMIT) \
11-
--label=git-verions=$(TAG)
32+
--label=git-version=$(TAG)
1233

1334
docker-push:
1435
docker push $(IMG):$(TAG)

components/centraldashboard-angular/frontend/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
/dist
55
/tmp
66
/out-tsc
7+
/.angular
78
# Only exists if Bazel was run
89
/bazel-out
910

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4a26c7b5e9575410613faf7df6735aa1883a2d24

0 commit comments

Comments
 (0)