Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install binary to a less permissive location by default #105

Merged
merged 3 commits into from
Dec 30, 2023
Merged
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
18 changes: 14 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,23 @@ runs:
using: "composite"
steps:
- run: |
cd /usr/local && { \
# Fallback to /usr/local for backwards compatability
prefix_dir="${RUNNER_TEMP:-/usr/local}"
# Ensure the dir is writable otherwise fallback to tmpdir
if [[ ! -d "$prefix_dir" ]] || [[ ! -w "$prefix_dir" ]]; then
prefix_dir="$(mktemp -d)"
fi
printf '%s/bin' "$prefix_dir" >> $GITHUB_PATH
# The install.sh script creates path ${prefix_dir}/bin
cd "$prefix_dir" && { \
curl -sL https://dl.dagger.io/dagger/install.sh 2>/dev/null | \
DAGGER_VERSION=${{ inputs.version }} sh 2>/dev/null; }
DAGGER_VERSION=${{ inputs.version }} sh; }
shell: bash

- run: |
cd ${{ inputs.workdir }} && { \
DAGGER_CLOUD_TOKEN=${{ inputs.cloud-token }} \
/usr/local/bin/dagger \
dagger \
${{ inputs.dagger-flags }} \
${{ inputs.verb }} \
${INPUT_MODULE:+-m $INPUT_MODULE} \
Expand All @@ -50,6 +58,8 @@ runs:
env:
INPUT_MODULE: ${{ inputs.module }}

- run: docker stop -t 300 $(docker ps --filter name="dagger-engine-*" -q)
- run: |
mapfile -t containers < <(docker ps --filter name="dagger-engine-*" -q)
docker stop -t 300 "${containers[@]}"
shell: bash
if: ${{ always() }}