summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2023-08-12 02:50:17 -0400
committerMalfurious <m@lfurio.us>2023-08-12 02:50:17 -0400
commit99045bf64cf136df3c0d7d3775a64cc41268a0ed (patch)
tree32e02ba80b553ce9ff3129a9c817bd3d11832108
parent354a69223d1e9132cd73f32fee48eb56cd1ec20f (diff)
downloadcychedelic-99045bf64cf136df3c0d7d3775a64cc41268a0ed.tar.gz
cychedelic-99045bf64cf136df3c0d7d3775a64cc41268a0ed.zip
acid: build: Fix bug in cychedelic project-name generation
The nested single quotes in these variables were not being interpreted correctly at their usage locations (the quoted project name was being sent to the docker cli). The quotes were initially wanted for the case where there is not yet any previous_slug, as the command "docker compose --project-name down" is ill-formed. Since we know the actual slug values will not contain spaces, we can do away with the quotes. Instead, prevent $prev from containing any content in the special case described above. This is accomplished by the conditional check [ -n "$prev" ]. Signed-off-by: Malfurious <m@lfurio.us>
-rwxr-xr-xacid/cyche-build6
1 files changed, 4 insertions, 2 deletions
diff --git a/acid/cyche-build b/acid/cyche-build
index 586e230..4239340 100755
--- a/acid/cyche-build
+++ b/acid/cyche-build
@@ -25,9 +25,11 @@
cd "/services/$1"
if [ "$3" == "--self" ]; then
+ prev=$(cat '.git/previous_slug')
+ [ -n "$prev" ] && prev="--project-name $prev"
+
slug=$(echo -n "$1-"; tr -dc a-z </dev/urandom | head -c 12)
- prev="--project-name '$(cat '.git/previous_slug')'"
- next="--project-name '$slug'"
+ next="--project-name $slug"
fi
docker compose $next pull