Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update katib-ui rockcraft.yaml #38

Merged
merged 5 commits into from
Dec 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 75 additions & 25 deletions katib-ui-rock/rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# 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
version: v0.16.0
orfeas-k marked this conversation as resolved.
Show resolved Hide resolved
license: Apache-2.0
build-base: ubuntu:22.04
build-base: ubuntu@22.04
base: bare
run-user: _daemon_
services:
Expand All @@ -19,36 +19,86 @@ platforms:
amd64:

parts:
katib-ui:
frontend-lib:
plugin: nil
source: https://github.com/kubeflow/kubeflow
source-type: git
# 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
source-commit: 046c6d3c8301a95a2809c0d927bbbf72638dd639
orfeas-k marked this conversation as resolved.
Show resolved Hide resolved
build-environment:
# suppress analytics collection
- NG_CLI_ANALYTICS: false
orfeas-k marked this conversation as resolved.
Show resolved Hide resolved
build-snaps:
- node/12/stable
override-build: |
# Clean the build dir so we don't accidentally use files we didn't intend
rm -rf ./*
orfeas-k marked this conversation as resolved.
Show resolved Hide resolved

# 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_PART_SRC/pkg/ui/v1beta1/frontend/* .
cp -r $CRAFT_STAGE/frontend-lib/dist/kubeflow ./node_modules/kubeflow
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
# 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"
- GOARCH: "amd64"
orfeas-k marked this conversation as resolved.
Show resolved Hide resolved
- CGO_ENABLED: 0
- GOOS: linux
override-build: |
set -xe
# 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

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

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

override-prime: |
mkdir -p $CRAFT_PRIME/app
cp $CRAFT_PART_BUILD/katib-ui $CRAFT_PRIME/app

security-team-requirement:
plugin: nil
Expand Down