Actualiser action.yaml

This commit is contained in:
2025-04-14 08:41:32 +02:00
parent 35d4a20d11
commit 9bd2092c81

View File

@@ -1,69 +1,32 @@
name: 'Ping a Healthchecks.io server' name: 'Connect to a docker registry'
description: 'Description de l action' description: 'Connection to a docker registry using podman'
author: 'Eric Coissac' author: 'Eric Coissac'
inputs: inputs:
server: registry_server:
description: 'Address of the Healthchecks server' description: 'Address of the image registry server'
required: true
uuid:
description: 'Deuxième paramètre'
required: true
command:
description: 'Command to sen to the server can be nothing, start, log or fail'
required: false required: false
default: 'stop' default: "niepce.petite-maison-orange.fr"
message: registry_user:
description: 'Message to log with the ping' description: 'User used for the connection to the image registry'
required: false required: false
default: '' default: ${{ secrets.PMO_REGISTRY_USER }}
registry_password:
description: 'Password used for the connection to the image registry'
required: false
default: ${{ secrets.PMO_REGISTRY_PASSWORD }}
runs: runs:
using: 'composite' using: 'composite'
steps: steps:
- name: Ping the server - name: Podman connection to the registry
shell: bash shell: bash
run: | run: |
HEALTHPOINT="${{ inputs.server }}/ping/${{ inputs.uuid }}" echo -e "Connection to registry: ${{ inputs.registry_server }}...\c"
OPTIONS="-fsS -m 10 --retry 5" podman login ${{ inputs.registry_server }} \
MESSAGE="${{ inputs.message }}" -u ${{ inputs.registry_user }} \
COMMAND="${{ inputs.command }}" -p ${{ inputs.registry_password }} \
&& echo " Done."
CURL_DATA=()
if [[ -n "$MESSAGE" ]]; then
CURL_DATA+=(--data-raw "$MESSAGE")
fi
case "$COMMAND" in
start|log|fail)
URL="${HEALTHPOINT}/$COMMAND"
;;
stop)
URL="${HEALTHPOINT}"
;;
*)
echo "::error::Commande invalide: $COMMAND"
exit 1
;;
esac
curl_cmd=(
curl
$OPTIONS
"${CURL_DATA[@]}"
"$URL"
)
echo "Commande exécutée: ${curl_cmd[*]}"
"${curl_cmd[@]}" # Exécution sans eval
if [[ "$COMMAND" == "fail" ]] ; then
exit 1
fi
exit 0