Skip to content
Merged
Show file tree
Hide file tree
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
44 changes: 44 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,47 @@ jobs:
exit 1
fi

traceurl:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- name: "TraceURL with cloud-token"
id: traceurl-token
uses: ./
with:
version: latest
verb: core
args: version
cloud-token: dag_dagger_sBIv6DsjNerWvTqt2bSFeigBUqWxp9bhh3ONSSgeFnw
- name: "Check traceURL output (should be set)"
run: |
url='${{ steps.traceurl-token.outputs.traceURL }}'
if [[ "$url" =~ ^https://dagger.cloud/.+/traces/.+ ]]; then
echo "traceURL found: $url"
exit 0
else
echo "traceURL not found"
exit 1
fi
- name: "TraceURL without cloud-token"
id: traceurl-nil
uses: ./
with:
version: latest
verb: core
args: version
- name: "Check traceURL output (should NOT be set)"
run: |
url='${{ steps.traceurl-nil.outputs.traceURL }}'
if [[ "$url" =~ ^https://dagger.cloud/traces/setup ]]; then
echo "traceURL correctly not set"
exit 0
else
echo "traceURL was set: $url"
exit 1
fi


version:
runs-on: "ubuntu-latest"
steps:
Expand Down Expand Up @@ -156,6 +197,7 @@ jobs:
echo "does not match"
exit 1
fi

call:
runs-on: "ubuntu-latest"
steps:
Expand All @@ -176,6 +218,7 @@ jobs:
echo "does not match"
exit 1
fi

nocall:
runs-on: "ubuntu-latest"
steps:
Expand All @@ -185,3 +228,4 @@ jobs:
- name: "Test Install"
run: |
dagger core version

12 changes: 11 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ outputs:
output:
description: "Job output"
value: ${{ steps.exec.outputs.stdout }}
traceURL:
description: "Dagger Cloud trace URL"
value: ${{ steps.exec.outputs.traceURL }}
runs:
using: "composite"
steps:
Expand Down Expand Up @@ -79,13 +82,14 @@ runs:
INPUT_MODULE: ${{ inputs.module }}
run: |
tmpout=$(mktemp)
tmperr=$(mktemp)
cd ${{ inputs.workdir }} && { \
DAGGER_CLOUD_TOKEN=${{ inputs.cloud-token }} \
dagger \
${{ inputs.dagger-flags }} \
${{ inputs.verb }} \
${INPUT_MODULE:+-m $INPUT_MODULE} \
${{ inputs.args || inputs.call }}; } | tee "${tmpout}"
${{ inputs.args || inputs.call }}; } 1> >(tee "${tmpout}") 2> >(tee "${tmperr}" >&2)

{
# we need a delim that doesn't appear in the output - a hash of the
Expand All @@ -98,6 +102,12 @@ runs:
echo "${delim}"
} >> "$GITHUB_OUTPUT"

# Extract trace URL from stderr and set as traceURL output
trace_url=$((grep -Eo 'https://dagger.cloud(/[^ ]+/traces/[a-zA-Z0-9]+|/traces/setup)' "${tmperr}" || true) | head -n1)
if [[ -n "$trace_url" ]]; then
echo "traceURL=$trace_url" >> "$GITHUB_OUTPUT"
fi

- if: (inputs.call != '' || inputs.args != '') && inputs.engine-stop == 'true'
shell: bash
run: |
Expand Down