Skip to content

Commit 2fe60b6

Browse files
committed
chore: update all references to old plugin
1 parent 4354358 commit 2fe60b6

File tree

5 files changed

+30
-30
lines changed

5 files changed

+30
-30
lines changed

.buildkite/pipeline.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ steps:
22
- label: ":sparkles: Lint"
33
plugins:
44
- plugin-linter#v3.3.0:
5-
id: cluster-secrets
5+
id: secrets
66

77
- label: ":shell: Shellcheck"
88
plugins:
@@ -14,4 +14,4 @@ steps:
1414
plugins:
1515
- plugin-tester#v1.1.1:
1616
folders:
17-
- tests
17+
- tests

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Cluster Secrets Buildkite Plugin
1+
# Secrets Buildkite Plugin
22

33
A Buildkite plugin used to fetch secrets from [Buildkite Secrets](https://buildkite.com/docs/pipelines/security/secrets/buildkite-secrets),
44

@@ -18,7 +18,7 @@ A `pipeline.yml` like this will read each secret out into a ENV variable:
1818
steps:
1919
- command: echo "The content of ANIMAL is \$ANIMAL"
2020
plugins:
21-
- cluster-secrets#v1.0.0:
21+
- secrets#v1.0.0:
2222
variables:
2323
ANIMAL: llamas
2424
FOO: bar
@@ -50,7 +50,7 @@ job environment using a pipeline.yml like this:
5050
steps:
5151
- command: build.sh
5252
plugins:
53-
- cluster-secrets#v1.0.0:
53+
- secrets#v1.0.0:
5454
env: "llamas"
5555
```
5656

hooks/environment

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ downloadSecret() {
1010
else
1111
echo "${secret}"
1212
fi
13-
13+
1414
}
1515

1616
# decodes a base64 encoded secret, expects decoded secret to be in the format KEY=value:
@@ -53,22 +53,22 @@ processSecrets() {
5353

5454
processVariables() {
5555
# Extract the environment variable keys and Buildkite secret paths.
56-
for param in ${!BUILDKITE_PLUGIN_CLUSTER_SECRETS_VARIABLES_*}; do
57-
key="${param/BUILDKITE_PLUGIN_CLUSTER_SECRETS_VARIABLES_/}"
56+
for param in ${!BUILDKITE_PLUGIN_SECRETS_VARIABLES_*}; do
57+
key="${param/BUILDKITE_PLUGIN_SECRETS_VARIABLES_/}"
5858
path="${!param}"
59-
59+
6060
if ! value=$(buildkite-agent secret get "${path}"); then
6161
echo "⚠️ Unable to find secret at ${path}"
6262
exit 1
6363
else
6464
export "${key}=${value}"
65-
fi
65+
fi
6666
done
6767
}
6868

6969
# primarily used for debugging; The job log will show what env vars have changed after this hook is executed
7070
dumpEnvSecrets() {
71-
if [[ "${BUILDKITE_PLUGIN_CLUSTER_SECRETS_DUMP_ENV:-}" =~ ^(true|1)$ ]] ; then
71+
if [[ "${BUILDKITE_PLUGIN_SECRETS_DUMP_ENV:-}" =~ ^(true|1)$ ]] ; then
7272
echo "~~~ 🔎 Environment variables that were set" >&2;
7373
comm -13 <(echo "$env_before") <(env | sort) || true
7474
fi
@@ -80,10 +80,10 @@ env_before="$(env | sort)" # used by
8080

8181
echo "🔐 Fetching env secrets from Buildkite secrets"
8282
# If we are using a specific key we should download and evaluate it
83-
if [[ -n "${BUILDKITE_PLUGIN_CLUSTER_SECRETS_ENV:-env}" ]]; then
84-
secret=$(downloadSecret "${BUILDKITE_PLUGIN_CLUSTER_SECRETS_ENV:-env}")
83+
if [[ -n "${BUILDKITE_PLUGIN_SECRETS_ENV:-env}" ]]; then
84+
secret=$(downloadSecret "${BUILDKITE_PLUGIN_SECRETS_ENV:-env}")
8585
if [[ "${secret}" =~ "not found" ]]; then
86-
echo "No secret found at ${BUILDKITE_PLUGIN_CLUSTER_SECRETS_ENV:-env}"
86+
echo "No secret found at ${BUILDKITE_PLUGIN_SECRETS_ENV:-env}"
8787
else
8888
processSecrets "${secret}"
8989
fi

plugin.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name: Cluster Secrets
1+
name: Secrets
22
description: "A Buildkite plugin to fetch secrets from Buildkite secrets"
33
author: "@buildkite-plugins"
44
requirements:
5-
- bash
6-
- buildkite-agent
5+
- bash
6+
- buildkite-agent
77
configuration:
88
properties:
99
env:

tests/environment-hook.bats

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ setup() {
66
load "${BATS_PLUGIN_PATH}/load.bash"
77

88
export BUILDKITE_PIPELINE_SLUG=testpipe
9-
export BUILDKITE_PLUGIN_CLUSTER_SECRETS_DUMP_ENV=true
9+
export BUILDKITE_PLUGIN_SECRETS_DUMP_ENV=true
1010
}
1111

1212
@test "Download default env from Buildkite secrets" {
@@ -23,7 +23,7 @@ setup() {
2323

2424
@test "Download custom env from Buildkite secrets" {
2525
export TESTDATA='Rk9PPWJhcgpCQVI9QmF6ClNFQ1JFVD1sbGFtYXMK'
26-
export BUILDKITE_PLUGIN_CLUSTER_SECRETS_ENV="llamas"
26+
export BUILDKITE_PLUGIN_SECRETS_ENV="llamas"
2727

2828
stub buildkite-agent "secret get llamas : echo ${TESTDATA}"
2929

@@ -36,8 +36,8 @@ setup() {
3636

3737
@test "Download single variable from Buildkite secrets" {
3838
export TESTDATA='Rk9PPWJhcgpCQVI9QmF6ClNFQ1JFVD1sbGFtYXMK'
39-
export BUILDKITE_PLUGIN_CLUSTER_SECRETS_VARIABLES_ANIMAL="best"
40-
39+
export BUILDKITE_PLUGIN_SECRETS_VARIABLES_ANIMAL="best"
40+
4141
stub buildkite-agent \
4242
"secret get env : echo ${TESTDATA}" \
4343
"secret get best : echo llama"
@@ -51,10 +51,10 @@ setup() {
5151

5252
@test "Download multiple variables from Buildkite secrets" {
5353
export TESTDATA='Rk9PPWJhcgpCQVI9QmF6ClNFQ1JFVD1sbGFtYXMK'
54-
export BUILDKITE_PLUGIN_CLUSTER_SECRETS_VARIABLES_ANIMAL="best"
55-
export BUILDKITE_PLUGIN_CLUSTER_SECRETS_VARIABLES_COUNTRY="great-north"
56-
export BUILDKITE_PLUGIN_CLUSTER_SECRETS_VARIABLES_FOOD="chips"
57-
54+
export BUILDKITE_PLUGIN_SECRETS_VARIABLES_ANIMAL="best"
55+
export BUILDKITE_PLUGIN_SECRETS_VARIABLES_COUNTRY="great-north"
56+
export BUILDKITE_PLUGIN_SECRETS_VARIABLES_FOOD="chips"
57+
5858
stub buildkite-agent \
5959
"secret get env : echo ${TESTDATA}" \
6060
"secret get best : echo llama" \
@@ -71,7 +71,7 @@ setup() {
7171
}
7272

7373
@test "If no key env found in Buildkite secrets the plugin does nothing - but doesn't fail" {
74-
74+
7575
stub buildkite-agent "secret get env : echo 'not found'"
7676

7777
run bash -c "$PWD/hooks/environment"
@@ -82,15 +82,15 @@ setup() {
8282
}
8383

8484
@test "If no key from parameters found in Buildkite secrets the plugin fails" {
85-
export BUILDKITE_PLUGIN_CLUSTER_SECRETS_VARIABLES_ANIMAL="best"
86-
85+
export BUILDKITE_PLUGIN_SECRETS_VARIABLES_ANIMAL="best"
86+
8787
stub buildkite-agent \
8888
"secret get env : echo 'not found'" \
89-
"secret get best : exit 1"
89+
"secret get best : exit 1"
9090

9191
run bash -c "$PWD/hooks/environment"
9292

9393
assert_failure
9494
assert_output --partial "⚠️ Unable to find secret at"
9595
unstub buildkite-agent
96-
}
96+
}

0 commit comments

Comments
 (0)