diff --git a/action.yml b/action.yml index 8b7d95f..76d8605 100644 --- a/action.yml +++ b/action.yml @@ -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 \ -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 @@ -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