Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ci): handle disk mounting and logs reading edge-cases #7690

Merged
merged 24 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
cce1a9b
fix: use `exit-nopipe` with consistent `shell` usage
gustavovalverde Oct 8, 2023
3a5cb98
fix: Use single quotes for the outer command
gustavovalverde Oct 8, 2023
01da33c
fix: use same approach for CD
gustavovalverde Oct 8, 2023
8c45ee5
test: check launch failure logs
gustavovalverde Oct 8, 2023
e50e1c1
fix: revert CD changes
gustavovalverde Oct 8, 2023
f5c86bc
fix: do not try to increase the disk size and wait mounting
gustavovalverde Oct 8, 2023
3cd241e
fix: increase GB a bit more
gustavovalverde Oct 8, 2023
0ece511
fix: do not fail on pipe failure
gustavovalverde Oct 8, 2023
92bed95
fix: use plain `tee /dev/stderr`
gustavovalverde Oct 9, 2023
e22166b
fix: `tee` not stoping on cd config tests
gustavovalverde Oct 9, 2023
a6ff4d6
fix: match logic with GCP tests
gustavovalverde Oct 9, 2023
674a5b3
fix(cd): handle pipe and other errors correctly
gustavovalverde Oct 9, 2023
0450a0d
try `tee --output-error=exit-nopipe`
gustavovalverde Oct 9, 2023
b1a99bc
fix: TRAP without pipefail
gustavovalverde Oct 9, 2023
048e487
test: pipefail with exit and trap
gustavovalverde Oct 9, 2023
406c1e0
fix: use a subshell
gustavovalverde Oct 9, 2023
0264324
fix(ci): wait for mounting and show system logs if fail
gustavovalverde Oct 9, 2023
877ab47
fix(ci): GCP is not always mounting disks in the same order
gustavovalverde Oct 9, 2023
da47abc
fix: use `grep` instead of `awk`
gustavovalverde Oct 9, 2023
3a6a549
fix: typo
gustavovalverde Oct 9, 2023
f857593
fix: use simpler `grep` command
gustavovalverde Oct 9, 2023
231092b
Merge branch 'main' into ref-docker-log
gustavovalverde Oct 9, 2023
f649776
fix: do not sleep if not require
gustavovalverde Oct 9, 2023
ce8bc41
chore: reduce diff
gustavovalverde Oct 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 53 additions & 38 deletions .github/workflows/continous-delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ on:
type: boolean
default: false

# Temporarily disabled to reduce network load, see #6894.
# TODO: Temporarily disabled to reduce network load, see #6894.
#push:
# branches:
# - main
Expand Down Expand Up @@ -132,29 +132,37 @@ jobs:

# Make sure Zebra can sync at least one full checkpoint on mainnet
- name: Run tests using the default config
shell: /usr/bin/bash -exo pipefail {0}
run: |
set -ex
docker pull ${{ vars.GAR_BASE }}/zebrad@${{ needs.build.outputs.image_digest }}
docker run --detach --name default-conf-tests -t ${{ vars.GAR_BASE }}/zebrad@${{ needs.build.outputs.image_digest }}
# show the logs, even if the job times out
docker logs --tail all --follow default-conf-tests | \
tee --output-error=exit /dev/stderr | \
grep --max-count=1 --extended-regexp --color=always \
'net.*=.*Main.*estimated progress to chain tip.*BeforeOverwinter'
# Use a subshell to handle the broken pipe error gracefully
(
trap "" PIPE;
docker logs \
--tail all \
--follow \
default-conf-tests | \
tee --output-error=exit /dev/stderr | \
grep --max-count=1 --extended-regexp --color=always \
-e "net.*=.*Main.*estimated progress to chain tip.*BeforeOverwinter"
) || true
LOGS_EXIT_STATUS=$?
docker stop default-conf-tests
# get the exit status from docker
EXIT_STATUS=$( \
docker wait default-conf-tests || \
docker inspect --format "{{.State.ExitCode}}" default-conf-tests || \
echo "missing container, or missing exit status for container" \
)
docker logs default-conf-tests
echo "docker exit status: $EXIT_STATUS"
if [[ "$EXIT_STATUS" = "137" ]]; then
echo "ignoring expected signal status"
exit 0
EXIT_STATUS=$(docker wait default-conf-tests || echo "Error retrieving exit status");
echo "docker exit status: $EXIT_STATUS";
# If grep found the pattern, exit with the Docker container exit status
if [ $LOGS_EXIT_STATUS -eq 0 ]; then
exit $EXIT_STATUS;
fi
exit "$EXIT_STATUS"
# Handle other potential errors here
echo "An error occurred while processing the logs.";
exit 1;
# Test reconfiguring the docker image for testnet.
test-configuration-file-testnet:
Expand All @@ -172,30 +180,37 @@ jobs:

# Make sure Zebra can sync the genesis block on testnet
- name: Run tests using a testnet config
shell: /usr/bin/bash -exo pipefail {0}
run: |
set -ex
docker pull ${{ vars.GAR_BASE }}/zebrad@${{ needs.build.outputs.image_digest }}
docker run --env "NETWORK=Testnet" --detach --name testnet-conf-tests -t ${{ vars.GAR_BASE }}/zebrad@${{ needs.build.outputs.image_digest }}
# show the logs, even if the job times out
docker logs --tail all --follow testnet-conf-tests | \
tee --output-error=exit /dev/stderr | \
grep --max-count=1 --extended-regexp --color=always \
-e 'net.*=.*Test.*estimated progress to chain tip.*Genesis' \
-e 'net.*=.*Test.*estimated progress to chain tip.*BeforeOverwinter'
# Use a subshell to handle the broken pipe error gracefully
(
trap "" PIPE;
docker logs \
--tail all \
--follow \
testnet-conf-tests | \
tee --output-error=exit /dev/stderr | \
grep --max-count=1 --extended-regexp --color=always \
-e "net.*=.*Test.*estimated progress to chain tip.*Genesis" \
-e "net.*=.*Test.*estimated progress to chain tip.*BeforeOverwinter";
) || true
LOGS_EXIT_STATUS=$?
docker stop testnet-conf-tests
# get the exit status from docker
EXIT_STATUS=$( \
docker wait testnet-conf-tests || \
docker inspect --format "{{.State.ExitCode}}" testnet-conf-tests || \
echo "missing container, or missing exit status for container" \
)
docker logs testnet-conf-tests
echo "docker exit status: $EXIT_STATUS"
if [[ "$EXIT_STATUS" = "137" ]]; then
echo "ignoring expected signal status"
exit 0
EXIT_STATUS=$(docker wait testnet-conf-tests || echo "Error retrieving exit status");
echo "docker exit status: $EXIT_STATUS";
# If grep found the pattern, exit with the Docker container exit status
if [ $LOGS_EXIT_STATUS -eq 0 ]; then
exit $EXIT_STATUS;
fi
exit "$EXIT_STATUS"
# Handle other potential errors here
echo "An error occurred while processing the logs.";
exit 1;
# Deploy Managed Instance Groups (MiGs) for Mainnet and Testnet,
# with one node in the configured GCP region.
Expand Down
Loading
Loading