From b32a28c0abe26e8f5751522ee7ca33f3eecf8ad7 Mon Sep 17 00:00:00 2001 From: Andrew Scribner Date: Tue, 28 Nov 2023 14:55:12 -0500 Subject: [PATCH 1/5] update katib-ui rockcraft.yaml Previously, an older version of the katib-ui had been rocked. This commit updates the rock to the current katib-ui, replicating the build defined by https://github.com/kubeflow/katib/blob/v0.16.0/cmd/ui/v1beta1/Dockerfile --- katib-ui-rock/rockcraft.yaml | 109 ++++++++++++++++++++++++----------- 1 file changed, 76 insertions(+), 33 deletions(-) diff --git a/katib-ui-rock/rockcraft.yaml b/katib-ui-rock/rockcraft.yaml index 5f69ca2..0c13dbb 100644 --- a/katib-ui-rock/rockcraft.yaml +++ b/katib-ui-rock/rockcraft.yaml @@ -1,11 +1,13 @@ -# Based on https://github.com/kubeflow/katib/blob/v0.15.0/cmd/ui/v1beta1 +# Based on https://github.com/kubeflow/katib/blob/v0.16.0/cmd/ui/v1beta1/Dockerfile name: katib-ui summary: Katib UI description: | Katib UI. -version: v0.15.0_22.04_1 +# TODO: set version +# version: v0.15.0_22.04_1 +version: todo license: Apache-2.0 -build-base: ubuntu:22.04 +build-base: ubuntu@22.04 base: bare run-user: _daemon_ services: @@ -19,42 +21,83 @@ platforms: amd64: parts: - katib-ui: + frontend-lib: + plugin: nil + source: https://github.com/kubeflow/kubeflow + source-type: git + # Set source-tag here to the commit cited in https://github.com/kubeflow/katib/blob/master/pkg/ui/v1beta1/frontend/COMMIT + # for this Katib release + # Note: Katib 0.16.0 cannot build with Kubeflow v1.8-branch because Kubeflow refactored this lib + source-commit: 046c6d3c8301a95a2809c0d927bbbf72638dd639 + # Omit source-depth because we're cloning a commit + # source-depth: 1 + build-environment: + # suppress analytics collection + - NG_CLI_ANALYTICS: false + build-snaps: + - node/12/stable + override-build: | + # Clean the build dir so we don't accidentally use files we didn't intend + rm -rf ./* + + # Pull only the files we need for the build from src, and build + cp $CRAFT_PART_SRC/components/crud-web-apps/common/frontend/kubeflow-common-lib/package*.json ./ + npm ci + cp -r $CRAFT_PART_SRC/components/crud-web-apps/common/frontend/kubeflow-common-lib/* ./ + npm run build + + override-stage: | + mkdir -p $CRAFT_STAGE/frontend-lib/dist + cp -r $CRAFT_PART_BUILD/dist/kubeflow $CRAFT_STAGE/frontend-lib/dist/kubeflow + + frontend: + after: [frontend-lib] + plugin: nil + source: https://github.com/kubeflow/katib + source-type: git + source-tag: v0.16.0 + source-depth: 1 + build-snaps: + - node/12/stable + override-build: | + # Clean the build dir so we don't accidentally use files we didn't intend + rm -rf ./* + + # Pull only the files we need for the build from src + cp $CRAFT_PART_SRC/pkg/ui/v1beta1/frontend/package*.json ./ + npm ci + cp -r $CRAFT_STAGE/frontend-lib/dist/kubeflow ./node_modules/kubeflow + cp -r $CRAFT_PART_SRC/pkg/ui/v1beta1/frontend/* . + npm run build:prod + + override-prime: | + mkdir -p $CRAFT_PRIME/app/build + cp -r $CRAFT_PART_BUILD/dist/static $CRAFT_PRIME/app/build/static + + backend: plugin: go source: https://github.com/kubeflow/katib source-type: git - source-tag: v0.15.0 + source-tag: v0.16.0 build-snaps: - - go - - curl - build-packages: - - npm - stage-packages: - - libc6_libs + - go/1.20/stable build-environment: - - CGO_ENABLED: "0" - - GOOS: "linux" - - GOARCH: "amd64" + - CGO_ENABLED: 0 + - GOOS: linux override-build: | - set -xe - - cp -r ${CRAFT_PART_SRC}/pkg/ui/v1beta1/frontend . - cd ./frontend && rm -rf package-lock.json && npm install && npm ci && npm run build && cd .. - rm -rf ./frontend/node_modules - mkdir -p ${CRAFT_PART_INSTALL}/app/build - cp -r ./frontend/build/* ${CRAFT_PART_INSTALL}/app/build + # Clean the build dir so we don't accidentally use files we didn't intend + rm -rf ./* + + # Pull only the files we need for the build from src + cp -r $CRAFT_PART_SRC/go.mod ./ + cp -r $CRAFT_PART_SRC/go.sum ./ + go mod download -x + cp -r $CRAFT_PART_SRC/cmd ./cmd + cp -r $CRAFT_PART_SRC/pkg ./pkg - mkdir -p ${CRAFT_PART_INSTALL}/app - cd ${CRAFT_PART_SRC}/ - go mod download all + # Build go build -a -o katib-ui ./cmd/ui/v1beta1 - install -D -m755 katib-ui ${CRAFT_PART_INSTALL}/app/katib-ui - security-team-requirement: - plugin: nil - override-build: | - # security requirement - # there are no packages installed in `bare` base which is used in this rock - mkdir -p ${CRAFT_PART_INSTALL}/usr/share/rocks - (echo "# os-release" && cat /etc/os-release && echo "# dpkg-query") \ - > ${CRAFT_PART_INSTALL}/usr/share/rocks/dpkg.query + override-prime: | + mkdir -p $CRAFT_PRIME/app + cp $CRAFT_PART_BUILD/katib-ui $CRAFT_PRIME/app From 624d23910cbd64a4a44c3869df784b8f85bea50c Mon Sep 17 00:00:00 2001 From: Andrew Scribner Date: Tue, 28 Nov 2023 16:36:59 -0500 Subject: [PATCH 2/5] update katib-ui rockcraft image version --- katib-ui-rock/rockcraft.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/katib-ui-rock/rockcraft.yaml b/katib-ui-rock/rockcraft.yaml index 0c13dbb..e2c7a21 100644 --- a/katib-ui-rock/rockcraft.yaml +++ b/katib-ui-rock/rockcraft.yaml @@ -3,9 +3,7 @@ name: katib-ui summary: Katib UI description: | Katib UI. -# TODO: set version -# version: v0.15.0_22.04_1 -version: todo +version: v0.16.0 license: Apache-2.0 build-base: ubuntu@22.04 base: bare From 522ed8799d52eabeb8286e456ba054c0641b7b4c Mon Sep 17 00:00:00 2001 From: Andrew Scribner Date: Tue, 28 Nov 2023 16:39:15 -0500 Subject: [PATCH 3/5] add dpkg-query to katib-ui rockcraft.yaml --- katib-ui-rock/rockcraft.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/katib-ui-rock/rockcraft.yaml b/katib-ui-rock/rockcraft.yaml index e2c7a21..ebf170d 100644 --- a/katib-ui-rock/rockcraft.yaml +++ b/katib-ui-rock/rockcraft.yaml @@ -99,3 +99,12 @@ parts: override-prime: | mkdir -p $CRAFT_PRIME/app cp $CRAFT_PART_BUILD/katib-ui $CRAFT_PRIME/app + + security-team-requirement: + plugin: nil + override-build: | + # security requirement + # there are no packages installed in `bare` base which is used in this rock + mkdir -p ${CRAFT_PART_INSTALL}/usr/share/rocks + (echo "# os-release" && cat /etc/os-release && echo "# dpkg-query") \ + > ${CRAFT_PART_INSTALL}/usr/share/rocks/dpkg.query \ No newline at end of file From 43c2bd5d958f6984fb605b0d326289cafca10042 Mon Sep 17 00:00:00 2001 From: Andrew Scribner Date: Wed, 29 Nov 2023 14:05:10 -0500 Subject: [PATCH 4/5] edit katib-ui rockcraft.yaml per review feedback --- katib-ui-rock/rockcraft.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/katib-ui-rock/rockcraft.yaml b/katib-ui-rock/rockcraft.yaml index ebf170d..f2084bb 100644 --- a/katib-ui-rock/rockcraft.yaml +++ b/katib-ui-rock/rockcraft.yaml @@ -23,12 +23,10 @@ parts: plugin: nil source: https://github.com/kubeflow/kubeflow source-type: git - # Set source-tag here to the commit cited in https://github.com/kubeflow/katib/blob/master/pkg/ui/v1beta1/frontend/COMMIT + # Set source-commit here to the commit cited in + # https://github.com/kubeflow/katib/blob/master/pkg/ui/v1beta1/frontend/COMMIT # for this Katib release - # Note: Katib 0.16.0 cannot build with Kubeflow v1.8-branch because Kubeflow refactored this lib source-commit: 046c6d3c8301a95a2809c0d927bbbf72638dd639 - # Omit source-depth because we're cloning a commit - # source-depth: 1 build-environment: # suppress analytics collection - NG_CLI_ANALYTICS: false @@ -78,7 +76,9 @@ parts: source-type: git source-tag: v0.16.0 build-snaps: - - go/1.20/stable + # Use go version that satisfies requirements in + # https://github.com/kubeflow/katib/blob/v0.16.0/docs/developer-guide.md#requirements + - go/1.21/stable build-environment: - CGO_ENABLED: 0 - GOOS: linux @@ -107,4 +107,4 @@ parts: # there are no packages installed in `bare` base which is used in this rock mkdir -p ${CRAFT_PART_INSTALL}/usr/share/rocks (echo "# os-release" && cat /etc/os-release && echo "# dpkg-query") \ - > ${CRAFT_PART_INSTALL}/usr/share/rocks/dpkg.query \ No newline at end of file + > ${CRAFT_PART_INSTALL}/usr/share/rocks/dpkg.query From 89c883072023053bdcec5276a188cc68d24f21d4 Mon Sep 17 00:00:00 2001 From: Andrew Scribner Date: Thu, 30 Nov 2023 12:09:00 -0500 Subject: [PATCH 5/5] fix: reorder copy commands in katib-ui rock --- katib-ui-rock/rockcraft.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/katib-ui-rock/rockcraft.yaml b/katib-ui-rock/rockcraft.yaml index f2084bb..d8a81c9 100644 --- a/katib-ui-rock/rockcraft.yaml +++ b/katib-ui-rock/rockcraft.yaml @@ -62,8 +62,8 @@ parts: # Pull only the files we need for the build from src cp $CRAFT_PART_SRC/pkg/ui/v1beta1/frontend/package*.json ./ npm ci - cp -r $CRAFT_STAGE/frontend-lib/dist/kubeflow ./node_modules/kubeflow cp -r $CRAFT_PART_SRC/pkg/ui/v1beta1/frontend/* . + cp -r $CRAFT_STAGE/frontend-lib/dist/kubeflow ./node_modules/kubeflow npm run build:prod override-prime: |