From 1813db624a491b78f825f30653d4bea6e344788e Mon Sep 17 00:00:00 2001 From: timdeluxe <5765175+timdeluxe@users.noreply.github.com> Date: Thu, 13 Jun 2024 14:55:42 +0200 Subject: [PATCH] feat: Adding sops feature --- feature/sops/feature.yaml | 6 ++++++ feature/sops/goss/.env | 1 + feature/sops/goss/goss.yaml | 6 ++++++ feature/sops/install.sh | 22 ++++++++++++++++++++++ 4 files changed, 35 insertions(+) create mode 100644 feature/sops/feature.yaml create mode 100644 feature/sops/goss/.env create mode 100644 feature/sops/goss/goss.yaml create mode 100644 feature/sops/install.sh diff --git a/feature/sops/feature.yaml b/feature/sops/feature.yaml new file mode 100644 index 0000000..5fe5405 --- /dev/null +++ b/feature/sops/feature.yaml @@ -0,0 +1,6 @@ +icon: "🔑" +title: "sops" +description: "Installs [sops](https://github.com/getsops/sops)" +configuration: + - "Environment SOPS_VERSION (required): Valid sops version (e.g. 3.8.1)" + - "Environment specific for the key you use, see [sops documentation](https://github.com/getsops/sops?tab=readme-ov-file#22encrypting-using-age)" diff --git a/feature/sops/goss/.env b/feature/sops/goss/.env new file mode 100644 index 0000000..4a9e6df --- /dev/null +++ b/feature/sops/goss/.env @@ -0,0 +1 @@ +SOPS_VERSION=3.8.1 \ No newline at end of file diff --git a/feature/sops/goss/goss.yaml b/feature/sops/goss/goss.yaml new file mode 100644 index 0000000..6ecf167 --- /dev/null +++ b/feature/sops/goss/goss.yaml @@ -0,0 +1,6 @@ +command: + sops: + exec: "/home/cloudcontrol/bin/sops --version" + exit-status: 0 + stdout: + - "sops" diff --git a/feature/sops/install.sh b/feature/sops/install.sh new file mode 100644 index 0000000..8f09770 --- /dev/null +++ b/feature/sops/install.sh @@ -0,0 +1,22 @@ +. /feature-installer-utils.sh + +if [ -z "${SOPS_VERSION}" ] +then + echo "The sops feature requires a version set using SOPS_VERSION. See https://github.com/getsops/sops/releases/ for valid versions" + exit 1 +fi + +SOPS_VERSION=$(checkAndCleanVersion "${SOPS_VERSION}") + +TEMPDIR=$(mktemp -d) +cd "${TEMPDIR}" || exit + +execHandle "Downloading sops" curl -f -s -L "https://github.com/getsops/sops/releases/download/v${SOPS_VERSION}/sops-v${SOPS_VERSION}.linux.$(getPlatform)" --output sops +execHandle "Installing sops" mv sops /home/cloudcontrol/bin + +cd - &>/dev/null || exit +rm -rf "${TEMPDIR}" + + + +