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
11 changes: 11 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,14 @@ jobs:

- name: Lint action.yml
run: yamllint -d relaxed action.yml

smoke:
runs-on: blacksmith
steps:
- uses: actions/checkout@v4

- name: Assert BLACKSMITH_AGENT_ADDR is advertised
run: test -n "$BLACKSMITH_AGENT_ADDR"

- name: Run begin-testbox in validation mode
uses: ./
11 changes: 8 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: 'Begin Testbox'
description: 'Initialize a Blacksmith Testbox session. Phones home to receive config, installs SSH key and rsync.'

Check warning on line 2 in action.yml

View workflow job for this annotation

GitHub Actions / validate

2:81 [line-length] line too long (114 > 80 characters)

inputs:
testbox_id:
description: 'Testbox session ID (from workflow_dispatch input). Leave empty for validation mode.'

Check warning on line 6 in action.yml

View workflow job for this annotation

GitHub Actions / validate

6:81 [line-length] line too long (102 > 80 characters)
required: false
default: ''
api_url:
description: 'Override the backend API URL (default: discovered from VM metadata)'

Check warning on line 10 in action.yml

View workflow job for this annotation

GitHub Actions / validate

10:81 [line-length] line too long (86 > 80 characters)
required: false

runs:
Expand All @@ -17,25 +17,30 @@
shell: bash
run: |
if [ -z "${{ inputs.testbox_id }}" ]; then
echo "::notice::Running in validation mode — setup steps will be validated without starting a testbox session."

Check warning on line 20 in action.yml

View workflow job for this annotation

GitHub Actions / validate

20:81 [line-length] line too long (121 > 80 characters)
fi

- name: Discover metadata service
id: metadata
shell: bash
run: |
if [ -z "${BLACKSMITH_AGENT_ADDR:-}" ]; then
echo "::warning::BLACKSMITH_AGENT_ADDR is not set; testbox is only supported on Blacksmith runners. Skipping testbox setup."

Check warning on line 28 in action.yml

View workflow job for this annotation

GitHub Actions / validate

28:81 [line-length] line too long (134 > 80 characters)
echo "available=false" >> "$GITHUB_OUTPUT"
exit 0
fi
METADATA_PORT="${METADATA_PORT:-}"
if [ -z "$METADATA_PORT" ]; then
METADATA_PORT=$(cat /proc/cmdline | tr ' ' '\n' | grep '^metadata_port=' | cut -d'=' -f2)
METADATA_PORT=$(tr ' ' '\n' < /proc/cmdline | grep '^metadata_port=' | cut -d'=' -f2 || true)

Check warning on line 34 in action.yml

View workflow job for this annotation

GitHub Actions / validate

34:81 [line-length] line too long (103 > 80 characters)
if [ -z "$METADATA_PORT" ]; then
echo "metadata_port not found in kernel cmdline"
echo "::warning::metadata_port not found in kernel cmdline; testbox is only supported on Blacksmith runners. Skipping testbox setup."

Check warning on line 36 in action.yml

View workflow job for this annotation

GitHub Actions / validate

36:81 [line-length] line too long (145 > 80 characters)
echo "available=false" >> "$GITHUB_OUTPUT"
exit 0
fi
export METADATA_PORT
fi
echo "available=true" >> "$GITHUB_OUTPUT"
echo "metadata_addr=192.168.127.1:${METADATA_PORT}" >> "$GITHUB_OUTPUT"
Comment thread
cursor[bot] marked this conversation as resolved.
echo "metadata_addr=${BLACKSMITH_AGENT_ADDR}:${METADATA_PORT}" >> "$GITHUB_OUTPUT"

Check warning on line 43 in action.yml

View workflow job for this annotation

GitHub Actions / validate

43:81 [line-length] line too long (90 > 80 characters)

- name: Phone home and configure testbox
if: steps.metadata.outputs.available == 'true' && inputs.testbox_id
Expand All @@ -49,11 +54,11 @@
mkdir -p "$STATE"
chmod 700 "$STATE"

INSTALLATION_MODEL_ID=$(curl -s --connect-timeout 2 --max-time 5 "http://${METADATA_ADDR}/installationModelID")

Check warning on line 57 in action.yml

View workflow job for this annotation

GitHub Actions / validate

57:81 [line-length] line too long (119 > 80 characters)
if [ -n "$API_URL_OVERRIDE" ]; then
API_URL="$API_URL_OVERRIDE"
else
API_URL=$(curl -s --connect-timeout 2 --max-time 5 "http://${METADATA_ADDR}/backendURL")

Check warning on line 61 in action.yml

View workflow job for this annotation

GitHub Actions / validate

61:81 [line-length] line too long (98 > 80 characters)
fi

# Piggyback on the VM's stickyDiskToken for phone-home authentication.
Expand Down
Loading