From c7ae1f558fd4773c6ffbf948ff996976ed45ce5a Mon Sep 17 00:00:00 2001 From: Kevin DeGraaf Date: Tue, 21 Feb 2023 15:17:07 -0800 Subject: [PATCH] Fix Makefile so stop docker works on Linux (#608) ## Context and purpose of the change Fixes `make stop-docker` on Linux ## Brief Changelog Call pkill commands in a pkill.sh file via bash to prevent the exit code of 1 from stopping the make in Linux ## Author's Checklist I have... - [ ] Run and PASSED locally all GAIA integration tests - [ ] If the change is contentful, I either: - [ ] Added a new unit test OR - [ ] Added test cases to existing unit tests - [x] OR this change is a trivial rework / code cleanup without any test coverage If skipped any of the tests above, explain. ## Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] manually tested (if applicable) - [ ] confirmed the author wrote unit tests for new logic - [ ] reviewed documentation exists and is accurate ## Documentation and Release Note - [ ] Does this pull request introduce a new feature or user-facing behavior changes? - [ ] Is a relevant changelog entry added to the `Unreleased` section in `CHANGELOG.md`? - [ ] This pull request updates existing proto field values (and require a backend and frontend migration)? - [ ] Does this pull request change existing proto field names (and require a frontend migration)? How is the feature or change documented? - [ ] not applicable - [ ] jira ticket `XXX` - [ ] specification (`x//spec/`) - [ ] README.md - [ ] not documented --- Makefile | 40 +++++++++++++++++----------------------- dockernet/pkill.sh | 3 +++ 2 files changed, 20 insertions(+), 23 deletions(-) create mode 100755 dockernet/pkill.sh diff --git a/Makefile b/Makefile index ae21575b5..e3eb2a35b 100644 --- a/Makefile +++ b/Makefile @@ -68,8 +68,6 @@ BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)' .PHONY: build -all: lint check-dependencies build-local - ############################################################################### ### Build & Clean ### ############################################################################### @@ -81,15 +79,13 @@ build: install: go.sum go install $(BUILD_FLAGS) ./cmd/strided -clean: - rm -rf $(BUILDDIR)/* +clean: + rm -rf $(BUILDDIR)/* ############################################################################### ### CI ### ############################################################################### -ci: lint check-dependencies test-unit gosec build-local - gosec: gosec -exclude-dir=deps -severity=high ./... @@ -103,11 +99,11 @@ lint: test-unit: @go test -mod=readonly ./x/... ./app/... -test-unit-module: - @go test -mod=readonly ./x/$(module)/... +test-unit-path: + @go test -mod=readonly ./x/$(path)/... test-cover: - @go test -mod=readonly -race -coverprofile=coverage.out -covermode=atomic ./x/$(module)/... + @go test -mod=readonly -race -coverprofile=coverage.out -covermode=atomic ./x/$(path)/... test-integration-docker: bash $(DOCKERNET_HOME)/tests/run_all_tests.sh @@ -116,31 +112,29 @@ test-integration-docker: ### DockerNet ### ############################################################################### -build-docker: +build-docker: @bash $(DOCKERNET_HOME)/build.sh -${build} ${BUILDDIR} - + start-docker: build-docker - @bash $(DOCKERNET_HOME)/start_network.sh + @bash $(DOCKERNET_HOME)/start_network.sh start-docker-all: build-docker - @ALL_HOST_CHAINS=true bash $(DOCKERNET_HOME)/start_network.sh + @ALL_HOST_CHAINS=true bash $(DOCKERNET_HOME)/start_network.sh -clean-docker: - @docker-compose -f $(DOCKERNET_COMPOSE_FILE) stop - @docker-compose -f $(DOCKERNET_COMPOSE_FILE) down +clean-docker: + @docker-compose -f $(DOCKERNET_COMPOSE_FILE) stop + @docker-compose -f $(DOCKERNET_COMPOSE_FILE) down rm -rf $(DOCKERNET_HOME)/state docker image prune -a - + stop-docker: - @pkill -f "docker-compose .*stride.* logs" | true - @pkill -f "/bin/bash.*create_logs.sh" | true - @pkill -f "tail .*.log" | true + @bash $(DOCKERNET_HOME)/pkill.sh docker-compose -f $(DOCKERNET_COMPOSE_FILE) down -upgrade-init: +upgrade-init: PART=1 bash $(DOCKERNET_HOME)/tests/run_tests_upgrade.sh -upgrade-submit: +upgrade-submit: UPGRADE_HEIGHT=400 bash $(DOCKERNET_HOME)/upgrades/submit_upgrade.sh upgrade-validate: @@ -209,7 +203,7 @@ localnet-state-export-startd: @docker-compose -f $(STATE_EXPORT_COMPOSE_FILE) up -d localnet-state-export-upgrade: - bash $(LOCALSTRIDE_HOME)/state-export/scripts/submit_upgrade.sh + bash $(LOCALSTRIDE_HOME)/state-export/scripts/submit_upgrade.sh localnet-state-export-stop: @docker-compose -f $(STATE_EXPORT_COMPOSE_FILE) down diff --git a/dockernet/pkill.sh b/dockernet/pkill.sh new file mode 100755 index 000000000..ace5b006e --- /dev/null +++ b/dockernet/pkill.sh @@ -0,0 +1,3 @@ +pkill -f "docker-compose .*stride.* logs" | true +pkill -f "/bin/bash.*create_logs.sh" | true +pkill -f "tail .*.log" | true