-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a9fdbeb
Showing
4 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM alpine:latest | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
ENTRYPOINT [ "/entrypoint.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Wait-for-isanteplus Github Action | ||
|
||
This action prints "Hello World" or "Hello" + the name of a person to greet to the log. | ||
|
||
## Inputs | ||
|
||
## `target-url` | ||
|
||
**Required** | ||
|
||
## `interval` | ||
|
||
**Required** | ||
## `timeout` | ||
|
||
**Required** | ||
## Example usage | ||
|
||
uses: actions/action-wait-for-isanteplus@v1 | ||
with: | ||
target-url: http://localhost:8080/openmrs | ||
timeout: 1000 | ||
interval: 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# action.yml | ||
name: 'Wait For iSantePlus' | ||
description: 'Wait for iSantePlus to be fully up' | ||
inputs: | ||
target-url: | ||
description: 'Where iSantePlus is running' | ||
required: true | ||
default: 'http://localhost:8080/openmrs' | ||
interval: | ||
description: 'How often to check status in ms' | ||
required: true | ||
default: '1000' | ||
timeout: | ||
description: 'How long to try for in ms' | ||
required: true | ||
default: '1000000' | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
args: | ||
- ${{ inputs.target-url }} | ||
- ${{ inputs.interval }} | ||
- ${{ inputs.timeout }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
|
||
url=$1 | ||
interval=$2 | ||
timeout=$3 | ||
|
||
TIMEOUT_END=$(($(date +%s) + $timeout)) | ||
|
||
|
||
while :; do | ||
echo "Waiting for $1" | ||
|
||
response=$(curl -u admin:Admin123 -s -w "\n%{http_code}" $url/ws/fhir2/R4/metadata?_format=json) | ||
response=(${response[@]}) # convert to array | ||
code=${response[-1]} # get last element (last line) | ||
|
||
echo $code | ||
|
||
body=${response[@]::${#response[@]}-1} # get all elements except last | ||
|
||
if [[ "${body[0]}" == *"CapabilityStatement"* ]]; then | ||
echo "Got Metadata!" | ||
exit 0 | ||
else | ||
echo "Still waiting..." | ||
fi | ||
|
||
if [ $(date +%s) -ge $TIMEOUT_END ]; then | ||
echo "Operation timed out!" | ||
exit 1 | ||
fi | ||
|
||
sleep $interval | ||
done |