Skip to content

Commit

Permalink
Add Katib release script (#1371)
Browse files Browse the repository at this point in the history
* Add release script

* Add latest tag in build and release scripts
Remove release prow workflow

* Fix enas cnn cifar10 cpu image

* Use VERSION instead of v1beta1

* Remove build test scripts
  • Loading branch information
andreyvelich authored Oct 31, 2020
1 parent d5f5aa0 commit 499856f
Show file tree
Hide file tree
Showing 22 changed files with 217 additions and 986 deletions.
1 change: 1 addition & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
HAS_DEP := $(shell command -v dep;)
HAS_LINT := $(shell command -v golint;)

PREFIX ?= katib
CMD_PREFIX ?= cmd

# Run tests
.PHONY: test
test:
Expand Down Expand Up @@ -64,7 +61,10 @@ buildv1alpha3: depend generate

# Build images for Katib v1beta1 components
build: depend generate
bash scripts/v1beta1/build.sh
ifeq ($(and $(REGISTRY),$(TAG)),)
$(error REGISTRY and TAG must be set. Usage make build REGISTRY=<registry> TAG=<TAG>)
endif
bash scripts/v1beta1/build.sh -r $(REGISTRY) -t $(TAG)

# Prettier UI format check for Katib v1alpha3
prettier-check-v1alpha3:
Expand Down
2 changes: 1 addition & 1 deletion docs/developer-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ see the following user guides:
Check source code as follows:

```bash
make build
make build REGISTRY=<image-registry> TAG=<image-tag>
```

You can deploy Katib v1beta1 manifests into a k8s cluster as follows:
Expand Down
47 changes: 0 additions & 47 deletions prow_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,50 +47,3 @@ workflows:
- prow_config.yaml
params:
registry: 527798164940.dkr.ecr.us-west-2.amazonaws.com
# TODO (andreyvelich): Temporary workflow to release Katib images to kubeflow-images-public registry.
- app_dir: kubeflow/katib/test/workflows
component: workflows-v1beta1-release
name: e2e-v1beta1
job_types:
- postsubmit
include_dirs:
- pkg/apis/controller/common/v1beta1/*
- pkg/apis/controller/experiments/v1beta1/*
- pkg/apis/controller/trials/v1beta1/*
- pkg/apis/controller/suggestions/v1beta1/*
- pkg/apis/controller/a*.go
- pkg/apis/manager/health/*
- pkg/apis/manager/v1beta1/*
- pkg/apis/v1beta1/*
- pkg/common/v1beta1/*
- pkg/controller.v1beta1/*
- pkg/db/v1beta1/*
- pkg/job/v1beta1/*
- pkg/metricscollector/v1beta1/*
- pkg/suggestion/v1beta1/*
- pkg/ui/v1beta1/*
- pkg/util/v1beta1/*
- pkg/webhook/v1beta1/*
- cmd/db-manager/v1beta1/*
- cmd/katib-controller/v1beta1/*
- cmd/metricscollector/v1beta1/*
- cmd/suggestion/chocolate/v1beta1/*
- cmd/suggestion/hyperband/v1beta1/*
- cmd/suggestion/hyperopt/v1beta1/*
- cmd/suggestion/nas/enas/v1beta1/*
- cmd/suggestion/nas/darts/v1beta1/*
- cmd/suggestion/skopt/v1beta1/*
- cmd/suggestion/goptuna/v1beta1/*
- cmd/ui/v1beta1/*
- examples/v1beta1/*
- test/e2e/v1beta1/*
- test/scripts/v1beta1/*
- test/suggestion/v1beta1/*
- test/unit/v1beta1/*
- test/workflows/*
- manifests/v1beta1/*
- scripts/v1beta1/*
- vendor/*
- prow_config.yaml
params:
registry: "gcr.io/kubeflow-images-public"
127 changes: 87 additions & 40 deletions scripts/v1beta1/build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright 2018 The Kubeflow Authors.
# Copyright 2020 The Kubeflow Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,71 +14,118 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -o errexit
set -o nounset
set -o pipefail
# This script is used to build all Katib images.
# It adds "<TAG>" and "latest" tag to them.
# Run ./scripts/v1beta1/build.sh -r <image-registry> -t <image-tag> to execute it.

REGISTRY="gcr.io/kubeflow-images-public"
TAG="latest"
PREFIX="katib/v1beta1"
CMD_PREFIX="cmd"
MACHINE_ARCH=$(uname -m)

SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/../..

cd ${SCRIPT_ROOT}
set -e

usage() {
echo "Usage: $0 [-t <tag>] [-r <registry>] [-p <prefix>]" 1>&2
echo "Usage: $0 [-r <REGISTRY>] [-t <TAG>]" 1>&2
exit 1
}

while getopts ":t::r::p:" opt; do
case $opt in
t)
TAG=${OPTARG}
;;
r)
REGISTRY=${OPTARG}
;;
p)
PREFIX=${OPTARG}
t)
TAG=${OPTARG}
;;
*)
usage
;;
esac
done
echo "Registry: ${REGISTRY}, tag: ${TAG}, prefix: ${PREFIX}"

echo "Building core image..."
docker build -t ${REGISTRY}/${PREFIX}/katib-controller:${TAG} -f ${CMD_PREFIX}/katib-controller/v1beta1/Dockerfile .
docker build -t ${REGISTRY}/${PREFIX}/katib-db-manager:${TAG} -f ${CMD_PREFIX}/db-manager/v1beta1/Dockerfile .
if [[ -z "$REGISTRY" || -z "$TAG" ]]; then
echo "Image registry and tag must be set"
echo "Usage: $0 [-r <REGISTRY>] [-t <TAG>]" 1>&2
exit 1
fi

echo "Building UI image..."
docker build -t ${REGISTRY}/${PREFIX}/katib-ui:${TAG} -f ${CMD_PREFIX}/ui/v1beta1/Dockerfile .
VERSION="v1beta1"
CMD_PREFIX="cmd"
MACHINE_ARCH=$(uname -m)

echo "Building images for Katib ${VERSION}..."
echo "Image registry: ${REGISTRY}"
echo "Image tag: ${TAG}"

SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/../..
cd ${SCRIPT_ROOT}

echo "Building file metrics collector image..."
docker build -t ${REGISTRY}/${PREFIX}/file-metrics-collector:${TAG} -f ${CMD_PREFIX}/metricscollector/v1beta1/file-metricscollector/Dockerfile .
# Katib core images
echo -e "\nBuilding Katib controller image...\n"
docker build -t ${REGISTRY}/katib-controller:${TAG} -t ${REGISTRY}/katib-controller:latest -f ${CMD_PREFIX}/katib-controller/${VERSION}/Dockerfile .

echo "Building TF Event metrics collector image..."
echo -e "\nBuilding Katib DB manager image...\n"
docker build -t ${REGISTRY}/katib-db-manager:${TAG} -t ${REGISTRY}/katib-db-manager:latest -f ${CMD_PREFIX}/db-manager/${VERSION}/Dockerfile .

echo -e "\nBuilding Katib UI image...\n"
docker build -t ${REGISTRY}/katib-ui:${TAG} -t ${REGISTRY}/katib-ui:latest -f ${CMD_PREFIX}/ui/${VERSION}/Dockerfile .

echo -e "\nBuilding file metrics collector image...\n"
docker build -t ${REGISTRY}/file-metrics-collector:${TAG} -t ${REGISTRY}/file-metrics-collector:latest -f ${CMD_PREFIX}/metricscollector/${VERSION}/file-metricscollector/Dockerfile .

echo -e "\nBuilding TF Event metrics collector image...\n"
if [ $MACHINE_ARCH == "aarch64" ]; then
docker build -t ${REGISTRY}/${PREFIX}/tfevent-metrics-collector:${TAG} -f ${CMD_PREFIX}/metricscollector/v1beta1/tfevent-metricscollector/Dockerfile.aarch64 .
docker build -t ${REGISTRY}/tfevent-metrics-collector:${TAG} -t ${REGISTRY}/tfevent-metrics-collector:latest -f ${CMD_PREFIX}/metricscollector/${VERSION}/tfevent-metricscollector/Dockerfile.aarch64 .
elif [ $MACHINE_ARCH == "ppc64le" ]; then
docker build -t ${REGISTRY}/${PREFIX}/tfevent-metrics-collector:${TAG} -f ${CMD_PREFIX}/metricscollector/v1beta1/tfevent-metricscollector/Dockerfile.ppc64le .
docker build -t ${REGISTRY}/tfevent-metrics-collector:${TAG} -t ${REGISTRY}/tfevent-metrics-collector:latest -f ${CMD_PREFIX}/metricscollector/${VERSION}/tfevent-metricscollector/Dockerfile.ppc64le .
else
docker build -t ${REGISTRY}/${PREFIX}/tfevent-metrics-collector:${TAG} -f ${CMD_PREFIX}/metricscollector/v1beta1/tfevent-metricscollector/Dockerfile .
docker build -t ${REGISTRY}/tfevent-metrics-collector:${TAG} -t ${REGISTRY}/tfevent-metrics-collector:latest -f ${CMD_PREFIX}/metricscollector/${VERSION}/tfevent-metricscollector/Dockerfile .
fi

echo "Building suggestion images..."
docker build -t ${REGISTRY}/${PREFIX}/suggestion-hyperopt:${TAG} -f ${CMD_PREFIX}/suggestion/hyperopt/v1beta1/Dockerfile .
docker build -t ${REGISTRY}/${PREFIX}/suggestion-skopt:${TAG} -f ${CMD_PREFIX}/suggestion/skopt/v1beta1/Dockerfile .
docker build -t ${REGISTRY}/${PREFIX}/suggestion-chocolate:${TAG} -f ${CMD_PREFIX}/suggestion/chocolate/v1beta1/Dockerfile .
# Suggestion images
echo -e "\nBuilding suggestion images..."

echo -e "\nBuilding hyperopt suggestion...\n"
docker build -t ${REGISTRY}/suggestion-hyperopt:${TAG} -t ${REGISTRY}/suggestion-hyperopt:latest -f ${CMD_PREFIX}/suggestion/hyperopt/${VERSION}/Dockerfile .

echo -e "\nBuilding chocolate suggestion...\n"
docker build -t ${REGISTRY}/suggestion-chocolate:${TAG} -t ${REGISTRY}/suggestion-chocolate:latest -f ${CMD_PREFIX}/suggestion/chocolate/${VERSION}/Dockerfile .

echo -e "\nBuilding hyperband suggestion...\n"
docker build -t ${REGISTRY}/suggestion-hyperband:${TAG} -t ${REGISTRY}/suggestion-hyperband:latest -f ${CMD_PREFIX}/suggestion/hyperband/${VERSION}/Dockerfile .

echo -e "\nBuilding skopt suggestion...\n"
docker build -t ${REGISTRY}/suggestion-skopt:${TAG} -t ${REGISTRY}/suggestion-skopt:latest -f ${CMD_PREFIX}/suggestion/skopt/${VERSION}/Dockerfile .

echo -e "\nBuilding goptuna suggestion...\n"
docker build -t ${REGISTRY}/suggestion-goptuna:${TAG} -t ${REGISTRY}/suggestion-goptuna:latest -f ${CMD_PREFIX}/suggestion/goptuna/${VERSION}/Dockerfile .

echo -e "\nBuilding ENAS suggestion...\n"
if [ $MACHINE_ARCH == "aarch64" ]; then
docker build -t ${REGISTRY}/${PREFIX}/suggestion-enas:${TAG} -f ${CMD_PREFIX}/suggestion/nas/enas/v1beta1/Dockerfile.aarch64 .
docker build -t ${REGISTRY}/suggestion-enas:${TAG} -t ${REGISTRY}/suggestion-enas:latest -f ${CMD_PREFIX}/suggestion/nas/enas/${VERSION}/Dockerfile.aarch64 .
else
docker build -t ${REGISTRY}/${PREFIX}/suggestion-enas:${TAG} -f ${CMD_PREFIX}/suggestion/nas/enas/v1beta1/Dockerfile .
docker build -t ${REGISTRY}/suggestion-enas:${TAG} -t ${REGISTRY}/suggestion-enas:latest -f ${CMD_PREFIX}/suggestion/nas/enas/${VERSION}/Dockerfile .
fi
docker build -t ${REGISTRY}/${PREFIX}/suggestion-hyperband:${TAG} -f ${CMD_PREFIX}/suggestion/hyperband/v1beta1/Dockerfile .
docker build -t ${REGISTRY}/${PREFIX}/suggestion-goptuna:${TAG} -f ${CMD_PREFIX}/suggestion/goptuna/v1beta1/Dockerfile .
docker build -t ${REGISTRY}/${PREFIX}/suggestion-darts:${TAG} -f ${CMD_PREFIX}/suggestion/nas/darts/v1beta1/Dockerfile .

echo -e "\nBuilding DARTS suggestion...\n"
docker build -t ${REGISTRY}/suggestion-darts:${TAG} -t ${REGISTRY}/suggestion-darts:latest -f ${CMD_PREFIX}/suggestion/nas/darts/${VERSION}/Dockerfile .

# Early stopping images
echo -e "\nBuilding early stopping images...\n"

echo -e "\nBuilding median stopping rule...\n"
docker build -t ${REGISTRY}/earlystopping-medianstop:${TAG} -t ${REGISTRY}/earlystopping-medianstop:latest -f ${CMD_PREFIX}/earlystopping/medianstop/${VERSION}/Dockerfile .

# Training container images
echo -e "\nBuilding training container images..."

echo -e "\nBuilding mxnet mnist training container example...\n"
(cd examples/${VERSION}/mxnet-mnist && docker build -t ${REGISTRY}/mxnet-mnist:${TAG} -t ${REGISTRY}/mxnet-mnist:latest -f Dockerfile .)

echo -e "\nBuilding PyTorch mnist training container example...\n"
(cd examples/${VERSION}/file-metrics-collector && docker build -t ${REGISTRY}/pytorch-mnist:${TAG} -t ${REGISTRY}/pytorch-mnist:latest -f Dockerfile .)

echo -e "\nBuilding Keras CIFAR-10 CNN training container example for ENAS with GPU support...\n"
(cd examples/${VERSION}/nas/enas-cnn-cifar10 && docker build -t ${REGISTRY}/enas-cnn-cifar10-gpu:${TAG} -t ${REGISTRY}/enas-cnn-cifar10-gpu:latest -f Dockerfile.gpu .)

echo -e "\nBuilding Keras CIFAR-10 CNN training container example for ENAS with CPU support...\n"
(cd examples/${VERSION}/nas/enas-cnn-cifar10 && docker build -t ${REGISTRY}/enas-cnn-cifar10-cpu:${TAG} -t ${REGISTRY}/enas-cnn-cifar10-cpu:latest -f Dockerfile.cpu .)

echo -e "\nBuilding PyTorch CIFAR-10 CNN training container example for DARTS...\n"
(cd examples/${VERSION}/nas/darts-cnn-cifar10 && docker build -t ${REGISTRY}/darts-cnn-cifar10:${TAG} -t ${REGISTRY}/darts-cnn-cifar10:latest -f Dockerfile .)
2 changes: 1 addition & 1 deletion scripts/v1beta1/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright 2018 The Kubeflow Authors.
# Copyright 2020 The Kubeflow Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
123 changes: 123 additions & 0 deletions scripts/v1beta1/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
#!/bin/bash

# Copyright 2020 The Kubeflow Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This script is used to release all Katib images in docker.io/kubeflowkatib registry
# It adds "v1beta1-<commit-SHA>" and "latest" tag to them.

set -e

COMMIT=$(git rev-parse --short HEAD)
REGISTRY="docker.io/kubeflowkatib"
VERSION="v1beta1"
TAG=${VERSION}-${COMMIT}

echo "Releasing images for Katib ${VERSION}..."
echo "Commit SHA: ${COMMIT}"
echo "Image registry: ${REGISTRY}"
echo -e "Image tag: ${TAG}\n"

SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/../..
cd ${SCRIPT_ROOT}

# Building the images
make build REGISTRY=${REGISTRY} TAG=${TAG}

# Releasing the images
echo -e "\nAll Katib images have been successfully built\n"

# Katib core images
echo -e "\nPushing Katib controller image...\n"
docker push ${REGISTRY}/katib-controller:${TAG}
docker push ${REGISTRY}/katib-controller:latest

echo -e "\nPushing Katib DB manager image...\n"
docker push ${REGISTRY}/katib-db-manager:${TAG}
docker push ${REGISTRY}/katib-db-manager:latest

echo -e "\nPushing Katib UI image...\n"
docker push ${REGISTRY}/katib-ui:${TAG}
docker push ${REGISTRY}/katib-ui:latest

echo -e "\nPushing file metrics collector image...\n"
docker push ${REGISTRY}/file-metrics-collector:${TAG}
docker push ${REGISTRY}/file-metrics-collector:latest

echo -e "\nPushing TF Event metrics collector image...\n"
docker push ${REGISTRY}/tfevent-metrics-collector:${TAG}
docker push ${REGISTRY}/tfevent-metrics-collector:latest

# Suggestion images
echo -e "\nPushing suggestion images..."

echo -e "\nPushing hyperopt suggestion...\n"
docker push ${REGISTRY}/suggestion-hyperopt:${TAG}
docker push ${REGISTRY}/suggestion-hyperopt:latest

echo -e "\nPushing chocolate suggestion...\n"
docker push ${REGISTRY}/suggestion-chocolate:${TAG}
docker push ${REGISTRY}/suggestion-chocolate:latest

echo -e "\nPushing hyperband suggestion...\n"
docker push ${REGISTRY}/suggestion-hyperband:${TAG}
docker push ${REGISTRY}/suggestion-hyperband:latest

echo -e "\nPushing skopt suggestion...\n"
docker push ${REGISTRY}/suggestion-skopt:${TAG}
docker push ${REGISTRY}/suggestion-skopt:latest

echo -e "\nPushing goptuna suggestion...\n"
docker push ${REGISTRY}/suggestion-goptuna:${TAG}
docker push ${REGISTRY}/suggestion-goptuna:latest

echo -e "\nPushing ENAS suggestion...\n"
docker push ${REGISTRY}/suggestion-enas:${TAG}
docker push ${REGISTRY}/suggestion-enas:latest

echo -e "\nPushing DARTS suggestion...\n"
docker push ${REGISTRY}/suggestion-darts:${TAG}
docker push ${REGISTRY}/suggestion-darts:latest

# Early stopping images
echo -e "\nPushing early stopping images...\n"

echo -e "\nPushing median stopping rule...\n"
docker push ${REGISTRY}/earlystopping-medianstop:${TAG}
docker push ${REGISTRY}/earlystopping-medianstop:latest

# Training container images
echo -e "\nPushing training container images..."

echo -e "\nPushing mxnet mnist training container example...\n"
docker push ${REGISTRY}/mxnet-mnist:${TAG}
docker push ${REGISTRY}/mxnet-mnist:latest

echo -e "\nPushing PyTorch mnist training container example...\n"
docker push ${REGISTRY}/pytorch-mnist:${TAG}
docker push ${REGISTRY}/pytorch-mnist:latest

echo -e "\nPushing Keras CIFAR-10 CNN training container example for ENAS with GPU support...\n"
docker push ${REGISTRY}/enas-cnn-cifar10-gpu:${TAG}
docker push ${REGISTRY}/enas-cnn-cifar10-gpu:latest

echo -e "\nPushing Keras CIFAR-10 CNN training container example for ENAS with CPU support...\n"
docker push ${REGISTRY}/enas-cnn-cifar10-cpu:${TAG}
docker push ${REGISTRY}/enas-cnn-cifar10-cpu:latest

echo -e "\nPushing PyTorch CIFAR-10 CNN training container example for DARTS...\n"
docker push ${REGISTRY}/darts-cnn-cifar10:${TAG}
docker push ${REGISTRY}/darts-cnn-cifar10:latest

echo -e "\nKatib ${VERSION} for commit SHA: ${COMMIT} has been released successfully!"
Loading

0 comments on commit 499856f

Please sign in to comment.