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'
description: 'Description de l action'
name: 'Connect to a docker registry'
description: 'Connection to a docker registry using podman'
author: 'Eric Coissac'
inputs:
server:
description: 'Address of the Healthchecks 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'
registry_server:
description: 'Address of the image registry server'
required: false
default: 'stop'
message:
description: 'Message to log with the ping'
default: "niepce.petite-maison-orange.fr"
registry_user:
description: 'User used for the connection to the image registry'
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:
using: 'composite'
steps:
- name: Ping the server
- name: Podman connection to the registry
shell: bash
run: |
HEALTHPOINT="${{ inputs.server }}/ping/${{ inputs.uuid }}"
OPTIONS="-fsS -m 10 --retry 5"
MESSAGE="${{ inputs.message }}"
COMMAND="${{ inputs.command }}"
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
echo -e "Connection to registry: ${{ inputs.registry_server }}...\c"
podman login ${{ inputs.registry_server }} \
-u ${{ inputs.registry_user }} \
-p ${{ inputs.registry_password }} \
&& echo " Done."