Skip to content

Commit

Permalink
fix husky hooks and dashboard workflows (#781)
Browse files Browse the repository at this point in the history
* fix husky & make hooks executable
* add dashboard-ci
* release dashboard image in version action
* add dashboard nightly build

Signed-off-by: xixi <[email protected]>
  • Loading branch information
Hexilee authored Nov 1, 2023
1 parent 36a4802 commit 3c61006
Show file tree
Hide file tree
Showing 10 changed files with 154 additions and 49 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/dashboard-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Dashboard CI

on:
push:
branches:
- master
paths:
- 'Makefile'
- 'docker/Makefile'
- 'docker/dashboard.Dockerfile'
- 'dashboard-ui/*'
- 'cmd/dashboard/*'
- 'pkg/dashboard/*'
pull_request:
branches:
- master
paths:
- 'Makefile'
- 'docker/Makefile'
- 'docker/dashboard.Dockerfile'
- 'dashboard-ui/*'
- 'cmd/dashboard/*'
- 'pkg/dashboard/*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set Node.js 18.18.0
uses: actions/setup-node@v3
with:
node-version: 18.18.0
- name: Run install
uses: borales/actions-yarn@v4
with:
dir: dashboard-ui
cmd: install # will run `yarn install` command
- name: Build dashboard
run: make dashboard-dist



14 changes: 13 additions & 1 deletion .github/workflows/dashboard-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,19 @@ jobs:
publish-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check out code
uses: actions/checkout@v3
- name: Set Node.js 18.18.0
uses: actions/setup-node@v3
with:
node-version: 18.18.0
- name: Run yarn install
uses: borales/actions-yarn@v4
with:
dir: dashboard-ui
cmd: install # will run `yarn install` command
- name: Build dashboard
run: make dashboard-dist
- name: Login Docker Hub
env:
PASSWORD: ${{ secrets.DOCKERHUB_FUSE_ACCESS_TOKEN }}
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,17 +210,27 @@ jobs:
steps:
- uses: technote-space/workflow-conclusion-action@v3
- uses: actions/checkout@v3

- name: Check Failure
if: env.WORKFLOW_CONCLUSION == 'failure'
run: exit 1

- name: Set Node.js 18.18.0
uses: actions/setup-node@v3
with:
node-version: 18.18.0
- name: Run yarn install
uses: borales/actions-yarn@v4
with:
dir: dashboard-ui
cmd: install # will run `yarn install` command
- name: Build dashboard
run: make dashboard-dist
- name: Buildx and Push docker image nightly
env:
PASSWORD: ${{ secrets.DOCKERHUB_FUSE_ACCESS_TOKEN }}
JFSCHAN: beta
CEVERSION: ce-nightly
EEVERSION: ee-nightly
DASHBOARD_TAG: nightly
run: |
docker login --username chnliyong --password ${PASSWORD}
make -C docker image-nightly
Expand All @@ -229,6 +239,7 @@ jobs:
make -C docker ee-image
make -C docker fuse-ce-image
make -C docker fuse-ee-image
make -C docker dashboard-build
- name: Success
if: ${{ success() }}
run: echo "All Done"
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set Node.js 18.18.0
uses: actions/setup-node@v3
with:
node-version: 18.18.0
- name: Run yarn install
uses: borales/actions-yarn@v4
with:
dir: dashboard-ui
cmd: install # will run `yarn install` command
- name: Build dashboard
run: make dashboard-dist
- name: Login Docker Hub
run: docker login --username chnliyong --password ${PASSWORD}
env:
Expand All @@ -45,17 +56,19 @@ jobs:
CSI_LATEST_VERSION=$(shell git describe --tags --match 'v*' --always --dirty)
echo "CSI_LATEST_VERSION=$CSI_LATEST_VERSION" >> $GITHUB_ENV
fi
- name: Build docker image & push
- name: Build docker images and push
env:
CEVERSION: ce-${{ env.JUICEFS_CE_LATEST_VERSION }}
CEJUICEFS_VERSION: ${{ env.JUICEFS_CE_LATEST_VERSION }}
EEVERSION: ee-${{ env.JUICEFS_EE_LATEST_VERSION }}
CSIVERSION: ${{ env.CSI_LATEST_VERSION }}
DASHBOARD_TAG: ${{ env.CSI_LATEST_VERSION }}
run: |
export DOCKER_CLI_EXPERIMENTAL=enabled
docker run --rm --privileged docker/binfmt:66f9012c56a8316f9244ffd7622d7c21c1f6f28d
docker buildx create --use --name mybuilder
make -C docker image-version
make -C docker dashboard-buildx
- name: Setup upterm session
if: ${{ failure() }}
timeout-minutes: 60
Expand Down
4 changes: 0 additions & 4 deletions dashboard-ui/.husky/commit-msg

This file was deleted.

2 changes: 1 addition & 1 deletion dashboard-ui/.husky/pre-commit
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

cd dashboard-ui
npx --no-install lint-staged --quiet
6 changes: 3 additions & 3 deletions dashboard-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"private": true,
"author": "",
"scripts": {
"dev": "max dev",
"build": "max build",
"dev": "max dev",
"format": "prettier --cache --write .",
"prepare": "husky install",
"postinstall": "max setup",
"prepare": "cd .. && husky install dashboard-ui/.husky",
"setup": "max setup",
"start": "npm run dev"
},
Expand All @@ -25,7 +25,7 @@
"@types/react": "^18.0.33",
"@types/react-dom": "^18.0.11",
"husky": "^8.0.3",
"lint-staged": "^13.2.0",
"lint-staged": "^15.0.2",
"prettier": "^2.8.7",
"prettier-plugin-organize-imports": "^3.2.2",
"prettier-plugin-packagejson": "^2.4.3",
Expand Down
84 changes: 57 additions & 27 deletions dashboard-ui/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3853,10 +3853,10 @@ comma-separated-tokens@^1.0.0:
resolved "https://registry.npmmirror.com/comma-separated-tokens/-/comma-separated-tokens-1.0.8.tgz#632b80b6117867a158f1080ad498b2fbe7e3f5ea"
integrity sha512-GHuDRO12Sypu2cV70d1dkA2EUmXHgntrzbpvOB+Qy+49ypNfGgFQIC2fhhXbnyrJRynDCAARsT7Ou0M6hirpfw==

commander@11.0.0:
version "11.0.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-11.0.0.tgz#43e19c25dbedc8256203538e8d7e9346877a6f67"
integrity sha512-9HMlXtt/BNoYr8ooyjjNRdIilOTkVJXB+GhxMTtOKwk0R4j4lS4NpjuqmRxroBfnfTSHQIHQB7wryHhXarNjmQ==
commander@11.1.0:
version "11.1.0"
resolved "https://registry.npmmirror.com/commander/-/commander-11.1.0.tgz#62fdce76006a68e5c1ab3314dc92e800eb83d906"
integrity sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==

commander@^2.20.0:
version "2.20.3"
Expand Down Expand Up @@ -4892,19 +4892,19 @@ evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3:
md5.js "^1.3.4"
safe-buffer "^5.1.1"

execa@7.2.0, execa@^7.1.1:
version "7.2.0"
resolved "https://registry.yarnpkg.com/execa/-/execa-7.2.0.tgz#657e75ba984f42a70f38928cedc87d6f2d4fe4e9"
integrity sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==
execa@8.0.1:
version "8.0.1"
resolved "https://registry.npmmirror.com/execa/-/execa-8.0.1.tgz#51f6a5943b580f963c3ca9c6321796db8cc39b8c"
integrity sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==
dependencies:
cross-spawn "^7.0.3"
get-stream "^6.0.1"
human-signals "^4.3.0"
get-stream "^8.0.1"
human-signals "^5.0.0"
is-stream "^3.0.0"
merge-stream "^2.0.0"
npm-run-path "^5.1.0"
onetime "^6.0.0"
signal-exit "^3.0.7"
signal-exit "^4.1.0"
strip-final-newline "^3.0.0"

execa@^5.0.0, execa@^5.1.1:
Expand All @@ -4922,6 +4922,21 @@ execa@^5.0.0, execa@^5.1.1:
signal-exit "^3.0.3"
strip-final-newline "^2.0.0"

execa@^7.1.1:
version "7.2.0"
resolved "https://registry.yarnpkg.com/execa/-/execa-7.2.0.tgz#657e75ba984f42a70f38928cedc87d6f2d4fe4e9"
integrity sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==
dependencies:
cross-spawn "^7.0.3"
get-stream "^6.0.1"
human-signals "^4.3.0"
is-stream "^3.0.0"
merge-stream "^2.0.0"
npm-run-path "^5.1.0"
onetime "^6.0.0"
signal-exit "^3.0.7"
strip-final-newline "^3.0.0"

execall@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/execall/-/execall-2.0.0.tgz#16a06b5fe5099df7d00be5d9c06eecded1663b45"
Expand Down Expand Up @@ -5216,6 +5231,11 @@ get-stream@^6.0.0, get-stream@^6.0.1:
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7"
integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==

get-stream@^8.0.1:
version "8.0.1"
resolved "https://registry.npmmirror.com/get-stream/-/get-stream-8.0.1.tgz#def9dfd71742cd7754a7761ed43749a27d02eca2"
integrity sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==

get-symbol-description@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/get-symbol-description/-/get-symbol-description-1.0.0.tgz#7fdb81c900101fbd564dd5f1a30af5aadc1e58d6"
Expand Down Expand Up @@ -5573,6 +5593,11 @@ human-signals@^4.3.0:
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-4.3.1.tgz#ab7f811e851fca97ffbd2c1fe9a958964de321b2"
integrity sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==

human-signals@^5.0.0:
version "5.0.0"
resolved "https://registry.npmmirror.com/human-signals/-/human-signals-5.0.0.tgz#42665a284f9ae0dade3ba41ebc37eb4b852f3a28"
integrity sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==

husky@^8.0.3:
version "8.0.3"
resolved "https://registry.yarnpkg.com/husky/-/husky-8.0.3.tgz#4936d7212e46d1dea28fef29bb3a108872cd9184"
Expand Down Expand Up @@ -6358,26 +6383,26 @@ lines-and-columns@^1.1.6:
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632"
integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==

lint-staged@^13.2.0:
version "13.3.0"
resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-13.3.0.tgz#7965d72a8d6a6c932f85e9c13ccf3596782d28a5"
integrity sha512-mPRtrYnipYYv1FEE134ufbWpeggNTo+O/UPzngoaKzbzHAthvR55am+8GfHTnqNRQVRRrYQLGW9ZyUoD7DsBHQ==
lint-staged@^15.0.2:
version "15.0.2"
resolved "https://registry.npmmirror.com/lint-staged/-/lint-staged-15.0.2.tgz#abef713182ec2770143e40a5d6d0130fe61ed442"
integrity sha512-vnEy7pFTHyVuDmCAIFKR5QDO8XLVlPFQQyujQ/STOxe40ICWqJ6knS2wSJ/ffX/Lw0rz83luRDh+ET7toN+rOw==
dependencies:
chalk "5.3.0"
commander "11.0.0"
commander "11.1.0"
debug "4.3.4"
execa "7.2.0"
execa "8.0.1"
lilconfig "2.1.0"
listr2 "6.6.1"
listr2 "7.0.2"
micromatch "4.0.5"
pidtree "0.6.0"
string-argv "0.3.2"
yaml "2.3.1"
yaml "2.3.3"

listr2@6.6.1:
version "6.6.1"
resolved "https://registry.yarnpkg.com/listr2/-/listr2-6.6.1.tgz#08b2329e7e8ba6298481464937099f4a2cd7f95d"
integrity sha512-+rAXGHh0fkEWdXBmX+L6mmfmXmXvDGEKzkjxO+8mP3+nI/r/CWznVBvsibXdxda9Zz0OW2e2ikphN3OwCT/jSg==
listr2@7.0.2:
version "7.0.2"
resolved "https://registry.npmmirror.com/listr2/-/listr2-7.0.2.tgz#3aa3e1549dfaf3c57ab5eeaba754da3b87f33063"
integrity sha512-rJysbR9GKIalhTbVL2tYbF2hVyDnrf7pFUZBwjPaMIdadYHmeT+EVi/Bu3qd7ETQPahTotg2WRCatXwRBW554g==
dependencies:
cli-truncate "^3.1.0"
colorette "^2.0.20"
Expand Down Expand Up @@ -8927,6 +8952,11 @@ signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7:
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9"
integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==

signal-exit@^4.1.0:
version "4.1.0"
resolved "https://registry.npmmirror.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04"
integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==

single-spa@^5.9.2:
version "5.9.5"
resolved "https://registry.yarnpkg.com/single-spa/-/single-spa-5.9.5.tgz#f47b3c91b009ebc3b224dd1086ef2b2dac524373"
Expand Down Expand Up @@ -9972,10 +10002,10 @@ yallist@^4.0.0:
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==

[email protected].1:
version "2.3.1"
resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.3.1.tgz#02fe0975d23cd441242aa7204e09fc28ac2ac33b"
integrity sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ==
[email protected].3:
version "2.3.3"
resolved "https://registry.npmmirror.com/yaml/-/yaml-2.3.3.tgz#01f6d18ef036446340007db8e016810e5d64aad9"
integrity sha512-zw0VAJxgeZ6+++/su5AFoqBbZbrEakwu+X0M5HmcwUiBL7AzcuPKjj5we4xfQLp78LkEMpD0cOnUhmgOVy3KdQ==

yaml@^1.10.0:
version "1.10.2"
Expand Down
10 changes: 8 additions & 2 deletions docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,13 @@ fuse-ee-image-buildx:
--build-arg JFSCHAN=$(JFS_CHAN) \
--platform linux/amd64,linux/arm64 . --push

.PHONY: dashboard-build
dashboard-build:
docker build --build-context project=../ --build-context ui=../dashboard-ui/ -f dashboard.Dockerfile \
-t $(REGISTRY)/$(DASHBOARD_IMAGE):$(DASHBOARD_TAG) .
docker push $(REGISTRY)/$(DASHBOARD_IMAGE):$(DASHBOARD_TAG)

.PHONY: dashboard-buildx
dashboard-buildx:
docker buildx build --build-context project=../ -f dashboard.Dockerfile -t $(REGISTRY)/$(DASHBOARD_IMAGE):$(DASHBOARD_TAG) \
--platform linux/amd64,linux/arm64 . --push
docker buildx build --build-context project=../ --build-context ui=../dashboard-ui/ -f dashboard.Dockerfile \
-t $(REGISTRY)/$(DASHBOARD_IMAGE):$(DASHBOARD_TAG) --platform linux/amd64,linux/arm64 . --push
9 changes: 1 addition & 8 deletions docker/dashboard.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM node:lts as web-builder
ARG HTTPS_PROXY
ARG HTTP_PROXY
WORKDIR /workspace
COPY --from=project dashboard-ui ./dashboard-ui
RUN cd dashboard-ui && yarn install && yarn run build

FROM golang:1.20-alpine as builder
ARG GOPROXY
ARG HTTPS_PROXY
Expand All @@ -33,6 +26,6 @@ COPY --from=project Makefile .
RUN apk add --no-cache make && make dashboard

FROM alpine:3.18
COPY --from=web-builder /workspace/dashboard-ui/dist /dist
COPY --from=ui dist /dist
COPY --from=builder /workspace/bin/juicefs-csi-dashboard /usr/local/bin/juicefs-csi-dashboard
ENTRYPOINT ["juicefs-csi-dashboard"]

0 comments on commit 3c61006

Please sign in to comment.