Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Duplicate a SemaphoreCI secret.
#!/bin/bash
# Usage:
# ./sem-copy-secret.sh [source secret name] [target secret name]
set -e
SOURCE_SECRET="$1"
TARGET_SECRET="$2"
echo "Copying secret $SOURCE_SECRET to $TARGET_SECRET"
sem get secret "$SOURCE_SECRET" | sed "s/$SOURCE_SECRET/$TARGET_SECRET/g" > "/tmp/$TARGET_SECRET.yaml"
sem create -f "/tmp/$TARGET_SECRET.yaml"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment