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,
  since it is specific to this repository.
- Updates documentation and this repo's own github action to reflect path
  requirements.
  • Loading branch information
ex-nerd committed Jun 16, 2020
1 parent 3e9e520 commit 17f20c6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Expand Up @@ -25,7 +25,7 @@ jobs:

- uses: ./
with:
data: ./testdata
data: testdata
public-host: "storage.gcs.127.0.0.1.nip.io:4443"
external-url: "https://storage.gcs.127.0.0.1.nip.io:4443"
debug: 1
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -16,7 +16,7 @@ steps:
with:
version: "1.19.4"
backend: memory
data: ./testdata
data: 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
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
22 changes: 15 additions & 7 deletions entrypoint.sh
Expand Up @@ -15,17 +15,25 @@ INPUT_PUBLIC_HOST=$(printenv INPUT_PUBLIC-HOST)
docker_image=fsouza/fake-gcs-server:${INPUT_VERSION}

if [ -n "${INPUT_DATA}" ]; then
if ! [ -d "${INPUT_DATA}" ]; then
if [ -n "${INPUT_DEBUG}" ]; then
echo "INPUT_DATA=${INPUT_DATA}"
echo "RUNNER_WORKSPACE=${RUNNER_WORKSPACE}"
echo "GITHUB_WORKSPACE=${GITHUB_WORKSPACE}"
echo "HOME=${HOME}"
fi

# RUNNER_WORKSPACE won't be populated at this point, so check the directory
# relative to GITHUB_WORKSPACE.
if ! [ -d "${GITHUB_WORKSPACE}/${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}")
# Build a data path
DATA_PATH="${RUNNER_WORKSPACE}${GITHUB_REPOSITORY#$REPOSITORY_OWNER}/${INPUT_DATA}"
echo "$DATA_PATH"
args+=(-data "${DATA_PATH}" )
docker_args+=(--volume "${DATA_PATH}:${DATA_PATH}")
fi

if [ -n "${INPUT_EXTERNAL_URL}" ]; then
Expand Down

0 comments on commit 17f20c6

Please sign in to comment.