Skip to content

Commit

Permalink
feat: use ECS task ID as runner name
Browse files Browse the repository at this point in the history
  • Loading branch information
micdes-pagopa committed Nov 30, 2022
1 parent 1f2dd9e commit c4c5073
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,17 @@ if [ "$(echo $REPLACE_EXISTING_RUNNER | tr '[:upper:]' '[:lower:]')" == "true" ]
REPLACEMENT_POLICY_LABEL="TRUE"
fi

ECS_TASK_ID=$(curl -s "${ECS_CONTAINER_METADATA_URI_V4}/task" \
| jq -r ".TaskARN" \
| cut -d "/" -f 3)

# Configure runner interactively, or with the given replacement policy.
printf "Configuring GitHub Runner for $GITHUB_REPOSITORY_BANNER\n"
printf "\tRunner Name: $RUNNER_NAME\n\tWorking Directory: $WORK_DIR\n\tReplace Existing Runners: $REPLACEMENT_POLICY_LABEL\n"
if [ "$INTERACTIVE" == "FALSE" ]; then
echo -ne "$REPLACEMENT_POLICY" | ./actions-runner/config.sh --url $GITHUB_REPOSITORY --token $GITHUB_TOKEN --agent $RUNNER_NAME --work $WORK_DIR
echo -ne "$REPLACEMENT_POLICY" | ./actions-runner/config.sh --name $ECS_TASK_ID --url $GITHUB_REPOSITORY --token $GITHUB_TOKEN --agent $RUNNER_NAME --work $WORK_DIR
else
./actions-runner/config.sh --url $GITHUB_REPOSITORY --token $GITHUB_TOKEN --agent $RUNNER_NAME --work $WORK_DIR
./actions-runner/config.sh --name $ECS_TASK_ID --url $GITHUB_REPOSITORY --token $GITHUB_TOKEN --agent $RUNNER_NAME --work $WORK_DIR
fi

# Start the runner.
Expand Down

0 comments on commit c4c5073

Please sign in to comment.