Skip to content

Commit

Permalink
Add ci for dashboard-v2 (#994)
Browse files Browse the repository at this point in the history
* Add ci for dashboard-v2
* delete test paths

Signed-off-by: Xuhui zhang <[email protected]>
  • Loading branch information
zxh326 authored Jun 21, 2024
1 parent de691ff commit 46bc28d
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 32 deletions.
39 changes: 27 additions & 12 deletions .github/workflows/dashboard-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- 'Makefile'
- 'docker/Makefile'
- 'docker/dashboard.Dockerfile'
- 'dashboard-ui/*'
- 'dashboard-ui-v2/*'
- 'cmd/dashboard/*'
- 'pkg/dashboard/*'
pull_request:
Expand All @@ -18,7 +18,7 @@ on:
- 'Makefile'
- 'docker/Makefile'
- 'docker/dashboard.Dockerfile'
- 'dashboard-ui/*'
- 'dashboard-ui-v2/*'
- 'cmd/dashboard/*'
- 'pkg/dashboard/*'

Expand All @@ -28,17 +28,32 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set Node.js 18.18.0
uses: actions/setup-node@v3
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
node-version: 18.18.0
- name: Run install
uses: borales/actions-yarn@v4
version: 9
run_install: false
- name: Set Node.js 20
uses: actions/setup-node@v4
with:
dir: dashboard-ui
cmd: install # will run `yarn install` command
- name: Build dashboard
run: make dashboard-dist

node-version: 20
cache: pnpm
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: cd dashboard-ui-v2 && pnpm install
- name: Lint dashboard
run: cd dashboard-ui-v2 && pnpm run lint
- name: Build dashboard
run: make dashboard-dist
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ test-sanity:

.PHONY: dashboard-dist
dashboard-dist:
cd dashboard-ui && yarn run build
cd dashboard-ui-v2 && pnpm run build

.PHONY: dashboard
dashboard:
mkdir -p bin
go build -tags=jsoniter -ldflags ${LDFLAGS} -o bin/juicefs-csi-dashboard ./cmd/dashboard/
CGO_ENABLED=0 go build -tags=jsoniter -ldflags ${LDFLAGS} -o bin/juicefs-csi-dashboard ./cmd/dashboard/

.PHONY: dashboard-dev
dashboard-dev: dashboard
Expand Down
4 changes: 2 additions & 2 deletions dashboard-ui-v2/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,9 @@ export const omitPod = (pod: Pod) => {
}

export const scParameter = (sc: StorageClass) => {
let parameters: string[] = []
const parameters: string[] = []
for (const key in sc.parameters) {
if (sc.parameters.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(sc.parameters, key)) {
const value = sc.parameters[key]
parameters.push(`${key}: ${value}`)
}
Expand Down
4 changes: 2 additions & 2 deletions docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,11 @@ fuse-ee-image-4.0-buildx:
################# JuiceFS image for dashboard #######################
.PHONY: dashboard-build
dashboard-build:
docker build --build-context project=../ --build-context ui=../dashboard-ui/ -f dashboard.Dockerfile \
docker build --build-context project=../ --build-context ui=../dashboard-ui/ --build-context bin/=../bin/ -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=../ --build-context ui=../dashboard-ui/ -f dashboard.Dockerfile \
docker buildx build --build-context project=../ --build-context ui=../dashboard-ui/ --build-context bin/=../bin/ -f dashboard.Dockerfile \
-t $(REGISTRY)/$(DASHBOARD_IMAGE):$(DASHBOARD_TAG) --platform linux/amd64,linux/arm64 . --push
15 changes: 1 addition & 14 deletions docker/dashboard.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1.20-alpine as builder
ARG GOPROXY
ARG HTTPS_PROXY
ARG HTTP_PROXY
WORKDIR /workspace
COPY --from=project **/*.go ./
COPY --from=project cmd ./cmd
COPY --from=project pkg ./pkg
COPY --from=project go.mod .
COPY --from=project go.sum .
COPY --from=project Makefile .
RUN apk add --no-cache make && make dashboard

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

0 comments on commit 46bc28d

Please sign in to comment.