Skip to content

Instantly share code, notes, and snippets.

@lovromazgon
Created January 15, 2021 17:00
Show Gist options
  • Save lovromazgon/f51727d3fd4b903d0eca57d0fe2f9790 to your computer and use it in GitHub Desktop.
Save lovromazgon/f51727d3fd4b903d0eca57d0fe2f9790 to your computer and use it in GitHub Desktop.
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