Skip to content

feat(entrypoint): add support for RUNNER_LABELS env var#540

Merged
myoung34 merged 1 commit intomyoung34:masterfrom
lauralex:patch-1
Jan 16, 2026
Merged

feat(entrypoint): add support for RUNNER_LABELS env var#540
myoung34 merged 1 commit intomyoung34:masterfrom
lauralex:patch-1

Conversation

@lauralex
Copy link
Contributor

@lauralex lauralex commented Jan 16, 2026

Summary

This PR updates the entrypoint.sh script to check for the RUNNER_LABELS environment variable before falling back to LABELS or the default value.

Motivation

The official Actions Runner Controller (ARC) Helm charts inject runner labels using the environment variable RUNNER_LABELS, whereas this image currently expects LABELS.

By prioritizing RUNNER_LABELS, we improve compatibility for users attempting to use this Docker image with the official ARC deployment manifests without needing to manually map environment variables.

Changes

  • Modified entrypoint.sh to set _LABELS using the logic: RUNNER_LABELS -> LABELS -> default.

Testing

  • Verified that passing RUNNER_LABELS correctly sets the runner labels.
  • Verified that passing LABELS (legacy method) still works as a fallback.
  • Verified that omitting both still results in default.

This is to improve compatibility with the helm chart provided at the official ARC repository
@lauralex
Copy link
Contributor Author

Successful tests:

image

Tests script:

#!/bin/bash

# 1. Create a dummy script representing the logic in your entrypoint.sh
# We are testing specifically this line: _LABELS=${RUNNER_LABELS:-${LABELS:-default}}
cat << 'EOF' > mock_entrypoint.sh
#!/bin/bash
_LABELS=${RUNNER_LABELS:-${LABELS:-default}}
echo "$_LABELS"
EOF

chmod +x mock_entrypoint.sh

# Helper function to print results
check_result() {
    TEST_NAME=$1
    EXPECTED=$2
    ACTUAL=$3

    if [ "$ACTUAL" == "$EXPECTED" ]; then
        echo -e "✅ \033[0;32mPASS: $TEST_NAME\033[0m (Got: '$ACTUAL')"
    else
        echo -e "❌ \033[0;31mFAIL: $TEST_NAME\033[0m"
        echo "   Expected: '$EXPECTED'"
        echo "   Got:      '$ACTUAL'"
    fi
}

echo "--- Starting Tests ---"

# --- SCENARIO 1: RUNNER_LABELS is set (Should take priority) ---
# Input: RUNNER_LABELS="priority-label", LABELS="legacy-label"
export RUNNER_LABELS="priority-label"
export LABELS="legacy-label"
RESULT=$(./mock_entrypoint.sh)
check_result "Scenario 1 (RUNNER_LABELS set)" "priority-label" "$RESULT"

# Cleanup vars
unset RUNNER_LABELS
unset LABELS

# --- SCENARIO 2: RUNNER_LABELS is unset, LABELS is set (Legacy fallback) ---
# Input: RUNNER_LABELS=(unset), LABELS="legacy-label"
export LABELS="legacy-label"
RESULT=$(./mock_entrypoint.sh)
check_result "Scenario 2 (LABELS fallback)" "legacy-label" "$RESULT"

# Cleanup vars
unset RUNNER_LABELS
unset LABELS

# --- SCENARIO 3: Both are unset (Default fallback) ---
# Input: RUNNER_LABELS=(unset), LABELS=(unset)
RESULT=$(./mock_entrypoint.sh)
check_result "Scenario 3 (Default fallback)" "default" "$RESULT"

echo "--- Tests Complete ---"

# Cleanup the mock file
rm mock_entrypoint.sh

@myoung34
Copy link
Owner

Thanks, seems good

@myoung34 myoung34 merged commit 2e8e19f into myoung34:master Jan 16, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants