From f88ffae933a606a72405c919a15bd6c01cf5d043 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=AD=E5=BD=AA?= Date: Sat, 2 Nov 2024 11:27:43 +0800 Subject: [PATCH] Add ligai dk version notify --- .gitlab-ci.yml | 1 + Makefile | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6c76a8a625..6687c4a16d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -176,6 +176,7 @@ release-stable: - make pub_conf_samples - make production_image GIT_BRANCH=$CI_COMMIT_BRANCH VERSION="$CI_VERSION" - make uos_image_production GIT_BRANCH=$CI_COMMIT_BRANCH VERSION="$CI_VERSION" PKGEBPF=true + - make push_ligai_version VERSION="$CI_VERSION" LIGAI_CUSTOMFIELD=$LIGAI_CUSTOMFIELD LIGAI_AUTO_DEVOPS_TOKEN=$LIGAI_AUTO_DEVOPS_TOKEN LIGAI_API=$LIGAI_API tags: - cloudcare-ft diff --git a/Makefile b/Makefile index d556c0e4cd..34592681e5 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,11 @@ LOCAL_OSS_ADDR ?= "not-set" # you should export these env in your make LOCAL_UPLOAD_ADDR ?= ${LOCAL_OSS_ADDR} LOCAL_DOWNLOAD_CDN ?= ${LOCAL_OSS_ADDR} # CDN set as the same OSS bucket +# ligai version notify settings +LIGAI_CUSTOMFIELD ?=not_set +LIGAI_AUTO_DEVOPS_TOKEN ?=not_set +LIGAI_API ?=not_set + # Local envs to publish local testing binaries. # export LOCAL_OSS_ACCESS_KEY = '' # export LOCAL_OSS_SECRET_KEY = '' @@ -498,3 +503,16 @@ endef detect_mr_target_branch: $(call check_mr_target_branch,$(MERGE_REQUEST_TARGET_BRANCH)) + +push_ligai_version: + @printf "$(HL)push new datakit version $(VERSION) to ligai...\n$(NC)"; + @curl -i -X POST \ + -H 'Content-Type: application/json' \ + -H "auto_devops_token: $(LIGAI_AUTO_DEVOPS_TOKEN)" \ + -d '{"version":"$(VERSION)","field_code":"$(LIGAI_CUSTOMFIELD)"}' \ + $(LIGAI_API) + @if [ $$? != 0 ]; then \ + printf "$(RED) [WARN] push version to ligai failed"; \ + else \ + printf "[INFO] push version to ligai ok"; \ + fi