Build an OpenBao RPM alongside the Vault one #3
+8
-6
@@ -1,6 +1,8 @@
|
||||
---
|
||||
# nfpm config for building the vault-plugin-secrets-litellm RPM.
|
||||
# Rendered through envsubst (see scripts/build-rpm.sh) then fed to `nfpm pkg`.
|
||||
# Built once per target server (Vault, OpenBao); PACKAGE_NAME and
|
||||
# PACKAGE_PLUGIN_DIR vary per flavour.
|
||||
|
||||
name: ${PACKAGE_NAME}
|
||||
version: ${PACKAGE_VERSION}
|
||||
@@ -18,19 +20,19 @@ license: ${PACKAGE_LICENSE}
|
||||
disable_globbing: false
|
||||
|
||||
replaces:
|
||||
- vault-plugin-secrets-litellm
|
||||
- ${PACKAGE_NAME}
|
||||
provides:
|
||||
- vault-plugin-secrets-litellm
|
||||
- ${PACKAGE_NAME}
|
||||
|
||||
# Install the plugin binary into the Vault/OpenBao plugin directory. Point the
|
||||
# server's plugin_directory at /opt/vault-plugins to pick it up.
|
||||
# Install the plugin binary into the server's plugin directory. Point the
|
||||
# server's plugin_directory at PACKAGE_PLUGIN_DIR to pick it up.
|
||||
contents:
|
||||
- src: dist/vault-plugin-secrets-litellm
|
||||
dst: /opt/vault-plugins/vault-plugin-secrets-litellm
|
||||
dst: ${PACKAGE_PLUGIN_DIR}/vault-plugin-secrets-litellm
|
||||
file_info:
|
||||
mode: 0755
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
scripts:
|
||||
preinstall: packaging/scripts/preinstall.sh
|
||||
preinstall: ${PACKAGE_PREINSTALL}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Ensure the plugin directory exists before the binary is laid down.
|
||||
mkdir -p /opt/vault-plugins
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# Ensure the plugin directory exists before the binary is laid down.
|
||||
# Rendered per flavour via envsubst (see scripts/build-rpm.sh).
|
||||
mkdir -p ${PACKAGE_PLUGIN_DIR}
|
||||
+18
-4
@@ -1,6 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Package the (already built) plugin binary into an RPM with nfpm.
|
||||
# Package the (already built) plugin binary into RPMs with nfpm.
|
||||
# Builds one RPM per target server: Vault (/opt/vault-plugins) and
|
||||
# OpenBao (/opt/openbao-plugins). Both wrap the same binary.
|
||||
# Usage: scripts/build-rpm.sh [version] (version defaults to $CI_COMMIT_TAG)
|
||||
#
|
||||
set -euo pipefail
|
||||
@@ -18,7 +20,7 @@ if [ ! -f "${DIST}/${BINARY}" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export PACKAGE_NAME="${BINARY}"
|
||||
# Fields shared across every flavour.
|
||||
export PACKAGE_VERSION="${VERSION}"
|
||||
export PACKAGE_RELEASE="1"
|
||||
export PACKAGE_ARCH="amd64"
|
||||
@@ -28,8 +30,20 @@ export PACKAGE_MAINTAINER="Ben Vincent <ben@unkin.net>"
|
||||
export PACKAGE_HOMEPAGE="https://git.unkin.net/unkin/vault-plugin-secrets-litellm"
|
||||
export PACKAGE_LICENSE="MIT"
|
||||
|
||||
envsubst < packaging/nfpm.yaml > "${DIST}/nfpm.yaml"
|
||||
nfpm pkg --config "${DIST}/nfpm.yaml" --target "${DIST}" --packager rpm
|
||||
# build_flavor <package-name> <plugin-dir>
|
||||
build_flavor() {
|
||||
export PACKAGE_NAME="$1"
|
||||
export PACKAGE_PLUGIN_DIR="$2"
|
||||
export PACKAGE_PREINSTALL="${DIST}/preinstall-${PACKAGE_NAME}.sh"
|
||||
|
||||
envsubst '${PACKAGE_PLUGIN_DIR}' \
|
||||
< packaging/scripts/preinstall.sh.tmpl > "${PACKAGE_PREINSTALL}"
|
||||
envsubst < packaging/nfpm.yaml > "${DIST}/nfpm-${PACKAGE_NAME}.yaml"
|
||||
nfpm pkg --config "${DIST}/nfpm-${PACKAGE_NAME}.yaml" --target "${DIST}" --packager rpm
|
||||
}
|
||||
|
||||
build_flavor "vault-plugin-secrets-litellm" "/opt/vault-plugins"
|
||||
build_flavor "openbao-plugin-secrets-litellm" "/opt/openbao-plugins"
|
||||
|
||||
echo "Built:"
|
||||
ls -1 "${DIST}"/*.rpm
|
||||
|
||||
Reference in New Issue
Block a user