add kubectl-cnpg package (#179)
ci/woodpecker/push/deploy-almalinux9 Pipeline was canceled
ci/woodpecker/push/deploy-fedora44 Pipeline was canceled
ci/woodpecker/push/deploy-fedora43 Pipeline was canceled
ci/woodpecker/push/deploy-fedora42 Pipeline was canceled
ci/woodpecker/push/deploy-almalinux8 Pipeline was canceled

The CloudNativePG kubectl plugin is not packaged, so hosts have no supported way to install it. kubectl only completes plugin args via a `kubectl_complete-<plugin>` helper on PATH. Needs unkin/terraform-artifactapi#50 applied for the download to pass the github remote allowlist.

- add `kubectl-cnpg` 1.30.1 for almalinux/el9 and fedora 42/43/44
- fetch the tarball via the artifactapi github remote and verify it against upstream checksums
- ship `kubectl_complete-cnpg` for `kubectl cnpg` completion
- ship bash/zsh/fish completions generated at build time

Reviewed-on: #179
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
This commit was merged in pull request #179.
This commit is contained in:
2026-10-03 00:26:56 +10:00
committed by BenVincent
parent 05f44b83c4
commit 6678762b0c
4 changed files with 100 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
name: kubectl-cnpg
github: cloudnative-pg/cloudnative-pg
description: CloudNativePG kubectl plugin.
arch: amd64
platform: linux
maintainer: The CloudNativePG Contributors
homepage: https://github.com/cloudnative-pg/cloudnative-pg
license: Apache-2.0
dist_tag: true
builds:
- repository:
- almalinux/el9
image: git.unkin.net/unkin/almalinux9-rpmbuilder:latest
release: 1
version: 1.30.1
- repository:
- fedora/42
- fedora/43
- fedora/44
image: git.unkin.net/unkin/almalinux9-rpmbuilder:latest
release: 1
version: 1.30.1
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/bash
set -e
BASE_URL="https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/github/cloudnative-pg/cloudnative-pg/releases/download/v${PACKAGE_VERSION}"
TARBALL="kubectl-cnpg_${PACKAGE_VERSION}_linux_x86_64.tar.gz"
wget -O "/app/${TARBALL}" "${BASE_URL}/${TARBALL}"
wget -O /app/checksums.txt "${BASE_URL}/cnpg-${PACKAGE_VERSION}-checksums.txt"
cd /app
grep " ${TARBALL}$" checksums.txt | sha256sum --check --strict -
tar xf "/app/${TARBALL}" -C /app/ kubectl-cnpg
mkdir -p /app/completions
/app/kubectl-cnpg completion bash > /app/completions/kubectl-cnpg
/app/kubectl-cnpg completion zsh > /app/completions/_kubectl-cnpg
/app/kubectl-cnpg completion fish > /app/completions/kubectl-cnpg.fish
envsubst < /app/resources/nfpm.yaml > /app/nfpm.yaml
nfpm pkg --config /app/nfpm.yaml --target /app/dist --packager rpm
+2
View File
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
exec kubectl cnpg __complete "$@"
+54
View File
@@ -0,0 +1,54 @@
# nfpm.yaml
name: ${PACKAGE_NAME}
version: ${PACKAGE_VERSION}
release: ${PACKAGE_RELEASE}
arch: ${PACKAGE_ARCH}
platform: ${PACKAGE_PLATFORM}
section: default
priority: extra
description: "${PACKAGE_DESCRIPTION}"
maintainer: ${PACKAGE_MAINTAINER}
homepage: ${PACKAGE_HOMEPAGE}
license: ${PACKAGE_LICENSE}
disable_globbing: false
replaces:
- kubectl-cnpg
provides:
- kubectl-cnpg
contents:
- src: /app/kubectl-cnpg
dst: /usr/bin/kubectl-cnpg
file_info:
mode: 0755
owner: root
group: root
- src: /app/resources/kubectl_complete-cnpg
dst: /usr/bin/kubectl_complete-cnpg
file_info:
mode: 0755
owner: root
group: root
- src: /app/completions/kubectl-cnpg
dst: /usr/share/bash-completion/completions/kubectl-cnpg
file_info:
mode: 0644
owner: root
group: root
- src: /app/completions/_kubectl-cnpg
dst: /usr/share/zsh/site-functions/_kubectl-cnpg
file_info:
mode: 0644
owner: root
group: root
- src: /app/completions/kubectl-cnpg.fish
dst: /usr/share/fish/vendor_completions.d/kubectl-cnpg.fish
file_info:
mode: 0644
owner: root
group: root