File tree 2 files changed +31
-81
lines changed
2 files changed +31
-81
lines changed Original file line number Diff line number Diff line change @@ -37,19 +37,46 @@ runs:
37
37
id : docker-image
38
38
shell : bash
39
39
run : |
40
- echo "::set-output name=value:: ${{ inputs.repository }}:${{ inputs.version }}-${{ inputs.network }}"
40
+ echo "image= ${{ inputs.repository }}:${{ inputs.version }}-${{ inputs.network }}" >> $GITHUB_OUTPUT
41
41
42
42
- name : 📥 Pull Image
43
43
run : |
44
- docker pull ${{ steps.docker-image.outputs.value }}
44
+ docker pull ${{ steps.docker-image.outputs.image }}
45
45
shell : bash
46
46
47
47
- name : ⟲ Sync
48
+ shell : bash
49
+ env :
50
+ OGMIOS_PORT : ${{ inputs.ogmios-port }}
51
+ THRESHOLD : ${{ inputs.synchronization-level }}
48
52
run : |
53
+ set -eo pipefail
49
54
docker run -d --name ${{ inputs.container-name }} -p ${{ inputs.ogmios-port }}:1337 -v ${{ inputs.db-dir }}:/db ${{ steps.docker-image.outputs.value }}
50
55
sleep 3
51
- ./scripts/wait-for-sync.sh ${{ inputs.ogmios-port }} ${{ inputs.synchronization-level }}
52
- shell : bash
56
+ URL=http://localhost:$OGMIOS_PORT/health
57
+ echo "Begin synchronization, target: $THRESHOLD"
58
+ echo ""
59
+ for (( ;; ))
60
+ do
61
+ HEALTH=$(curl -sS $URL)
62
+ NETWORK_SYNCHRONIZATION=$(sed 's/.*"networkSynchronization":\([0-9]\+\.\?[0-9]*\).*/\1/' <<< $HEALTH)
63
+
64
+ RE='^[0-9]+\.?[0-9]*$'
65
+ if ! [[ $NETWORK_SYNCHRONIZATION =~ $RE ]] ; then
66
+ echo "error: unexpected response from /health endpoint: $HEALTH"
67
+ exit 1
68
+ fi
69
+
70
+ echo -e "\rnetwork synchronization: $NETWORK_SYNCHRONIZATION"
71
+ PREDICATE=$(bc <<< "$NETWORK_SYNCHRONIZATION >= $THRESHOLD")
72
+
73
+ if [ "$PREDICATE" -eq 1 ]; then
74
+ exit 0
75
+ else
76
+ sleep 5
77
+ fi
78
+ done
79
+ echo -e "\rDone."
53
80
54
81
- name : 🧹 Cleanup
55
82
run : |
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments