From 32e323c74543e6d26fc5e3a0c0b8db40b6bf3020 Mon Sep 17 00:00:00 2001 From: jaimukund bhan Date: Sat, 26 Apr 2025 11:18:28 +0530 Subject: [PATCH 1/9] "[#474] Clean Makefile Modified the following targets: - all : Now runs 'make docker' to begin Cello docker image setup - clean : Updated the filter for clearing out docker containers - check : Removed lines which would not run after failing the format check (check is solely for format check now) - deep-clean : Deleted helpers which do not exit and now it clears out docker images + local storage - docker : Added the functionality to remove dangling images after setting up Cello images - docker-clean : Changed the order of targets run, 'stop' is included in 'clean' - stop : Added '@' to avoid printing 'if' statement on terminal - clean-images : Updated the filter to clear out all Cello docker images, and prune dangling images Close #474" Signed-off-by: jaimukund bhan --- Makefile | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 9f207fce1..48b6140f5 100755 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ # - doc: Start a local web service to explore the documentation # - docker[-clean]: Build/clean docker images locally # - docker-compose: Start development docker-compose. -# - license: Checks sourrce files for Apache license header +# - license: Checks source files for Apache license header # - local: Run all services ad-hoc # - help: Output the help instructions for each command # - reset: Clean up and remove local storage (only use for development) @@ -128,39 +128,34 @@ HELP_FUN = \ }; \ print "\n"; } -all: check +all: + make docker clean: ##@Clean Stop services and clean docker containers. make stop - if docker ps -a | grep "cello-"; then \ - docker ps -a | grep "cello-" | awk '{print $1}' | xargs docker rm -f >/dev/null 2>&1; \ - fi + @-docker ps -a --filter "name=cello-" --format "{{.ID}}" | xargs docker rm -f >/dev/null 2>&1 + @echo "Cleared out containers" + check: ##@Code Check code format @$(MAKE) license - find ./docs -type f -name "*.md" -exec egrep -l " +$$" {} \; + -find ./docs -type f -name "*.md" -exec egrep -l " +$$" {} \; cd src/api-engine && tox && cd ${ROOT_PATH} - make docker-compose - MODE=dev make start - sleep 10 - # make test-api - MODE=dev make stop - make check-dashboard + deep-clean: ##@Clean Stop services, clean docker images and remove mounted local storage. - make stop - make clean - make clean-docker-images + make clean-images rm -rf $(LOCAL_STORAGE_PATH) doc: ##@Documentation Build local online documentation and start serve command -v mkdocs >/dev/null 2>&1 || pip install -r docs/requirements.txt || pip3 -r docs/requirements.txt mkdocs serve -f mkdocs.yml -docker: images ##@Build Build all required docker images locally +docker: ##@Build Build all required docker images locally + make images + docker image prune -docker-clean:##@Clean Clean docker images locally - make stop +docker-clean:##@Clean Clean docker images locally make clean-images docker-compose: api-engine fabric docker-rest-agent dashboard ##@Development Start development docker-compose @@ -191,7 +186,7 @@ start: ##@Service Start service make start-docker-compose stop: ##@Service Stop service - if [ "$(CONFIG_DOCKER_COMPOSE_DEPLOY)" = "y" ]; then \ + @if [ "$(CONFIG_DOCKER_COMPOSE_DEPLOY)" = "y" ]; then \ make stop-docker-compose; \ else \ make stop-k8s; \ @@ -199,9 +194,13 @@ stop: ##@Service Stop service ## Help rules clean-images: + @echo "Clean all cello related images, may need to remove all containers" make clean - echo "Clean all cello related images, may need to remove all containers before" - docker images | grep "cello-" | awk '{print $3}' | xargs docker rmi -f + @-docker images --filter=reference='hyperledger/*' --format '{{.ID}}' | xargs -r docker rmi -f 2>/dev/null + @echo "Images deleted!" + @echo "Pruning dangling images..." + docker image prune + @echo "Dangling images pruned, cleanup finished!" check-dashboard: docker compose -f tests/dashboard/docker-compose.yml up --abort-on-container-exit || (echo "check dashboard failed $$?"; exit 1) From b204f16bef630d3ebfb84d69d9e34ee9f25996b4 Mon Sep 17 00:00:00 2001 From: jaimukund bhan Date: Sat, 26 Apr 2025 12:04:30 +0530 Subject: [PATCH 2/9] [#474] Changed clean-images filter and added check-dashboard - clean-images : Modified the filter to only remove the images which are under the 'hyperledger' repository name and have the word 'cello' inside. This avoids deleting other Hyperledger images a user may have - check-dashboard : Moved this helper command to the list of commands which shows up with 'make help'. Could not work well with the 'check' command before, which is now meant to check the code format only - help : Rearranged the position of this command to maintain alphabetical order - .PHONY : Added 'check-dashboard' to the list Close #474 Signed-off-by: jaimukund bhan --- Makefile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 48b6140f5..108d4f4bf 100755 --- a/Makefile +++ b/Makefile @@ -141,8 +141,10 @@ check: ##@Code Check code format @$(MAKE) license -find ./docs -type f -name "*.md" -exec egrep -l " +$$" {} \; cd src/api-engine && tox && cd ${ROOT_PATH} - +check-dashboard: ##@Code Check dashboard + docker compose -f tests/dashboard/docker-compose.yml up --abort-on-container-exit || (echo "check dashboard failed $$?"; exit 1) + deep-clean: ##@Clean Stop services, clean docker images and remove mounted local storage. make clean-images rm -rf $(LOCAL_STORAGE_PATH) @@ -160,15 +162,15 @@ docker-clean:##@Clean Clean docker images locally docker-compose: api-engine fabric docker-rest-agent dashboard ##@Development Start development docker-compose +help: ##@Help Show this help. + @perl -e '$(HELP_FUN)' $(MAKEFILE_LIST) + license: ##@Code Check source files for Apache license header scripts/check_license.sh local:##@Development Run all services ad-hoc make docker-compose start-docker-compose -help: ##@Help Show this help. - @perl -e '$(HELP_FUN)' $(MAKEFILE_LIST) - reset:##@Development Clean up and remove local storage (only use for development) make clean echo "Clean up and remove all local storage..." @@ -196,15 +198,12 @@ stop: ##@Service Stop service clean-images: @echo "Clean all cello related images, may need to remove all containers" make clean - @-docker images --filter=reference='hyperledger/*' --format '{{.ID}}' | xargs -r docker rmi -f 2>/dev/null + @-docker images --filter=reference='hyperledger/*cello*' --format '{{.ID}}' | xargs -r docker rmi -f 2>/dev/null @echo "Images deleted!" @echo "Pruning dangling images..." docker image prune @echo "Dangling images pruned, cleanup finished!" -check-dashboard: - docker compose -f tests/dashboard/docker-compose.yml up --abort-on-container-exit || (echo "check dashboard failed $$?"; exit 1) - start-docker-compose: docker compose -f bootup/docker-compose-files/${COMPOSE_FILE} up -d --force-recreate --remove-orphans @@ -234,6 +233,7 @@ dashboard: all \ license \ check \ + check-dashboard \ doc \ help \ docker \ From 896a9e19420ced92124fb34d21440464e86a963a Mon Sep 17 00:00:00 2001 From: jaimukund bhan Date: Sat, 26 Apr 2025 12:17:18 +0530 Subject: [PATCH 3/9] [#474] Changed comments - Added a comment for check-dashboard on top of the file - Repositioned the comment for 'help' to follow alphabetical order Close #474 Signed-off-by: jaimukund bhan --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 108d4f4bf..86cadc013 100755 --- a/Makefile +++ b/Makefile @@ -9,13 +9,14 @@ # - all (default): Builds all targets and runs all tests/checks # - clean: Cleans the docker containers. # - check: Setup as master node, and runs all tests/checks, will be triggered by CI +# - check-dashboard:Tests/checks the dashboard # - deep-clean: Clean up all docker images and local storage. # - doc: Start a local web service to explore the documentation # - docker[-clean]: Build/clean docker images locally # - docker-compose: Start development docker-compose. +# - help: Output the help instructions for each command # - license: Checks source files for Apache license header # - local: Run all services ad-hoc -# - help: Output the help instructions for each command # - reset: Clean up and remove local storage (only use for development) # - restart: Stop the cello service and then start # - setup-master: Setup the host as a master node, install pkg and download docker images From f0514bda5939b94c263eccda34339926073f03f3 Mon Sep 17 00:00:00 2001 From: jaimukund bhan Date: Tue, 29 Apr 2025 10:34:53 +0530 Subject: [PATCH 4/9] [#474] Making corrections - Removed extra space at the head (Removed check-dashboard altogether). - Reverted changes to "all" command (Runs "check" again) - Reverted changes to "check" (Previosuly thought exiting due to error during code format check would disable the lines of the commands following it) - Removed command to prune dangling images after "docker" (These images may be intermediaries). Close #474 Signed-off-by: jaimukund bhan --- Makefile | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 86cadc013..a07397160 100755 --- a/Makefile +++ b/Makefile @@ -9,7 +9,6 @@ # - all (default): Builds all targets and runs all tests/checks # - clean: Cleans the docker containers. # - check: Setup as master node, and runs all tests/checks, will be triggered by CI -# - check-dashboard:Tests/checks the dashboard # - deep-clean: Clean up all docker images and local storage. # - doc: Start a local web service to explore the documentation # - docker[-clean]: Build/clean docker images locally @@ -129,8 +128,7 @@ HELP_FUN = \ }; \ print "\n"; } -all: - make docker +all: check clean: ##@Clean Stop services and clean docker containers. make stop @@ -142,9 +140,11 @@ check: ##@Code Check code format @$(MAKE) license -find ./docs -type f -name "*.md" -exec egrep -l " +$$" {} \; cd src/api-engine && tox && cd ${ROOT_PATH} - -check-dashboard: ##@Code Check dashboard - docker compose -f tests/dashboard/docker-compose.yml up --abort-on-container-exit || (echo "check dashboard failed $$?"; exit 1) + make docker-compose + make start + sleep 10 + make stop + make check-dashboard deep-clean: ##@Clean Stop services, clean docker images and remove mounted local storage. make clean-images @@ -156,7 +156,6 @@ doc: ##@Documentation Build local online documentation and start serve docker: ##@Build Build all required docker images locally make images - docker image prune docker-clean:##@Clean Clean docker images locally make clean-images @@ -205,6 +204,9 @@ clean-images: docker image prune @echo "Dangling images pruned, cleanup finished!" +check-dashboard: + docker compose -f tests/dashboard/docker-compose.yml up --abort-on-container-exit || (echo "check dashboard failed $$?"; exit 1) + start-docker-compose: docker compose -f bootup/docker-compose-files/${COMPOSE_FILE} up -d --force-recreate --remove-orphans @@ -234,7 +236,6 @@ dashboard: all \ license \ check \ - check-dashboard \ doc \ help \ docker \ @@ -253,4 +254,4 @@ dashboard: clean-images \ start-docker-compose \ stop-docker-compose \ - images \ + images \ \ No newline at end of file From 5e520f97ffe636854f1faa561111ca7e2990d88c Mon Sep 17 00:00:00 2001 From: jaimukund bhan Date: Tue, 29 Apr 2025 10:49:55 +0530 Subject: [PATCH 5/9] [#474] Spacing Spacing the head and "all" command correctly Closes #474 Signed-off-by: jaimukund bhan --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index a07397160..23d09cd59 100755 --- a/Makefile +++ b/Makefile @@ -9,13 +9,13 @@ # - all (default): Builds all targets and runs all tests/checks # - clean: Cleans the docker containers. # - check: Setup as master node, and runs all tests/checks, will be triggered by CI -# - deep-clean: Clean up all docker images and local storage. -# - doc: Start a local web service to explore the documentation +# - deep-clean: Clean up all docker images and local storage. +# - doc: Start a local web service to explore the documentation # - docker[-clean]: Build/clean docker images locally # - docker-compose: Start development docker-compose. # - help: Output the help instructions for each command -# - license: Checks source files for Apache license header -# - local: Run all services ad-hoc +# - license: Checks source files for Apache license header +# - local: Run all services ad-hoc # - reset: Clean up and remove local storage (only use for development) # - restart: Stop the cello service and then start # - setup-master: Setup the host as a master node, install pkg and download docker images @@ -128,7 +128,7 @@ HELP_FUN = \ }; \ print "\n"; } -all: check +all: check clean: ##@Clean Stop services and clean docker containers. make stop From cd664c2cb2e8a5b7a4b6e2c54100ea26544d2d52 Mon Sep 17 00:00:00 2001 From: jaimukund bhan Date: Tue, 29 Apr 2025 10:53:40 +0530 Subject: [PATCH 6/9] [#474] Removed newline Removed an extra line between 2 commands Closes #474 Signed-off-by: jaimukund bhan --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index 23d09cd59..9f94caa00 100755 --- a/Makefile +++ b/Makefile @@ -135,7 +135,6 @@ clean: ##@Clean Stop services and clean docker containers. @-docker ps -a --filter "name=cello-" --format "{{.ID}}" | xargs docker rm -f >/dev/null 2>&1 @echo "Cleared out containers" - check: ##@Code Check code format @$(MAKE) license -find ./docs -type f -name "*.md" -exec egrep -l " +$$" {} \; From 5ed23d731269da3343481158736c26e5f086011f Mon Sep 17 00:00:00 2001 From: jaimukund bhan Date: Fri, 2 May 2025 14:54:10 +0530 Subject: [PATCH 7/9] [#474] Resolving changes Resolved typos and unnecessary changes Closes #474 Signed-off-by: jaimukund bhan --- Makefile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 9f94caa00..97c30f24c 100755 --- a/Makefile +++ b/Makefile @@ -128,7 +128,7 @@ HELP_FUN = \ }; \ print "\n"; } -all: check +all: check clean: ##@Clean Stop services and clean docker containers. make stop @@ -140,7 +140,7 @@ check: ##@Code Check code format -find ./docs -type f -name "*.md" -exec egrep -l " +$$" {} \; cd src/api-engine && tox && cd ${ROOT_PATH} make docker-compose - make start + MODE=dev make start sleep 10 make stop make check-dashboard @@ -153,8 +153,7 @@ doc: ##@Documentation Build local online documentation and start serve command -v mkdocs >/dev/null 2>&1 || pip install -r docs/requirements.txt || pip3 -r docs/requirements.txt mkdocs serve -f mkdocs.yml -docker: ##@Build Build all required docker images locally - make images +docker: images ##@Build Build all required docker images locally docker-clean:##@Clean Clean docker images locally make clean-images From 60da701822bc48ca419c4e0e9458d54731dc9f76 Mon Sep 17 00:00:00 2001 From: jaimukund bhan Date: Fri, 2 May 2025 22:17:14 +0530 Subject: [PATCH 8/9] [#474] Reverting changes Reverting changes made to the "check" command Closes #474 Signed-off-by: jaimukund bhan --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 97c30f24c..8bad9696f 100755 --- a/Makefile +++ b/Makefile @@ -137,12 +137,12 @@ clean: ##@Clean Stop services and clean docker containers. check: ##@Code Check code format @$(MAKE) license - -find ./docs -type f -name "*.md" -exec egrep -l " +$$" {} \; + find ./docs -type f -name "*.md" -exec egrep -l " +$$" {} \; cd src/api-engine && tox && cd ${ROOT_PATH} make docker-compose MODE=dev make start sleep 10 - make stop + MODE=dev make stop make check-dashboard deep-clean: ##@Clean Stop services, clean docker images and remove mounted local storage. From 68eeb703e34fc29e963ba41661f3f7e3ed3d8c33 Mon Sep 17 00:00:00 2001 From: jaimukund bhan Date: Mon, 5 May 2025 22:47:55 +0530 Subject: [PATCH 9/9] [#474] Removing empty tab Removed the stray tab on line 147 Close #474 Signed-off-by: jaimukund bhan --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8bad9696f..cdf03de6e 100755 --- a/Makefile +++ b/Makefile @@ -144,7 +144,7 @@ check: ##@Code Check code format sleep 10 MODE=dev make stop make check-dashboard - + deep-clean: ##@Clean Stop services, clean docker images and remove mounted local storage. make clean-images rm -rf $(LOCAL_STORAGE_PATH)