Skip to content

Commit

Permalink
Upgrade to use Go v1.20.6, NodeJS v18.17.0 and golangci-lint v1.53.3 (#…
Browse files Browse the repository at this point in the history
…6248)

* Upgrade Go to v1.20.6 and NodeJS to v18.17.0

- Updated golangci-lint to v1.53.3 (latest)

* Update caniuse-lite

* fix lint issue with naken return

* update golanci-lint

* fix more lint issues

* Revert resolve ref test change, addressed in a different pr

* remove golangci-lint from tools.go use 'go run' with golangci-lint
  • Loading branch information
nopcoder authored and rmoff committed Jul 26, 2023
1 parent 9706fc9 commit 32948a7
Show file tree
Hide file tree
Showing 23 changed files with 216 additions and 688 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ jobs:
- name: Set up NodeJS
uses: actions/setup-node@v3
with:
node-version: '16.17.1'
node-version: "18.17.0"

- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.19.2
go-version: "1.20.6"

- name: Generate code
env:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/compatibility-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.19.2
go-version: "1.20.6"
id: go

- uses: actions/setup-node@v3
with:
node-version: "16.17.1"
node-version: "18.17.0"

- uses: actions/setup-java@v3
with:
Expand Down Expand Up @@ -73,12 +73,12 @@ jobs:
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: "16.17.1"
node-version: "18.17.0"

- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.19.2
go-version: "1.20.6"
id: go

- name: Retrieve generated code
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker-publish-exp-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ jobs:
- name: Set up NodeJS
uses: actions/setup-node@v3
with:
node-version: '16.17.1'
node-version: "18.17.0"

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19.2
go-version: "1.20.6"
id: go

- name: Extract version
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docker-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ jobs:
- name: Set up NodeJS
uses: actions/setup-node@v3
with:
node-version: '16.17.1'
node-version: "18.17.0"

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19.2
go-version: "1.20.6"
id: go

- name: Extract version
Expand Down Expand Up @@ -99,4 +99,4 @@ jobs:
tags: |
${{ steps.login-ecr.outputs.registry }}/lakefs:${{ steps.version.outputs.tag }}
treeverse/lakefs:${{ steps.version.outputs.tag }}
treeverse/lakefs:latest
treeverse/lakefs:latest
8 changes: 4 additions & 4 deletions .github/workflows/esti.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
if: steps.restore-cache.outputs.cache-hit != 'true'
uses: actions/setup-go@v3
with:
go-version: 1.19.2
go-version: "1.20.6"
id: go

- name: Generate code
Expand Down Expand Up @@ -191,7 +191,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.19.2
go-version: "1.20.6"
id: go

- name: Restore cache
Expand Down Expand Up @@ -394,7 +394,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.19.2
go-version: "1.20.6"
id: go

- name: Generate uniquifying value
Expand Down Expand Up @@ -496,7 +496,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.19.2
go-version: "1.20.6"
id: go

- name: Generate uniquifying value
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ jobs:
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: '16.17.1'
node-version: "18.17.0"

- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.19.2
go-version: "1.20.6"

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16.17.1'
cache: 'npm'
node-version: "18.17.0"
cache: "npm"
cache-dependency-path: webui/package-lock.json
- name: install UI dependencies
run: npm ci
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.19.2
go-version: "1.20.6"
id: go
- name: Generate code
env:
Expand All @@ -37,7 +37,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.19.2
go-version: "1.20.6"
id: go
# No way to share code between workflows :-( If you change this, find and change the
# same code wherever "Find Go module and build caches" appears!
Expand Down
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ linters:
disable-all: true
enable:
- bodyclose
- depguard
- dogsled
- errcheck
- gochecknoinits
Expand Down
32 changes: 17 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build lakeFS
FROM --platform=$BUILDPLATFORM golang:1.19.2-alpine3.16 AS build
FROM --platform=$BUILDPLATFORM golang:1.20.6-alpine3.18 AS build

ARG VERSION=dev

Expand Down Expand Up @@ -28,14 +28,14 @@ RUN --mount=type=cache,target=/root/.cache/go-build \


# Build delta diff binary
FROM --platform=$BUILDPLATFORM rust:1.68-alpine3.16 AS build-delta-diff-plugin
FROM --platform=$BUILDPLATFORM rust:1.71-alpine3.18 AS build-delta-diff-plugin
RUN apk update && apk add build-base pkgconfig openssl-dev alpine-sdk
RUN cargo new --bin delta-diff
WORKDIR /delta-diff

# 2. Copy our manifests
COPY ./pkg/plugins/diff/delta_diff_server/Cargo.lock ./Cargo.lock
COPY ./pkg/plugins/diff/delta_diff_server/Cargo.toml ./Cargo.toml
COPY ./pkg/plugins/diff/delta_diff_server/Cargo.lock ./
COPY ./pkg/plugins/diff/delta_diff_server/Cargo.toml ./

# 3. Build only the dependencies to cache them in this layer

Expand All @@ -53,8 +53,10 @@ RUN rm ./target/release/deps/delta_diff*
RUN RUSTFLAGS=-Ctarget-feature=-crt-static cargo build --release

# Just lakectl
FROM --platform=$BUILDPLATFORM alpine:3.16.0 AS lakectl
FROM --platform=$BUILDPLATFORM alpine:3.18 AS lakectl

RUN apk add -U --no-cache ca-certificates

WORKDIR /app
ENV PATH /app:$PATH
COPY --from=build /build/lakectl ./
Expand All @@ -64,11 +66,9 @@ WORKDIR /home/lakefs
ENTRYPOINT ["/app/lakectl"]

# lakefs with lakectl
FROM --platform=$BUILDPLATFORM alpine:3.16.0 AS lakefs
FROM --platform=$BUILDPLATFORM alpine:3.18 AS lakefs

RUN apk add -U --no-cache ca-certificates
# Be Docker compose friendly (i.e. support wait-for)
RUN apk add netcat-openbsd
RUN apk add -U --no-cache ca-certificates netcat-openbsd

WORKDIR /app
COPY ./scripts/wait-for ./
Expand All @@ -86,12 +86,14 @@ ENTRYPOINT ["/app/lakefs"]
CMD ["run"]

# Include lakefs-plugins
FROM --platform=$BUILDPLATFORM alpine:3.16.0 AS lakefs-plugins

RUN apk add -U --no-cache ca-certificates
RUN apk add openssl-dev libc6-compat alpine-sdk
# Be Docker compose friendly (i.e. support wait-for)
RUN apk add netcat-openbsd
FROM --platform=$BUILDPLATFORM alpine:3.18 AS lakefs-plugins

RUN apk add -U --no-cache \
alpine-sdk \
ca-certificates \
libc6-compat \
netcat-openbsd \
openssl-dev

WORKDIR /app
COPY ./scripts/wait-for ./
Expand Down
15 changes: 7 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ CLIENT_JARS_BUCKET="s3://treeverse-clients-us-east/"
OPENAPI_GENERATOR_IMAGE=openapitools/openapi-generator-cli:v5.3.0
OPENAPI_GENERATOR=$(DOCKER) run --user $(UID_GID) --rm -v $(shell pwd):/mnt $(OPENAPI_GENERATOR_IMAGE)

GOLANGCI_LINT_VERSION=v1.53.3

ifndef PACKAGE_VERSION
PACKAGE_VERSION=0.1.0-SNAPSHOT
endif
Expand Down Expand Up @@ -102,11 +104,8 @@ gen-docs: ## Generate CLI docs automatically
gen-metastore: ## Run Metastore Code generation
@thrift -r --gen go --gen go:package_prefix=github.com/treeverse/lakefs/pkg/metastore/hive/gen-go/ -o pkg/metastore/hive pkg/metastore/hive/hive_metastore.thrift

go-mod-download: ## Download module dependencies
$(GOCMD) mod download

go-install: go-mod-download ## Install dependencies
$(GOCMD) install github.com/golangci/golangci-lint/cmd/golangci-lint
tools: ## Install tools
$(GOCMD) install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
$(GOCMD) install google.golang.org/protobuf/cmd/protoc-gen-go


Expand Down Expand Up @@ -165,8 +164,8 @@ build: gen docs ## Download dependencies and build the default binary
$(GOBUILD) -o $(LAKEFS_BINARY_NAME) -ldflags $(LD_FLAGS) -v ./cmd/$(LAKEFS_BINARY_NAME)
$(GOBUILD) -o $(LAKECTL_BINARY_NAME) -ldflags $(LD_FLAGS) -v ./cmd/$(LAKECTL_BINARY_NAME)

lint: go-install ## Lint code
$(GOBINPATH)/golangci-lint run $(GOLANGCI_LINT_FLAGS)
lint: ## Lint code
$(GOCMD) run github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) run $(GOLANGCI_LINT_FLAGS)
npx eslint $(UI_DIR)/src --ext .js,.jsx,.ts,.tsx

esti: ## run esti (system testing)
Expand Down Expand Up @@ -255,7 +254,7 @@ $(UI_DIR)/node_modules:
gen-ui: $(UI_DIR)/node_modules ## Build UI web app
cd $(UI_DIR) && $(NPM) run build

proto: go-install ## Build proto (Protocol Buffers) files
proto: tools ## Build proto (Protocol Buffers) files
$(PROTOC) --proto_path=pkg/actions --go_out=pkg/actions --go_opt=paths=source_relative actions.proto
$(PROTOC) --proto_path=pkg/auth/model --go_out=pkg/auth/model --go_opt=paths=source_relative model.proto
$(PROTOC) --proto_path=pkg/catalog --go_out=pkg/catalog --go_opt=paths=source_relative catalog.proto
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ class CountedIteratorSpec extends AnyFunSpec with Matchers {

class GolangContainerSpec extends AnyFunSpec with ForAllTestContainer {
override val container: GenericContainer = GenericContainer(
"golang:1.16.2-alpine",
"golang:1.20.6-alpine",
classpathResourceMapping = Seq(
FileSystemBind("parser-test/sst_files_generator.go", "/local/sst_files_generator.go", BindMode.READ_WRITE),
FileSystemBind("parser-test/go.mod", "/local/go.mod", BindMode.READ_WRITE),
Expand Down
2 changes: 1 addition & 1 deletion esti/ops/docker-compose-dynamodb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ services:
ports:
- "6432:8000"
esti:
image: "golang:1.19.2-alpine3.16"
image: "golang:1.20.6-alpine3.18"
links:
- lakefs:s3.local.lakefs.io
- lakefs:testmultipartupload.s3.local.lakefs.io
Expand Down
2 changes: 1 addition & 1 deletion esti/ops/docker-compose-external-db.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ services:
- AZURE_TENANT_ID
entrypoint: [ "/app/lakefs", "run" ]
esti:
image: "golang:1.19.2-alpine3.16"
image: "golang:1.20.6-alpine3.18"
links:
- lakefs:s3.local.lakefs.io
- lakefs:testmultipartupload.s3.local.lakefs.io
Expand Down
2 changes: 1 addition & 1 deletion esti/ops/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ services:
POSTGRES_USER: lakefs
POSTGRES_PASSWORD: lakefs
esti:
image: "golang:1.19.2-alpine3.16"
image: "golang:1.20.6-alpine3.18"
links:
- lakefs:s3.local.lakefs.io
- lakefs:testmultipartupload.s3.local.lakefs.io
Expand Down
Loading

0 comments on commit 32948a7

Please sign in to comment.