From 2082b0f3cabc283183909917a5891c1e5d52cf70 Mon Sep 17 00:00:00 2001 From: Breezewish Date: Mon, 6 Jan 2020 23:53:13 +0800 Subject: [PATCH] Update build tag for PD integration Signed-off-by: Breezewish --- .github/workflows/release-ui-assets.yaml | 4 ++-- Makefile | 16 +++++++++------- scripts/embed_ui_assets.sh | 4 +++- ui/.github_release_version | 2 +- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release-ui-assets.yaml b/.github/workflows/release-ui-assets.yaml index de508883bc..912f06f230 100644 --- a/.github/workflows/release-ui-assets.yaml +++ b/.github/workflows/release-ui-assets.yaml @@ -35,7 +35,7 @@ jobs: ${{ runner.os }}-go- - name: Build UI run: | - make ui_for_pd + DASHBOARD_API="/dashboard" make ui - name: Pack UI asset release working-directory: ui/build run: | @@ -66,7 +66,7 @@ jobs: asset_content_type: application/zip - name: Generate embedded assets run: | - scripts/embed_ui_assets.sh + BUILD_TAG="dashboard_ui" scripts/embed_ui_assets.sh cp pkg/uiserver/embedded_assets_handler.go embedded_assets_handler.go - name: Pack embedded assets run: | diff --git a/Makefile b/Makefile index cce23a88e6..77ef6f9cec 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,6 @@ -.PHONY: tidy ui server run +.PHONY: tidy swagger_spec yarn_dependencies swagger_client ui server run + +DASHBOARD_API ?= BUILD_TAGS ?= @@ -20,16 +22,16 @@ swagger_spec: scripts/generate_swagger_spec.sh yarn_dependencies: - cd ui && yarn install --frozen-lockfile + cd ui &&\ + yarn install --frozen-lockfile swagger_client: swagger_spec yarn_dependencies - cd ui && npm run build_api_client + cd ui &&\ + npm run build_api_client ui: swagger_client - cd ui && REACT_APP_DASHBOARD_API_URL="" npm run build - -ui_for_pd: swagger_client - cd ui && REACT_APP_DASHBOARD_API_URL="/dashboard" npm run build + cd ui &&\ + REACT_APP_DASHBOARD_API_URL="${DASHBOARD_API}" npm run build server: ifeq ($(SWAGGER),1) diff --git a/scripts/embed_ui_assets.sh b/scripts/embed_ui_assets.sh index b9bcdf8cc8..ca5a76fc39 100755 --- a/scripts/embed_ui_assets.sh +++ b/scripts/embed_ui_assets.sh @@ -15,6 +15,8 @@ cd $PROJECT_DIR export GOBIN=$PROJECT_DIR/bin export PATH=$GOBIN:$PATH +: "${BUILD_TAG:=ui_server}" + echo "+ Preflight check" if [ ! -d "ui/build" ]; then echo " - Error: UI assets must be built first" @@ -26,7 +28,7 @@ go install github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs go install github.com/go-bindata/go-bindata/go-bindata echo "+ Embed UI assets" -go-bindata-assetfs -pkg uiserver -prefix ui -tags ui_server ui/build/... +go-bindata-assetfs -pkg uiserver -prefix ui -tags $BUILD_TAG ui/build/... HANDLER_PATH=pkg/uiserver/embedded_assets_handler.go mv bindata_assetfs.go $HANDLER_PATH echo " - Assets handler written to $HANDLER_PATH" diff --git a/ui/.github_release_version b/ui/.github_release_version index 8e5567b229..bdc6752abf 100644 --- a/ui/.github_release_version +++ b/ui/.github_release_version @@ -1,3 +1,3 @@ # This file contains a version number which will be used to release assets to # GitHub. To trigger a new asset release, simply increase this version number. -20200106_1 +20200106_2