File tree Expand file tree Collapse file tree
github-actions/healthcheck Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ Tools which are commonly used by other JORE4 projects
88
99- [ Tools for Docker] ( #tools-for-docker )
1010 - [ read-secrets.sh] ( #read-secretssh )
11+ - [ Github Actions] ( #github-actions )
12+ - [ Healthcheck] ( #healthcheck )
1113
1214<!-- END doctoc generated TOC please keep comment here to allow auto update -->
1315
@@ -54,3 +56,25 @@ RUN curl -o /tmp/read-secrets.sh "https://raw.githubusercontent.com/HSLdevcom/jo
5456# read docker secrets into environment variables and run application
5557CMD /bin/bash -c "source /tmp/read-secrets.sh && java -jar /.../xxx.jar"
5658```
59+
60+ ## Github Actions
61+
62+ ### Healthcheck
63+
64+ Runs a user-defined script to check whether a service is up and running
65+
66+ Parameters:
67+
68+ - retries: How many times to retry the healthcheck script before it fails
69+ (default: 20)
70+ - wait_between: How many seconds to wait in between retries (default: 5)
71+ - command: User-defined command for checking health of a service (required)
72+
73+ Example usage:
74+
75+ ```
76+ steps:
77+ - uses: HSLdevcom/jore4-tools/github-actions/healthcheck@healthcheck-v1
78+ with:
79+ command: "curl --fail http://localhost:3200/actuator/health --output /dev/null --silent"
80+ ```
Original file line number Diff line number Diff line change 1+ name : " Run healthcheck"
2+ description :
3+ " Runs a user-defined command line script to see whether a service is up and
4+ running"
5+ inputs :
6+ retries :
7+ description : How many times to retry the healthcheck script before it fails
8+ required : false
9+ default : 20
10+ wait_between :
11+ description : How many seconds to wait in between retries
12+ required : false
13+ default : 5
14+ command :
15+ description : User-defined command for checking health
16+ required : true
17+
18+ runs :
19+ using : " composite"
20+ steps :
21+ - name : Verify that service is up and running
22+ run : |
23+ for i in {1..${{ inputs.retries }}}; do
24+ ${{ inputs.command }} && exit 0
25+ sleep ${{ inputs.wait_between }}
26+ echo $i
27+ done
28+ exit 1
29+ shell : bash
You can’t perform that action at this time.
0 commit comments