switch to go 1.19 (#1709)
This commit is contained in:
parent
bd2757c63d
commit
1f5224b74b
17 changed files with 46 additions and 73 deletions
8
.github/workflows/bats-hub.yml
vendored
8
.github/workflows/bats-hub.yml
vendored
|
@ -23,10 +23,10 @@ jobs:
|
|||
sudo chmod +w /etc/machine-id
|
||||
echo githubciXXXXXXXXXXXXXXXXXXXXXXXX | sudo tee /etc/machine-id
|
||||
|
||||
- name: "Set up Go 1.17"
|
||||
- name: "Set up Go 1.19"
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.17
|
||||
go-version: 1.19
|
||||
id: go
|
||||
|
||||
- name: "Clone CrowdSec"
|
||||
|
@ -39,8 +39,8 @@ jobs:
|
|||
run: |
|
||||
sudo apt -qq -y -o=Dpkg::Use-Pty=0 install build-essential daemonize jq netcat-openbsd
|
||||
go install github.com/mikefarah/yq/v4@latest
|
||||
go install github.com/cloudflare/cfssl/cmd/cfssl@latest
|
||||
go install github.com/cloudflare/cfssl/cmd/cfssljson@latest
|
||||
go install github.com/cloudflare/cfssl/cmd/cfssl@master
|
||||
go install github.com/cloudflare/cfssl/cmd/cfssljson@master
|
||||
sudo cp -u ~/go/bin/yq /usr/local/bin/
|
||||
sudo cp -u ~/go/bin/cfssl /usr/local/bin
|
||||
sudo cp -u ~/go/bin/cfssljson /usr/local/bin
|
||||
|
|
8
.github/workflows/bats-mysql.yml
vendored
8
.github/workflows/bats-mysql.yml
vendored
|
@ -34,10 +34,10 @@ jobs:
|
|||
sudo chmod +w /etc/machine-id
|
||||
echo githubciXXXXXXXXXXXXXXXXXXXXXXXX | sudo tee /etc/machine-id
|
||||
|
||||
- name: "Set up Go 1.17"
|
||||
- name: "Set up Go 1.19"
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.17
|
||||
go-version: 1.19
|
||||
id: go
|
||||
|
||||
- name: "Check out CrowdSec repository"
|
||||
|
@ -50,8 +50,8 @@ jobs:
|
|||
run: |
|
||||
sudo apt -qq -y -o=Dpkg::Use-Pty=0 install build-essential daemonize jq netcat-openbsd
|
||||
go install github.com/mikefarah/yq/v4@latest
|
||||
go install github.com/cloudflare/cfssl/cmd/cfssl@latest
|
||||
go install github.com/cloudflare/cfssl/cmd/cfssljson@latest
|
||||
go install github.com/cloudflare/cfssl/cmd/cfssl@master
|
||||
go install github.com/cloudflare/cfssl/cmd/cfssljson@master
|
||||
sudo cp -u ~/go/bin/yq ~/go/bin/cfssl ~/go/bin/cfssljson /usr/local/bin/
|
||||
|
||||
- name: "Build crowdsec and fixture"
|
||||
|
|
8
.github/workflows/bats-postgres.yml
vendored
8
.github/workflows/bats-postgres.yml
vendored
|
@ -35,10 +35,10 @@ jobs:
|
|||
sudo chmod +w /etc/machine-id
|
||||
echo githubciXXXXXXXXXXXXXXXXXXXXXXXX | sudo tee /etc/machine-id
|
||||
|
||||
- name: "Set up Go 1.17"
|
||||
- name: "Set up Go 1.19"
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.17
|
||||
go-version: 1.19
|
||||
id: go
|
||||
|
||||
- name: "Check out CrowdSec repository"
|
||||
|
@ -51,8 +51,8 @@ jobs:
|
|||
run: |
|
||||
sudo apt -qq -y -o=Dpkg::Use-Pty=0 install build-essential daemonize jq netcat-openbsd
|
||||
go install github.com/mikefarah/yq/v4@latest
|
||||
go install github.com/cloudflare/cfssl/cmd/cfssl@latest
|
||||
go install github.com/cloudflare/cfssl/cmd/cfssljson@latest
|
||||
go install github.com/cloudflare/cfssl/cmd/cfssl@master
|
||||
go install github.com/cloudflare/cfssl/cmd/cfssljson@master
|
||||
sudo cp -u ~/go/bin/yq ~/go/bin/cfssl ~/go/bin/cfssljson /usr/local/bin/
|
||||
|
||||
- name: "Build crowdsec and fixture (DB_BACKEND: pgx)"
|
||||
|
|
8
.github/workflows/bats-sqlite-coverage.yml
vendored
8
.github/workflows/bats-sqlite-coverage.yml
vendored
|
@ -21,10 +21,10 @@ jobs:
|
|||
sudo chmod +w /etc/machine-id
|
||||
echo githubciXXXXXXXXXXXXXXXXXXXXXXXX | sudo tee /etc/machine-id
|
||||
|
||||
- name: "Set up Go 1.17"
|
||||
- name: "Set up Go 1.19"
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.17
|
||||
go-version: 1.19
|
||||
id: go
|
||||
|
||||
- name: "Check out CrowdSec repository"
|
||||
|
@ -37,8 +37,8 @@ jobs:
|
|||
run: |
|
||||
sudo apt -qq -y -o=Dpkg::Use-Pty=0 install build-essential daemonize jq netcat-openbsd
|
||||
go install github.com/mikefarah/yq/v4@latest
|
||||
go install github.com/cloudflare/cfssl/cmd/cfssl@latest
|
||||
go install github.com/cloudflare/cfssl/cmd/cfssljson@latest
|
||||
go install github.com/cloudflare/cfssl/cmd/cfssl@master
|
||||
go install github.com/cloudflare/cfssl/cmd/cfssljson@master
|
||||
sudo cp -u ~/go/bin/yq ~/go/bin/cfssl ~/go/bin/cfssljson /usr/local/bin/
|
||||
go install github.com/wadey/gocovmerge@latest
|
||||
sudo cp -u ~/go/bin/gocovmerge /usr/local/bin/
|
||||
|
|
4
.github/workflows/ci-windows-build-msi.yml
vendored
4
.github/workflows/ci-windows-build-msi.yml
vendored
|
@ -14,10 +14,10 @@ jobs:
|
|||
name: Build
|
||||
runs-on: windows-2019
|
||||
steps:
|
||||
- name: Set up Go 1.17
|
||||
- name: Set up Go 1.19
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.17
|
||||
go-version: 1.19
|
||||
id: go
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
|
31
.github/workflows/ci_golangci-lint-windows.yml
vendored
31
.github/workflows/ci_golangci-lint-windows.yml
vendored
|
@ -1,31 +0,0 @@
|
|||
name: golangci-lint (windows)
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
- 'mkdocs.yml'
|
||||
- 'README.md'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
- 'mkdocs.yml'
|
||||
- 'README.md'
|
||||
jobs:
|
||||
golangci:
|
||||
name: lint
|
||||
runs-on: windows-2022
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v3
|
||||
with:
|
||||
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
|
||||
version: v1.48
|
||||
# Optional: golangci-lint command line arguments.
|
||||
args: --issues-exit-code=0 --timeout 10m
|
||||
only-new-issues: true
|
9
.github/workflows/ci_golangci-lint.yml
vendored
9
.github/workflows/ci_golangci-lint.yml
vendored
|
@ -1,4 +1,4 @@
|
|||
name: golangci-lint (linux)
|
||||
name: golangci-lint
|
||||
|
||||
on:
|
||||
push:
|
||||
|
@ -17,8 +17,11 @@ on:
|
|||
- 'README.md'
|
||||
jobs:
|
||||
golangci:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-2022]
|
||||
name: lint
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: golangci-lint
|
||||
|
@ -27,7 +30,7 @@ jobs:
|
|||
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
|
||||
version: v1.48
|
||||
# Optional: golangci-lint command line arguments.
|
||||
args: --issues-exit-code=1 --timeout 5m
|
||||
args: --issues-exit-code=1 --timeout 10m
|
||||
# Optional: show only new issues if it's a pull request. The default value is `false`.
|
||||
only-new-issues: false
|
||||
# Optional: if set to true then the all caching functionality will be complete disabled,
|
||||
|
|
4
.github/workflows/go-tests-windows.yml
vendored
4
.github/workflows/go-tests-windows.yml
vendored
|
@ -21,10 +21,10 @@ jobs:
|
|||
|
||||
steps:
|
||||
|
||||
- name: "Set up Go 1.17"
|
||||
- name: "Set up Go 1.19"
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.17
|
||||
go-version: 1.19
|
||||
id: go
|
||||
|
||||
- name: Check out CrowdSec repository
|
||||
|
|
4
.github/workflows/go-tests.yml
vendored
4
.github/workflows/go-tests.yml
vendored
|
@ -58,10 +58,10 @@ jobs:
|
|||
|
||||
steps:
|
||||
|
||||
- name: "Set up Go 1.17"
|
||||
- name: "Set up Go 1.19"
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.17
|
||||
go-version: 1.19
|
||||
id: go
|
||||
|
||||
- name: Check out CrowdSec repository
|
||||
|
|
|
@ -10,10 +10,10 @@ jobs:
|
|||
name: Build and upload binary package
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Go 1.17
|
||||
- name: Set up Go 1.19
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.17
|
||||
go-version: 1.19
|
||||
id: go
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v3
|
||||
|
@ -29,10 +29,10 @@ jobs:
|
|||
name: Build and upload binary package
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Go 1.17
|
||||
- name: Set up Go 1.19
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.17
|
||||
go-version: 1.19
|
||||
id: go
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v3
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
ARG GOVERSION=1.17
|
||||
ARG GOVERSION=1.19
|
||||
|
||||
FROM golang:${GOVERSION}-alpine AS build
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
ARG GOVERSION=1.17
|
||||
ARG GOVERSION=1.19
|
||||
|
||||
FROM golang:${GOVERSION}-bullseye AS build
|
||||
|
||||
|
|
|
@ -25,9 +25,9 @@ stages:
|
|||
custom: 'tool'
|
||||
arguments: 'install --global SignClient --version 1.3.155'
|
||||
- task: GoTool@0
|
||||
displayName: "Install Go 1.17"
|
||||
displayName: "Install Go 1.19"
|
||||
inputs:
|
||||
version: '1.17.9'
|
||||
version: '1.19'
|
||||
|
||||
- pwsh: |
|
||||
choco install -y jq
|
||||
|
|
2
go.mod
2
go.mod
|
@ -1,6 +1,6 @@
|
|||
module github.com/crowdsecurity/crowdsec
|
||||
|
||||
go 1.17
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
entgo.io/ent v0.10.1
|
||||
|
|
|
@ -445,7 +445,6 @@ READLOOP:
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
type MockTailError struct {
|
||||
MockTail
|
||||
}
|
||||
|
@ -493,11 +492,10 @@ READLOOP:
|
|||
}
|
||||
}
|
||||
|
||||
//nolint: structcheck,unused
|
||||
type MockSourceByDSN struct {
|
||||
configuration.DataSourceCommonCfg `yaml:",inline"`
|
||||
Toto string `yaml:"toto"`
|
||||
logger *log.Entry
|
||||
logger *log.Entry //nolint: unused
|
||||
}
|
||||
|
||||
func (f *MockSourceByDSN) Configure(cfg []byte, logger *log.Entry) error { return nil }
|
||||
|
|
|
@ -3,6 +3,7 @@ package journalctlacquisition
|
|||
import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"testing"
|
||||
"time"
|
||||
|
@ -279,7 +280,9 @@ journalctl_filter:
|
|||
|
||||
func TestMain(m *testing.M) {
|
||||
if os.Getenv("USE_SYSTEM_JOURNALCTL") == "" {
|
||||
os.Setenv("PATH", "./test_files"+":"+os.Getenv("PATH"))
|
||||
currentDir, _ := os.Getwd()
|
||||
fullPath := filepath.Join(currentDir, "test_files")
|
||||
os.Setenv("PATH", fullPath+":"+os.Getenv("PATH"))
|
||||
}
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
)
|
||||
|
||||
/*
|
||||
Due to the complexity of file permission modification with go on windows, we only test the basic behaviour the broker,
|
||||
Due to the complexity of file permission modification with go on windows, we only test the basic behavior the broker,
|
||||
not if it will actually reject plugins with invalid permissions
|
||||
*/
|
||||
|
||||
|
|
Loading…
Reference in a new issue