Skip to content

Commit f0fd718

Browse files
committed
Add fix for SC2295
Quote the replacement patterns including the trailing slash to show this is part of the pattern and not a bash syntax
1 parent e1e96a9 commit f0fd718

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packer/linux/conf/buildkite-agent/hooks/environment

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ if [[ "${DOCKER_USERNS_REMAP:-false}" == "false" ]] ; then
9696
# BUILDKITE_BUILD_PATH="/var/lib/buildkite-agent/builds"
9797

9898
# So we can calculate the suffix as a substring:
99-
AGENT_ORG_PIPELINE_DIR="${BUILDKITE_BUILD_CHECKOUT_PATH#${BUILDKITE_BUILD_PATH}/}"
99+
AGENT_ORG_PIPELINE_DIR="${BUILDKITE_BUILD_CHECKOUT_PATH#"${BUILDKITE_BUILD_PATH}/"}"
100100
# => "my-agent-1/my-org/my-pipeline"
101101

102102
# Then we can grab just the first path component, the agent name, by removing
@@ -105,7 +105,7 @@ if [[ "${DOCKER_USERNS_REMAP:-false}" == "false" ]] ; then
105105
# => "my-agent-1"
106106

107107
# Then we can figure out the org/pipeline path component
108-
ORG_PIPELINE_DIR="${AGENT_ORG_PIPELINE_DIR#${AGENT_DIR}/}"
108+
ORG_PIPELINE_DIR="${AGENT_ORG_PIPELINE_DIR#"${AGENT_DIR}/"}"
109109
# => "my-org/my-pipeline"
110110

111111
# Then we grab just the first path component, the org, by removing the longest
@@ -114,7 +114,7 @@ if [[ "${DOCKER_USERNS_REMAP:-false}" == "false" ]] ; then
114114
# => "my-org"
115115

116116
# Then we can figure out the pipeline path component using the org dir
117-
PIPELINE_DIR="${ORG_PIPELINE_DIR#${ORG_DIR}/}"
117+
PIPELINE_DIR="${ORG_PIPELINE_DIR#"${ORG_DIR}/"}"
118118
# => "my-pipeline"
119119

120120
# Now we can pass this to the sudo script which will validate it before safely chmodding:

0 commit comments

Comments
 (0)