From 6c29b85d5e2e96a1692eaa8e24736a615f96449d Mon Sep 17 00:00:00 2001 From: Mykhailo Bobrovskyi Date: Tue, 14 Jan 2025 14:49:48 +0200 Subject: [PATCH] Add krew-release workflow. --- .github/workflows/krew-release.yml | 11 +++++++++ .gitignore | 2 ++ .krew.yaml | 38 ++++++++++++++++++++++++++++++ hack/generate_krew.sh | 25 ++++++++++++++++++++ 4 files changed, 76 insertions(+) create mode 100644 .github/workflows/krew-release.yml create mode 100644 .krew.yaml create mode 100755 hack/generate_krew.sh diff --git a/.github/workflows/krew-release.yml b/.github/workflows/krew-release.yml new file mode 100644 index 0000000..c7ba9c3 --- /dev/null +++ b/.github/workflows/krew-release.yml @@ -0,0 +1,11 @@ +on: + release: + types: [released] +jobs: + krew-release: + runs-on: ubuntu-24.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Update new version in krew-index + uses: rajatjindal/krew-release-bot@v0.0.47 diff --git a/.gitignore b/.gitignore index d91b399..f1a7341 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,5 @@ go.work # Directory with CRDs for dependencies dep-crds + +kjob.yaml diff --git a/.krew.yaml b/.krew.yaml new file mode 100644 index 0000000..487dd04 --- /dev/null +++ b/.krew.yaml @@ -0,0 +1,38 @@ +apiVersion: krew.googlecontainertools.github.com/v1alpha2 +kind: Plugin +metadata: + name: kjob +spec: + version: {{ .TagName }} + shortDescription: Run AI/ML jobs based on the pre-defined templates + homepage: https://github.com/kubernetes-sigs/kjob/ + description: | + This kubectl plugin allows ML researchers to run templated Jobs with different values + for the application-specific parameters, without the need to edit and submit entire + YAML files. The tool comes with built-in support for running slurm scripts inside + a Kubernetes cluster. + platforms: + - selector: + matchLabels: + os: "linux" + arch: "amd64" + {{addURIAndSha "https://github.com/kubernetes-sigs/kjob/releases/download/{{ .TagName }}/kubectl-kjob-linux-amd64.tar.gz" .TagName }} + bin: "kubectl-kjob" + - selector: + matchLabels: + os: "linux" + arch: "arm64" + {{addURIAndSha "https://github.com/kubernetes-sigs/kjob/releases/download/{{ .TagName }}/kubectl-kjob-linux-arm64.tar.gz" .TagName }} + bin: "kubectl-kjob" + - selector: + matchLabels: + os: "darwin" + arch: "amd64" + {{addURIAndSha "https://github.com/kubernetes-sigs/kjob/releases/download/{{ .TagName }}/kubectl-kjob-darwin-amd64.tar.gz" .TagName }} + bin: "kubectl-kjob" + - selector: + matchLabels: + os: "darwin" + arch: "arm64" + {{addURIAndSha "https://github.com/kubernetes-sigs/kjob/releases/download/{{ .TagName }}/kubectl-kjob-darwin-arm64.tar.gz" .TagName }} + bin: "kubectl-kjob" diff --git a/hack/generate_krew.sh b/hack/generate_krew.sh new file mode 100755 index 0000000..eb62c24 --- /dev/null +++ b/hack/generate_krew.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +# Copyright 2025 The Kubernetes 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. + +set -o errexit +set -o nounset +set -o pipefail + +# Resolve the absolute path of the directory containing the script +SCRIPT_DIR=$(realpath "$(dirname "${BASH_SOURCE[0]}")") +REPO_ROOT="$SCRIPT_DIR/.." + +docker run --rm -v "$REPO_ROOT":/home/app ghcr.io/rajatjindal/krew-release-bot:v0.0.46 krew-release-bot template --tag "$1" --template-file .krew.yaml > "$REPO_ROOT"/kjob.yaml