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

Add script for generating a krew plugin manifest. #645

Merged
merged 6 commits into from
Jul 31, 2019
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ The official binaries for KUDO are created using [goreleaser](https://goreleaser
4. Invoke goreleaser `goreleaser --rm-dist`.
5. Update the GH release with Release high-levels.
6. An announcement email is sent to `[email protected]` with the subject `[ANNOUNCE] Kudo $VERSION is released`
7. Run `./hack/generate_krew.sh` and submit the generated `kudo.yaml` to https://github.com/kubernetes-sigs/krew-index/.

**Note:** If there are issues with the release, any changes to the repository will result in it being considered "dirty" and not in a state to be released.
It is possible outside of the standard release process to build a "snapshot" release using the following command: `goreleaser release --skip-publish --snapshot --rm-dist`
Expand Down
57 changes: 57 additions & 0 deletions hack/generate_krew.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash

# This script generates a Krew-compatible plugin manifest. It should be run after goreleaser.

VERSION=${VERSION:-$(git describe --tags |sed 's/^v//g')}

# Generate the manifest for a single platform.
function generate_platform {
ARCH="${2}"
if [ "${2}" == "amd64" ]; then
ARCH=x86_64
elif [ "${2}" == "386" ]; then
ARCH=i386
fi

cat <<EOF
- selector:
matchLabels:
os: "${1}"
arch: "${2}"
uri: https://github.com/kudobuilder/kudo/releases/download/v${VERSION}/kudo_${VERSION}_${1}_${ARCH}.tar.gz
sha256: "$(curl -L https://github.com/kudobuilder/kudo/releases/download/v${VERSION}/kudo_${VERSION}_${1}_${ARCH}.tar.gz |sha256sum - |awk '{print $1}')"
bin: "./kubectl-kudo"
files:
- from: "*"
to: "."
EOF
}

rm -f kudo.yaml

cat <<EOF >> kudo.yaml
apiVersion: krew.googlecontainertools.github.com/v1alpha2
kind: Plugin
metadata:
name: kudo
spec:
version: "${VERSION}"

shortDescription: Declaratively build, install, and run operators using KUDO.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mattj-io / @yankcrime / @gerred / @runyontr is there someone that would be willing to help me edit the descriptions here?

homepage: https://kudo.dev/
description: |
The Kubernetes Universal Declarative Operator (KUDO) is a highly productive toolkit for writing operators for Kubernetes.
Using KUDO, you can deploy your applications, give your users the tools they need to operate it, and understand how it's
behaving in their environments — all without a PhD in Kubernetes.

platforms:
EOF

generate_platform linux amd64 >> kudo.yaml
generate_platform linux 386 >> kudo.yaml
generate_platform darwin amd64 >> kudo.yaml
generate_platform darwin 386 >> kudo.yaml
generate_platform windows amd64 >> kudo.yaml
generate_platform windows 386 >> kudo.yaml

echo "To publish to the krew index, create a pull request to https://github.com/kubernetes-sigs/krew-index/tree/master/plugins to update kudo.yaml with the newly generated kudo.yaml."