Skip to content

Commit

Permalink
feat: update tools
Browse files Browse the repository at this point in the history
  • Loading branch information
JGiola committed Mar 7, 2024
1 parent 459b80f commit 1cc3ec2
Show file tree
Hide file tree
Showing 22 changed files with 49 additions and 48 deletions.
6 changes: 3 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "Go",
"image": "golang:1.21.5",
"image": "golang:1.22.1",
"containerUser": "root",
"features": {
"ghcr.io/devcontainers/features/common-utils:1": {},
"ghcr.io/devcontainers/features/go:1": {"version": "none", "golangciLintVersion": "1.55.2"}
"ghcr.io/devcontainers/features/common-utils:2": {},
"ghcr.io/devcontainers/features/go:1": {"version": "none", "golangciLintVersion": "1.56.2"}
},
"runArgs": [
"--cap-add=SYS_PTRACE",
Expand Down
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# All files
* @mia-platform/sig-cli
# Actions must also be checked by security
.github/actions @mia-platform/sig-cli @mia-platform/sig-security
.github/workflows @mia-platform/sig-cli @mia-platform/sig-security
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ updates:
interval: daily
time: "07:00"
timezone: Europe/Rome

# keep up to date devcontainers
- package-ecosystem: devcontainers
directory: "/"
schedule:
interval: monthly
19 changes: 7 additions & 12 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ on:
- examples/**

env:
GO_VERSION: 1.21.5
GORELEASER_VERSION: v1.22.1
GO_CACHE: true
GORELEASER_VERSION: v1.24.0
jobs:
lint:
name: Lint Code
Expand All @@ -29,7 +27,7 @@ jobs:
- name: Setup Golang
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: ${{ env.GO_VERSION }}
go-version-file: go.mod
cache: false
- name: Set golangci-lint Cache Key
id: create-sha
Expand Down Expand Up @@ -62,7 +60,7 @@ jobs:
- "1.26"
- "1.27"
- "1.28"
# - "1.29"
- "1.29"
runs-on: ${{ matrix.os }}
env:
ENVTEST_K8S_VERSION: ${{matrix.k8s_version}}
Expand All @@ -74,8 +72,7 @@ jobs:
- name: Setup Golang
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: ${{ env.GO_VERSION }}
cache: true
go-version-file: go.mod
- name: Run Test Coverage
run: make ci

Expand All @@ -94,8 +91,7 @@ jobs:
- name: Setup Golang
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: ${{ env.GO_VERSION }}
cache: true
go-version-file: go.mod
- name: Setup Goreleaser
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
with:
Expand All @@ -119,8 +115,7 @@ jobs:
- name: Setup Golang
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: ${{ env.GO_VERSION }}
cache: true
go-version-file: go.mod
- name: Setup Goreleaser
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
with:
Expand All @@ -135,7 +130,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
- name: Upload Binaries Artifacts
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: artifacts
path: bin/
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ on:
- cron: 0 5 * * 1 # Run every monday at 5 UTC

env:
GO_VERSION: 1.21.5
GORELEASER_VERSION: v1.22.1
GORELEASER_VERSION: v1.24.0

jobs:
codeql:
runs-on: ubuntu-latest
runs-on: macos-latest
permissions:
security-events: write
steps:
Expand All @@ -32,8 +31,7 @@ jobs:
- name: Setup Golang
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: ${{ env.GO_VERSION }}
cache: false
go-version-file: go.mod
- name: Setup Goreleaser
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
with:
Expand Down
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.21.5
1.22.1
1 change: 0 additions & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ builds:
{{- .Arch }}/
{{- with .Arm }}v{{ . }}/{{ end }}
{{- .ProjectName }}
no_unique_dist_dir: true
env:
- CGO_ENABLED=0
Expand Down
3 changes: 3 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@ MD029:
MD033:
allowed_elements:
- center
- picture
- source
- img
MD046:
style: fenced
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ repos:
name: Trims trailing whitespace
args: [--markdown-linebreak-ext=md] # add exception for markdown linebreaks
- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.1
rev: v8.18.2
hooks:
- id: gitleaks
name: Protect and discover secrets using Gitleaks
2 changes: 1 addition & 1 deletion cmd/mlp/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func main() {
Use: "version",
Short: "Show mlp version",
Long: "Show mlp version",
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
fmt.Println(versionOutput)
},
})
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/mia-platform/mlp

go 1.21
go 1.22.1

require (
github.com/MakeNowJust/heredoc/v2 v2.0.1
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func DeploySubcommand(cmd *cobra.Command, options *utils.Options) {
Use: "deploy",
Short: "deploy Mia-Platform created resource on K8S",
Long: "",
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
deploy.Run(inputPaths, deployConfig, options)
},
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func GenerateSubcommand(cmd *cobra.Command) {
Use: "generate",
Short: "Generate configmaps and secrets",
Long: `Generate configmaps and secrets described in YAML files passed as input`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
generate.Run(configPath, prefixes, outputPath)
},
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/interpolate.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func InterpolateSubcommand(cmd *cobra.Command) {
Use: "interpolate",
Short: "Interpolate variables in file",
Long: "Interpolate the environment variables inside {{}} in file and substitutes them with the corresponding value",
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
interpolate.Run(prefixes, inputPaths, outputPath)
},
}
Expand Down
4 changes: 2 additions & 2 deletions internal/cli/kustomize.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func HydrateSubcommand(cmd *cobra.Command) {
Short: "Adds passed resource and patches to kustomization.yaml",
Long: "Adds passed resource and patches to kustomization.yaml. The PATH argument must be a path to a directory containing 'kustomization.yaml'",
Example: "$ mlp hydrate configuration/ overlays/production/",
Args: func(cmd *cobra.Command, args []string) error {
Args: func(_ *cobra.Command, args []string) error {
if len(args) < 1 {
return errors.New("at least one directory is required")
}
Expand All @@ -65,7 +65,7 @@ func HydrateSubcommand(cmd *cobra.Command) {
}
return nil
},
RunE: func(cmd *cobra.Command, paths []string) error {
RunE: func(_ *cobra.Command, paths []string) error {
return kustomize.HydrateRun(paths)
},
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/deploy/apply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ func TestWithAwaitableResource(t *testing.T) {
}
expectedErr := errors.New("Some apply error")

actualErr := withAwaitableResource(func(clients *k8sClients, res resourceutil.Resource, deployConfig utils.DeployConfig) error {
actualErr := withAwaitableResource(func(_ *k8sClients, _ resourceutil.Resource, _ utils.DeployConfig) error {
return expectedErr
})(&clients, res, deployConfig)

Expand Down Expand Up @@ -746,7 +746,7 @@ func TestWithDeletableResource(t *testing.T) {
annotations: map[string]interface{}{
deleteBeforeApplyAnnotation: "true",
},
setup: func(t *testing.T, clients *k8sClients, res resourceutil.Resource) { t.Helper() },
setup: func(t *testing.T, _ *k8sClients, _ resourceutil.Resource) { t.Helper() },
requireFn: requireResourceExists(false),
},
}
Expand Down Expand Up @@ -776,7 +776,7 @@ func TestWithDeletableResource(t *testing.T) {
tC.setup(t, &clients, res)

applyCalled := false
err := withDeletableResource(func(clients *k8sClients, res resourceutil.Resource, deployConfig utils.DeployConfig) error {
err := withDeletableResource(func(clients *k8sClients, res resourceutil.Resource, _ utils.DeployConfig) error {
applyCalled = true
tC.requireFn(t, clients, res)
return nil
Expand Down Expand Up @@ -806,7 +806,7 @@ func TestWithDeletableResource(t *testing.T) {
}
expectedErr := errors.New("Some apply error")

actualErr := withAwaitableResource(func(clients *k8sClients, res resourceutil.Resource, deployConfig utils.DeployConfig) error {
actualErr := withAwaitableResource(func(_ *k8sClients, _ resourceutil.Resource, _ utils.DeployConfig) error {
return expectedErr
})(&clients, res, deployConfig)

Expand Down
2 changes: 1 addition & 1 deletion tools/DEEPCOPY_GEN_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.29.0
v0.29.2
2 changes: 1 addition & 1 deletion tools/ENVTEST_K8S_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.27
1.28
2 changes: 1 addition & 1 deletion tools/GOLANGCI_LINT_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.55.2
v1.56.2
2 changes: 1 addition & 1 deletion tools/GORELEASER_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.22.1
v1.24.0
12 changes: 6 additions & 6 deletions tools/make/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ go/build/multiarch:
.PHONY: build-deps
build-deps:

$(TOOLS_BIN)/goreleaser: $(TOOLS_DIR)/GORELEASER_VERSION
$(eval GORELEASER_VERSION:= $(shell cat $<))
mkdir -p $(TOOLS_BIN)
$(info Installing goreleaser $(GORELEASER_VERSION) bin in $(TOOLS_BIN))
GOBIN=$(TOOLS_BIN) go install github.com/goreleaser/goreleaser@$(GORELEASER_VERSION)

build-deps: $(GORELEASER_PATH)

build: build-deps
Expand All @@ -80,3 +74,9 @@ endif

.PHONY: build
build: go/build/$(GOOS)/$(GOARCH)/$(GOARM)

$(TOOLS_BIN)/goreleaser: $(TOOLS_DIR)/GORELEASER_VERSION
$(eval GORELEASER_VERSION:= $(shell cat $<))
mkdir -p $(TOOLS_BIN)
$(info Installing goreleaser $(GORELEASER_VERSION) bin in $(TOOLS_BIN))
GOBIN=$(TOOLS_BIN) go install github.com/goreleaser/goreleaser@$(GORELEASER_VERSION)
6 changes: 3 additions & 3 deletions tools/make/test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test/unit:
.PHONY: test/integration
test/integration:
$(info Running integration tests...)
KUBEBUILDER_ASSETS=$(KUBEBUILDER_ASSETS) go test $(GO_TEST_DEBUG_FLAG) -tags=integration -race ./...
go test $(GO_TEST_DEBUG_FLAG) -tags=integration -race ./...

.PHONY: test/coverage
test/coverage:
Expand All @@ -42,13 +42,13 @@ test/coverage:
.PHONY: test/integration/coverage
test/integration/coverage:
$(info Running ci tests with coverage on...)
KUBEBUILDER_ASSETS=$(KUBEBUILDER_ASSETS) go test -tags=integration -race -coverprofile=coverage.txt -covermode=atomic ./...
go test -tags=integration -race -coverprofile=coverage.txt -covermode=atomic ./...

.PHONY: test/conformance test/conformance/setup test/conformance/teardown
test/conformance/setup:
test/conformance:
$(info Running conformance tests...)
go test -tags=conformance -race $(GO_TEST_DEBUG_FLAG) $(CONFORMANCE_TEST_PATH)
go test -count=1 -tags=conformance -race $(GO_TEST_DEBUG_FLAG) $(CONFORMANCE_TEST_PATH)
test/conformance/teardown:

test/show/coverage:
Expand Down

0 comments on commit 1cc3ec2

Please sign in to comment.