Skip to content

Commit

Permalink
fix: argument expansion in bash wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
acodeninja committed Nov 19, 2024
1 parent 601219d commit dbe0259
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 5 deletions.
2 changes: 1 addition & 1 deletion graphviz/buildpack.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ api = "0.8"
[buildpack]
id = "acodeninja/graphviz"
name = "ACodeNinja Buildpack for Graphviz"
version = "1.0.0"
version = "1.0.1"
homepage = "https://github.com/acodeninja/buildpacks/graphviz"

[[buildpack.licenses]]
Expand Down
2 changes: 1 addition & 1 deletion graphviz/wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ LD_LIBRARY_PATH="{{range $val := .LibLocations}}{{$val}}:{{end}}$LD_LIBRARY_PATH
LIBRARY_PATH="{{range $val := .LibLocations}}{{$val}}:{{end}}$LD_LIBRARY_PATH" \
FONTCONFIG_PATH="{{.FontConfigLocation}}" \
GVBINDIR="{{.GraphvizBinDir}}" \
{{.Command}} $@
{{.Command}} "$@"
2 changes: 1 addition & 1 deletion psql/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ test: test-bash
.PHONY: test-bash
test-bash: package
@cd fixtures/bash && pack build --clear-cache test-psql-bash
@docker run --rm --platform linux/amd64 --entrypoint test test-psql-bash
@cd fixtures/bash && docker-compose up --abort-on-container-exit
2 changes: 1 addition & 1 deletion psql/buildpack.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ api = "0.8"
[buildpack]
id = "acodeninja/psql"
name = "ACodeNinja Buildpack for PostgreSQL client"
version = "1.1.1"
version = "1.1.2"
homepage = "https://github.com/acodeninja/buildpacks/tree/main/psql"

[[buildpack.licenses]]
Expand Down
13 changes: 13 additions & 0 deletions psql/fixtures/bash/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
services:
app:
image: test-psql-bash
entrypoint: test
environment:
DATABASE_URL: postgresql://postgres:example@database:5432/postgres
links:
- database

database:
image: postgres:latest
environment:
POSTGRES_PASSWORD: example
10 changes: 10 additions & 0 deletions psql/fixtures/bash/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ for COMMAND_TO_TEST in $COMMANDS_TO_TEST; do
run_test "$COMMAND_TO_TEST server" "$COMMAND_TO_TEST --version" "PostgreSQL"
done

QUERY_OUTPUT="$(psql "$DATABASE_URL" -c "SELECT datname FROM pg_database;")"

if [[ "$QUERY_OUTPUT" =~ "template1" ]]; then
echo "[psql][run query]: passed 🟢"
else
echo "[psql][run query]: failed 🔴"
diff <(echo "$QUERY_OUTPUT" ) <(echo "$QUERY_EXPECTED")
TESTS_FAILED="yes"
fi

if [[ -z "$TESTS_FAILED" ]]
then
exit 0
Expand Down
2 changes: 1 addition & 1 deletion psql/wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ PATH="{{.PostgresClientPath}}:$PATH"
LD_LIBRARY_PATH="{{range $val := .LibLocations}}{{$val}}:{{end}}$LD_LIBRARY_PATH"
LIBRARY_PATH="{{range $val := .LibLocations}}{{$val}}:{{end}}$LD_LIBRARY_PATH"

{{.PostgresCommand}} $@
{{.PostgresCommand}} "$@"

0 comments on commit dbe0259

Please sign in to comment.