Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ runs:
shell: bash
run: |
# write google application credentials to a temporary file to be used inside the container
mkdir -p /tmp/gce-cloudsql-proxy
echo '${{ inputs.creds }}' > /tmp/gce-cloudsql-proxy/key.json
TMPDIR=$(mktemp -d)
echo '${{ inputs.creds }}' > $TMPDIR/key.json

# start container
docker run -d --net host --name gce-cloudsql-proxy --restart on-failure \
-v /tmp/gce-cloudsql-proxy:/tmp/gce-cloudsql-proxy \
CONTAINER=$(docker run -d --net host --restart on-failure \
-v $TMPDIR:/tmp/gce-cloudsql-proxy \
gcr.io/cloudsql-docker/gce-proxy:${{ inputs.proxy_version }} \
/cloud_sql_proxy \
-credential_file /tmp/gce-cloudsql-proxy/key.json \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe for this to work, /tmp/gce-cloudsql-proxy/key.json should be $TMPDIR/key.json otherwise it tries to find the key.json file in the wrong place.

As is, I'm getting the error: invalid json file "/tmp/gce-cloudsql-proxy/key.json": open /tmp/gce-cloudsql-proxy/key.json: permission denied

-dir /tmp \
-instances=${{ inputs.instance }}=tcp:127.0.0.1:${{ inputs.port }}
-instances=${{ inputs.instance }}=tcp:127.0.0.1:${{ inputs.port }})

# wait until connections are accepted
sleep 3
Expand All @@ -54,7 +54,7 @@ runs:
done

# print container logs
docker logs gce-cloudsql-proxy
docker logs $CONTAINER

# exit with error code if we couldn't connect
if [[ $isready -ne 0 ]]; then
Expand Down