Makefile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. .PHONY: version
  2. #ifeq ($(wildcard ./version),)
  3. # # 如果version文件不存在,设置一个默认值或者不做任何操作
  4. # version?=1.0.0
  5. #else
  6. # version:=$(shell cat ./version)
  7. #endif
  8. #major:=$(echo $(version) | cut -d. -f1)
  9. #minor:=$(echo $(version) | cut -d. -f2)
  10. #patch:=$(echo $(version) | cut -d. -f3 | sed 's/^v//')
  11. #new_patch:=$((patch + 1))
  12. #new_version:="$(major).$(minor).$(new_patch)"
  13. version?=1.0.0
  14. tag=reg.cestong.com.cn/cecf/ob-agent-stream:${version}
  15. release_tag=hub.js.sgcc.com.cn/observe/ob-agent-stream:${version}
  16. save_dir=~/tmp
  17. next_version:
  18. echo $(version)
  19. echo $(major)
  20. echo $(minor)
  21. echo $(patch)
  22. echo $(new_version)
  23. jar:
  24. mvn package
  25. docker-build: jar
  26. docker build . -t ${tag}
  27. docker-push: docker-build
  28. docker push ${tag}
  29. echo ${version} > ./version
  30. release:
  31. docker tag ${tag} ${release_tag}
  32. docker save ${release_tag} -o ${save_dir}/ob-agent-stream_${version}.tar
  33. # test
  34. js_test_tag=hub.js.sgcc.com.cn/observe/ob-agent-stream:${version}
  35. js_test_save_path=~/tmp/oas-js-test-${version}.tar
  36. js-test-docker-build: jar
  37. docker build . -t ${js_test_tag}
  38. docker save ${js_test_tag} -o ${js_test_save_path}
  39. js-test-docker-push: js-test-docker-build
  40. docker push ${js_test_tag}
  41. echo ${version} > ./version
  42. # js prod
  43. js_prod_tag=hub.js.sgcc.com.cn/observe/ob-agent-stream:${version}
  44. js_test_save_path=~/tmp/oas-js-prod-${version}.tar
  45. js-prod-docker-build: jar
  46. docker build . -t ${js_prod_tag}
  47. docker save ${js_prod_tag} -o ${js_test_save_path}