mirror of
https://github.com/actions/actions-runner-controller.git
synced 2025-12-31 06:17:32 +08:00
feat: allow to discover runner statuses (#1268)
* feat: allow to discover runner statuses * fix manifests * Bump runner version to 2.289.1 which includes the hooks support * Add feedback from review * Update reference to newRunnerPod * Fix TestNewRunnerPodFromRunnerController and make hooks file names job specific * Fix additional TestNewRunnerPod test * Cover additional feedback from review * fix rbac manager role * Add permissions to service account for container mode if not provided * Rename flag to runner.statusUpdateHook.enabled and fix needsServiceAccount Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
This commit is contained in:
committed by
GitHub
parent
10b88bf070
commit
11cb9b7882
31
runner/update-status
Executable file
31
runner/update-status
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
if [[ ${1:-} == '' ]]; then
|
||||
# shellcheck source=runner/logger.bash
|
||||
source logger.bash
|
||||
log.error "Missing required argument -- '<phase>'"
|
||||
exit 64
|
||||
fi
|
||||
|
||||
if [[ ${RUNNER_STATUS_UPDATE_HOOK:-false} == true ]]; then
|
||||
|
||||
apiserver=https://${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT_HTTPS}
|
||||
serviceaccount=/var/run/secrets/kubernetes.io/serviceaccount
|
||||
namespace=$(cat ${serviceaccount}/namespace)
|
||||
token=$(cat ${serviceaccount}/token)
|
||||
phase=$1
|
||||
shift
|
||||
|
||||
jq -n --arg phase "$phase" --arg message "${*:-}" '.status.phase = $phase | .status.message = $message' | curl \
|
||||
--cacert ${serviceaccount}/ca.crt \
|
||||
--data @- \
|
||||
--noproxy '*' \
|
||||
--header "Content-Type: application/merge-patch+json" \
|
||||
--header "Authorization: Bearer ${token}" \
|
||||
--show-error \
|
||||
--silent \
|
||||
--request PATCH \
|
||||
"${apiserver}/apis/actions.summerwind.dev/v1alpha1/namespaces/${namespace}/runners/${HOSTNAME}/status"
|
||||
1>&-
|
||||
fi
|
||||
Reference in New Issue
Block a user