88BACKUP =gpbackup
99RESTORE =gprestore
1010HELPER =gpbackup_helper
11+ S3PLUGIN =gpbackup_s3_plugin
1112BIN_DIR =$(shell echo $${GOPATH:-~/go} | awk -F':' '{ print $$1 "/bin"}')
1213GINKGO_FLAGS := -r --keep-going --randomize-suites --randomize-all --no-color
1314GIT_VERSION := $(shell git describe --tags | perl -pe 's/(.* ) -([0-9]*)-(g[0-9a-f]*)/\1+dev.\2.\3/')
1415BACKUP_VERSION_STR=github.com/apache/cloudberry-backup/backup.version =$(GIT_VERSION )
1516RESTORE_VERSION_STR=github.com/apache/cloudberry-backup/restore.version =$(GIT_VERSION )
1617HELPER_VERSION_STR=github.com/apache/cloudberry-backup/helper.version =$(GIT_VERSION )
18+ S3PLUGIN_VERSION_STR=github.com/apache/cloudberry-backup/plugins/s3plugin.version =$(GIT_VERSION )
1719
1820# note that /testutils is not a production directory, but has unit tests to validate testing tools
19- SUBDIRS_HAS_UNIT =backup/ filepath/ history/ helper/ options/ report/ restore/ toc/ utils/ testutils/
21+ SUBDIRS_HAS_UNIT =backup/ filepath/ history/ helper/ options/ report/ restore/ toc/ utils/ testutils/ plugins/s3plugin/
2022SUBDIRS_ALL =$(SUBDIRS_HAS_UNIT ) integration/ end_to_end/
2123GOLANG_LINTER =$(GOPATH ) /bin/golangci-lint
2224GINKGO =$(GOPATH ) /bin/ginkgo
@@ -26,6 +28,7 @@ DEBUG=-gcflags=all="-N -l"
2628
2729CUSTOM_BACKUP_DIR ?= "/tmp"
2830helper_path ?= $(BIN_DIR ) /$(HELPER )
31+ s3plugin_path ?= $(BIN_DIR ) /$(S3PLUGIN )
2932
3033# Prefer gpsync as the newer utility, fall back to gpscp if not present (older installs)
3134ifeq (, $(shell which gpsync) )
@@ -82,26 +85,29 @@ build : $(GOSQLITE)
8285 CGO_ENABLED=1 $(GO_BUILD ) -tags ' $(BACKUP)' -o $(BIN_DIR ) /$(BACKUP ) --ldflags ' -X $(BACKUP_VERSION_STR)'
8386 CGO_ENABLED=1 $(GO_BUILD ) -tags ' $(RESTORE)' -o $(BIN_DIR ) /$(RESTORE ) --ldflags ' -X $(RESTORE_VERSION_STR)'
8487 CGO_ENABLED=1 $(GO_BUILD ) -tags ' $(HELPER)' -o $(BIN_DIR ) /$(HELPER ) --ldflags ' -X $(HELPER_VERSION_STR)'
88+ CGO_ENABLED=1 $(GO_BUILD ) -tags ' $(S3PLUGIN)' -o $(BIN_DIR ) /$(S3PLUGIN ) --ldflags ' -X $(S3PLUGIN_VERSION_STR)'
8589
8690debug :
8791 CGO_ENABLED=1 $(GO_BUILD ) -tags ' $(BACKUP)' -o $(BIN_DIR ) /$(BACKUP ) -ldflags " -X $( BACKUP_VERSION_STR) " $(DEBUG )
8892 CGO_ENABLED=1 $(GO_BUILD ) -tags ' $(RESTORE)' -o $(BIN_DIR ) /$(RESTORE ) -ldflags " -X $( RESTORE_VERSION_STR) " $(DEBUG )
8993 CGO_ENABLED=1 $(GO_BUILD ) -tags ' $(HELPER)' -o $(BIN_DIR ) /$(HELPER ) -ldflags " -X $( HELPER_VERSION_STR) " $(DEBUG )
94+ CGO_ENABLED=1 $(GO_BUILD ) -tags ' $(S3PLUGIN)' -o $(BIN_DIR ) /$(S3PLUGIN ) -ldflags " -X $( S3PLUGIN_VERSION_STR) " $(DEBUG )
9095
9196build_linux :
9297 env GOOS=linux GOARCH=amd64 $(GO_BUILD ) -tags ' $(BACKUP)' -o $(BACKUP ) -ldflags " -X $( BACKUP_VERSION_STR) "
9398 env GOOS=linux GOARCH=amd64 $(GO_BUILD ) -tags ' $(RESTORE)' -o $(RESTORE ) -ldflags " -X $( RESTORE_VERSION_STR) "
9499 env GOOS=linux GOARCH=amd64 $(GO_BUILD ) -tags ' $(HELPER)' -o $(HELPER ) -ldflags " -X $( HELPER_VERSION_STR) "
100+ env GOOS=linux GOARCH=amd64 $(GO_BUILD ) -tags ' $(S3PLUGIN)' -o $(S3PLUGIN ) -ldflags " -X $( S3PLUGIN_VERSION_STR) "
95101
96102install :
97103 cp $(BIN_DIR ) /$(BACKUP ) $(BIN_DIR ) /$(RESTORE ) $(GPHOME ) /bin
98104 @psql -X -t -d template1 -c ' select distinct hostname from gp_segment_configuration where content != -1' > /tmp/seg_hosts 2> /dev/null; \
99105 if [ $$ ? -eq 0 ]; then \
100- $(COPYUTIL ) -f /tmp/seg_hosts $(helper_path ) =:$(GPHOME ) /bin/$( HELPER ) ; \
106+ $(COPYUTIL ) -f /tmp/seg_hosts $(helper_path ) $( s3plugin_path ) =:$(GPHOME ) /bin/; \
101107 if [ $$ ? -eq 0 ]; then \
102- echo ' Successfully copied gpbackup_helper to $(GPHOME) on all segments' ; \
108+ echo ' Successfully copied gpbackup_helper and gpbackup_s3_plugin to $(GPHOME) on all segments' ; \
103109 else \
104- echo ' Failed to copy gpbackup_helper to $(GPHOME)' ; \
110+ echo ' Failed to copy gpbackup_helper and gpbackup_s3_plugin to $(GPHOME)' ; \
105111 exit 1; \
106112 fi ; \
107113 else \
@@ -112,7 +118,7 @@ install :
112118
113119clean :
114120 # Build artifacts
115- rm -f $(BIN_DIR ) /$(BACKUP ) $(BACKUP ) $(BIN_DIR ) /$(RESTORE ) $(RESTORE ) $(BIN_DIR ) /$(HELPER ) $(HELPER )
121+ rm -f $(BIN_DIR ) /$(BACKUP ) $(BACKUP ) $(BIN_DIR ) /$(RESTORE ) $(RESTORE ) $(BIN_DIR ) /$(HELPER ) $(HELPER ) $( BIN_DIR ) / $( S3PLUGIN ) $( S3PLUGIN )
116122 # Test artifacts
117123 rm -rf /tmp/go-build* /tmp/gexec_artifacts* /tmp/ginkgo*
118124 docker stop s3-minio # stop minio before removing its data directories
0 commit comments