Skip to content

Commit

Permalink
remove hard-coded pathname so test data populates
Browse files Browse the repository at this point in the history
- Removes the hard-coded `fake-gcs-action` part of the `INPUT_DATA` path,
  and moves the path expansion up before the "exists" check.
- Updates documentation and this repo's own github action to reflect path
  requirements.
  • Loading branch information
ex-nerd committed Jun 15, 2020
1 parent 3e9e520 commit f657dee
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ steps:
with:
version: "1.19.4"
backend: memory
data: ./testdata
data: my-project-name/testdata
public-host: "storage.gcs.127.0.0.1.nip.io:4443"
external-url: "https://storage.gcs.127.0.0.1.nip.io:4443"
```
Expand Down
10 changes: 5 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ inputs:
# check the docs for fake-gcs-server at
# https://github.com/fsouza/fake-gcs-server.
backend:
description: "Storage backend for fake-gcs-server"
description: "Storage backend for fake-gcs-server."
required: false
default: "memory"
data:
description: "Optional directory indicating where to load data from. Must be relative to the workspace"
description: "Optional directory indicating where to load data from. Must be relative to the workspace, so make sure actions/checkout runs first."
required: false
default: ""
external-url:
description: "Optional external URL, returned in the Location header for uploads. Defaults to the address where the server is running"
description: "Optional external URL, returned in the Location header for uploads. Defaults to the address where the server is running."
required: false
default: ""
public-host:
description: "Optional hostname to use as the public host for download endpoints"
description: "Optional hostname to use as the public host for download endpoints."
required: false
default: ""
debug:
description: "Set it to true to see server logs after start and more debugging information"
description: "Set it to true to see server logs after start and more debugging information."
required: false
default: ""
runs:
Expand Down
14 changes: 10 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,21 @@ INPUT_PUBLIC_HOST=$(printenv INPUT_PUBLIC-HOST)
docker_image=fsouza/fake-gcs-server:${INPUT_VERSION}

if [ -n "${INPUT_DATA}" ]; then
if [ -n "${INPUT_DEBUG}" ]; then
echo "INPUT_DATA=${INPUT_DATA}"
echo "RUNNER_WORKSPACE=${RUNNER_WORKSPACE}"
# find "$RUNNER_WORKSPACE"
echo "PWD=$(pwd)"
# find .
fi


INPUT_DATA=$(pwd)/${INPUT_DATA}
if ! [ -d "${INPUT_DATA}" ]; then
echo "ERROR: input data should be a directory. Make sure it exists and is specified as a relative path" >&2
exit 2
fi

if [ -n "${INPUT_DEBUG}" ]; then
echo "RUNNER_WORKSPACE=${RUNNER_WORKSPACE}"
fi
INPUT_DATA=${RUNNER_WORKSPACE}/fake-gcs-action/${INPUT_DATA}
args+=(-data "${INPUT_DATA}" )
docker_args+=(--volume "${INPUT_DATA}:${INPUT_DATA}")
fi
Expand Down

0 comments on commit f657dee

Please sign in to comment.