switch to node version specified in .nvmrc file (#2225)

This commit is contained in:
Pedro Juarez
2022-08-05 17:54:47 -07:00
committed by GitHub
parent ddd25a20eb
commit 919232261d
8 changed files with 103 additions and 40 deletions

View File

@@ -289,12 +289,18 @@ jobs:
with:
go-version: ${{ matrix.go-version }}
id: go
- uses: actions/setup-node@v2
with:
node-version: '17'
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Read .nvmrc
id: node_version
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
- uses: actions/setup-node@v2
with:
node-version: ${{ env.NVMRC }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
@@ -387,12 +393,18 @@ jobs:
with:
go-version: ${{ matrix.go-version }}
id: go
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Read .nvmrc
id: node_version
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
- uses: actions/setup-node@v2
with:
node-version: ${{ env.NVMRC }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
@@ -466,12 +478,18 @@ jobs:
with:
go-version: ${{ matrix.go-version }}
id: go
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Read .nvmrc
id: node_version
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
- uses: actions/setup-node@v2
with:
node-version: ${{ env.NVMRC }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
@@ -545,12 +563,18 @@ jobs:
with:
go-version: ${{ matrix.go-version }}
id: go
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Read .nvmrc
id: node_version
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
- uses: actions/setup-node@v2
with:
node-version: ${{ env.NVMRC }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
@@ -626,11 +650,14 @@ jobs:
with:
go-version: ${{ matrix.go-version }}
id: go
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Read .nvmrc
id: node_version
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
- uses: actions/setup-node@v2
with:
node-version: ${{ env.NVMRC }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
@@ -695,11 +722,14 @@ jobs:
with:
go-version: ${{ matrix.go-version }}
id: go
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Read .nvmrc
id: node_version
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
- uses: actions/setup-node@v2
with:
node-version: ${{ env.NVMRC }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
@@ -764,11 +794,14 @@ jobs:
with:
go-version: ${{ matrix.go-version }}
id: go
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Read .nvmrc
id: node_version
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
- uses: actions/setup-node@v2
with:
node-version: ${{ env.NVMRC }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
@@ -833,11 +866,14 @@ jobs:
with:
go-version: ${{ matrix.go-version }}
id: go
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Read .nvmrc
id: node_version
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
- uses: actions/setup-node@v2
with:
node-version: ${{ env.NVMRC }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
@@ -902,11 +938,14 @@ jobs:
with:
go-version: ${{ matrix.go-version }}
id: go
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Read .nvmrc
id: node_version
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
- uses: actions/setup-node@v2
with:
node-version: ${{ env.NVMRC }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
@@ -971,12 +1010,18 @@ jobs:
with:
go-version: ${{ matrix.go-version }}
id: go
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Read .nvmrc
id: node_version
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
- uses: actions/setup-node@v2
with:
node-version: ${{ env.NVMRC }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
@@ -1050,11 +1095,18 @@ jobs:
with:
go-version: ${{ matrix.go-version }}
id: go
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Read .nvmrc
id: node_version
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
- uses: actions/setup-node@v2
with:
node-version: ${{ env.NVMRC }}
- uses: actions/cache@v2
name: Go Mod Cache
with:

1
.nvmrc Normal file
View File

@@ -0,0 +1 @@
17

View File

@@ -1,4 +1,5 @@
FROM node:17 as uilayer
ARG NODE_VERSION
FROM node:$NODE_VERSION as uilayer
WORKDIR /app

View File

@@ -1,4 +1,5 @@
FROM node:17 as uilayer
ARG NODE_VERSION
FROM node:$NODE_VERSION as uilayer
WORKDIR /app

View File

@@ -6,6 +6,7 @@ BUILD_TIME:=$(shell date 2>/dev/null)
TAG ?= "minio/console:$(BUILD_VERSION)-dev"
MINIO_VERSION ?= "quay.io/minio/minio:latest"
TARGET_BUCKET ?= "target"
NODE_VERSION := $(shell cat .nvmrc)
default: console
@@ -15,7 +16,7 @@ console:
@(GO111MODULE=on CGO_ENABLED=0 go build -trimpath --tags=kqueue,operator --ldflags "-s -w" -o console ./cmd/console)
k8sdev:
@docker build -t $(TAG) --build-arg build_version=$(BUILD_VERSION) --build-arg build_time='$(BUILD_TIME)' .
@docker build -t $(TAG) --build-arg build_version=$(BUILD_VERSION) --build-arg build_time='$(BUILD_TIME)' --build-arg NODE_VERSION='$(NODE_VERSION)' .
@kind load docker-image $(TAG)
@echo "Done, now restart your console deployment"
@@ -63,7 +64,8 @@ swagger-operator:
@swagger generate server -A operator --main-package=operator --server-package=operatorapi --exclude-main -P models.Principal -f ./swagger-operator.yml -r NOTICE
assets:
@(cd portal-ui; yarn install --prefer-offline; make build-static; yarn prettier --write . --loglevel warn; cd ..)
@(if [ -f "${NVM_DIR}/nvm.sh" ]; then \. "${NVM_DIR}/nvm.sh" && nvm install && nvm use && npm install -g yarn ; fi &&\
cd portal-ui; yarn install --prefer-offline; make build-static; yarn prettier --write . --loglevel warn; cd ..)
test-integration:
@(docker stop pgsqlcontainer || true)
@@ -261,7 +263,7 @@ clean:
@rm -vf console
docker:
@docker buildx build --output=type=docker --platform linux/amd64 -t $(TAG) --build-arg build_version=$(BUILD_VERSION) --build-arg build_time='$(BUILD_TIME)' .
@docker buildx build --output=type=docker --platform linux/amd64 -t $(TAG) --build-arg build_version=$(BUILD_VERSION) --build-arg build_time='$(BUILD_TIME)' --build-arg NODE_VERSION='$(NODE_VERSION)' .
release: swagger-gen
@echo "Generating Release: $(RELEASE)"

View File

@@ -2,7 +2,8 @@ default: build-static
build-static:
@echo "Building frontend static assets to 'build'"
NODE_OPTIONS=--openssl-legacy-provider yarn build
@if [ -f "${NVM_DIR}/nvm.sh" ]; then \. "${NVM_DIR}/nvm.sh" && nvm install && nvm use; fi && \
NODE_OPTIONS=--openssl-legacy-provider yarn build
test-warnings:
./check-warnings.sh

View File

@@ -1,4 +1,9 @@
#!/bin/bash
if [ -f "$NVM_DIR/nvm.sh" ]
then
\. "$NVM_DIR/nvm.sh";
nvm use;
fi
yarn install
yarn prettier --check .

View File

@@ -10,7 +10,7 @@ die() {
try() { "$@" &> yarn.log || die "cannot $*"; }
rm yarn.log
rm -f yarn.log
try make build-static
if cat yarn.log | grep "Compiled with warnings"; then