Skip to content

Commit 5fea030

Browse files
committed
Include PostgeSQL into Docker health check
1 parent 658ed89 commit 5fea030

File tree

1 file changed

+15
-13
lines changed
  • .github/workflows/docker-inspect-health-check

1 file changed

+15
-13
lines changed

.github/workflows/docker-inspect-health-check/action.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,30 @@ runs:
1313
shell: pwsh
1414
run: |
1515
# Script (Wait Status -> Healthy)
16-
$oracleHealth=""
1716
$msSQLHealth=""
1817
$mySQLHealth=""
18+
$oracleHealth=""
19+
$postgreSQLHealth=""
1920
$status="healthy"
2021
$allHealthy=$false
2122
$retry=1
2223
do {
23-
$oracleHealth = (docker inspect --format="{{json .State.Health.Status}}" oracle-db).Replace('"', '')
24-
$msSQLHealth = (docker inspect --format="{{json .State.Health.Status}}" mssql-db).Replace('"', '')
25-
$mySQLHealth = (docker inspect --format="{{json .State.Health.Status}}" mysql-db).Replace('"', '')
26-
if (($oracleHealth -ne $status) -or ($msSQLHealth -ne $status) -or ($mySQLHealth -ne $status)) {
27-
Start-Sleep -Seconds 10
28-
$retry ++
29-
} else {
30-
$allHealthy=$true
31-
break
32-
}
24+
$msSQLHealth = (docker inspect --format="{{json .State.Health.Status}}" mssql-db).Replace('"', '')
25+
$mySQLHealth = (docker inspect --format="{{json .State.Health.Status}}" mysql-db).Replace('"', '')
26+
$oracleHealth = (docker inspect --format="{{json .State.Health.Status}}" oracle-db).Replace('"', '')
27+
$postgreSQLHealth = (docker inspect --format="{{json .State.Health.Status}}" postgres-db).Replace('"', '')
28+
if (($msSQLHealth -ne $status) -or ($mySQLHealth -ne $status) -or ($oracleHealth -ne $status) -or ($postgreSQLHealth -ne $status)) {
29+
Start-Sleep -Seconds 10
30+
$retry ++
31+
} else {
32+
$allHealthy=$true
33+
break
34+
}
3335
} while ($retry -le 6)
3436
if ($allHealthy -eq $true) {
35-
Write-Host "All DB Containers Healthy ==> [ oracle-db (Status) -> '$oracleHealth' ] | [ mssql-db (Status) -> '$msSQLHealth' ] | [ mysql-db (Status) -> '$mySQLHealth' ]"
37+
Write-Host "All DB Containers Healthy ==> [ mssql-db (Status) -> '$msSQLHealth' ] | [ mysql-db (Status) -> '$mySQLHealth' ] | [ oracle-db (Status) -> '$oracleHealth' ] | [ postgres-db (Status) -> '$postgreSQLHealth' ]"
3638
} else {
37-
Write-Host "DB Container/s Not Healthy ==> [ oracle-db (Status) -> '$oracleHealth' ] | [ mssql-db (Status) -> '$msSQLHealth' ] | [ mysql-db (Status) -> '$mySQLHealth' ]"
39+
Write-Host "DB Container/s Not Healthy ==> [ mssql-db (Status) -> '$msSQLHealth' ] | [ mysql-db (Status) -> '$mySQLHealth' ] | [ oracle-db (Status) -> '$oracleHealth' ] | [ postgres-db (Status) -> '$postgreSQLHealth' ]"
3840
exit 1
3941
}
4042

0 commit comments

Comments
 (0)