Skip to content

Commit 6c22b30

Browse files
authored
build: Upgrade everything and use nix flakes for go tools (#135)
1 parent 9c6ff0d commit 6c22b30

File tree

16 files changed

+279
-109
lines changed

16 files changed

+279
-109
lines changed

.github/dependabot.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ updates:
1313
schedule:
1414
interval: "weekly"
1515

16+
- package-ecosystem: "npm"
17+
directory: "/docs"
18+
schedule:
19+
interval: "weekly"
20+
1621
- package-ecosystem: "github-actions"
1722
directory: "/"
1823
schedule:

.go-tools

Lines changed: 0 additions & 2 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ repos:
5555
- id: actionlint-system
5656
stages: [commit]
5757
- repo: https://github.com/hadolint/hadolint
58-
rev: v2.12.0
58+
rev: v2.12.1-beta
5959
hooks:
6060
- id: hadolint
6161
- repo: https://github.com/jorisroovers/gitlint
@@ -73,19 +73,19 @@ repos:
7373
- id: script-must-have-extension
7474
stages: [commit]
7575
- repo: https://github.com/shellcheck-py/shellcheck-py
76-
rev: v0.9.0.2
76+
rev: v0.9.0.5
7777
hooks:
7878
- id: shellcheck
7979
stages: [commit]
8080
args: ["-e", "SC2211", "-x"]
8181
- repo: https://github.com/igorshubovych/markdownlint-cli
82-
rev: v0.34.0
82+
rev: v0.36.0
8383
hooks:
8484
- id: markdownlint
8585
stages: [commit]
8686
exclude: ^(CHANGELOG.md|charts/.+/README.md)$
8787
- repo: https://github.com/Lucas-C/pre-commit-hooks
88-
rev: v1.5.1
88+
rev: v1.5.4
8989
hooks:
9090
- id: insert-license
9191
name: License headers - Go
@@ -118,7 +118,7 @@ repos:
118118
- <!--|| -->
119119
- --use-current-year
120120
- repo: https://github.com/norwoodj/helm-docs
121-
rev: v1.11.0
121+
rev: v1.11.1
122122
hooks:
123123
- id: helm-docs
124124
stages: [commit]

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# hadolint ignore=DL3029
77
FROM --platform=linux/amd64 gcr.io/distroless/static@sha256:1b4dbd7d38a0fd4bbaf5216a21a615d07b56747a96d3c650689cbb7fdc412b49 as linux-amd64
88
# hadolint ignore=DL3029
9-
FROM --platform=linux/arm64 gcr.io/distroless/static@sha256:05810557ec4b4bf01f4df548c06cc915bb29d81cb339495fe1ad2e668434bf8e as linux-arm64
9+
FROM --platform=linux/arm64 gcr.io/distroless/static@sha256:dcf9c9cafaa9c328eff2ceff5f6057588336b48c9b91ddc0913102b33bbce723 as linux-arm64
1010

1111
# hadolint ignore=DL3006,DL3029
1212
FROM --platform=linux/${TARGETARCH} linux-${TARGETARCH}

devbox.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"gnumake@latest",
1414
"gnused@latest",
1515
"go@latest",
16+
"path:./hack/flakes/go-mod-upgrade",
1617
"gojq@latest",
1718
"path:./hack/flakes/golangci-lint",
1819
"golines@latest",
@@ -28,6 +29,7 @@
2829
"kubernetes-helm@latest",
2930
"kustomize@latest",
3031
"pre-commit@latest",
32+
"path:./hack/flakes/setup-envtest",
3133
"shfmt@latest",
3234
"upx@latest",
3335
"yamale@latest",

devbox.lock

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@
4444
"version": "2.1.0"
4545
},
4646
"ginkgo@latest": {
47-
"last_modified": "2023-06-30T04:44:22Z",
48-
"resolved": "github:NixOS/nixpkgs/3c614fbc76fc152f3e1bc4b2263da6d90adf80fb#ginkgo",
47+
"last_modified": "2023-09-04T16:24:30Z",
48+
"resolved": "github:NixOS/nixpkgs/3c15feef7770eb5500a4b8792623e2d6f598c9c1#ginkgo",
4949
"source": "devbox-search",
50-
"version": "2.11.0"
50+
"version": "2.12.0"
5151
},
5252
"git@latest": {
5353
"last_modified": "2023-07-23T03:35:12Z",
@@ -98,10 +98,10 @@
9898
"version": "433.0.1"
9999
},
100100
"goreleaser@latest": {
101-
"last_modified": "2023-07-23T03:35:12Z",
102-
"resolved": "github:NixOS/nixpkgs/af8cd5ded7735ca1df1a1174864daab75feeb64a#goreleaser",
101+
"last_modified": "2023-09-04T16:24:30Z",
102+
"resolved": "github:NixOS/nixpkgs/3c15feef7770eb5500a4b8792623e2d6f598c9c1#goreleaser",
103103
"source": "devbox-search",
104-
"version": "1.19.2"
104+
"version": "1.20.0"
105105
},
106106
"gotestsum@latest": {
107107
"last_modified": "2023-07-23T03:35:12Z",
@@ -140,16 +140,16 @@
140140
"version": "3.11.1"
141141
},
142142
"kubectl@latest": {
143-
"last_modified": "2023-08-08T03:07:33Z",
144-
"resolved": "github:NixOS/nixpkgs/844ffa82bbe2a2779c86ab3a72ff1b4176cec467#kubectl",
143+
"last_modified": "2023-09-04T16:24:30Z",
144+
"resolved": "github:NixOS/nixpkgs/3c15feef7770eb5500a4b8792623e2d6f598c9c1#kubectl",
145145
"source": "devbox-search",
146-
"version": "1.27.4"
146+
"version": "1.28.1"
147147
},
148148
"kubernetes-controller-tools@latest": {
149-
"last_modified": "2023-07-23T03:35:12Z",
150-
"resolved": "github:NixOS/nixpkgs/af8cd5ded7735ca1df1a1174864daab75feeb64a#kubernetes-controller-tools",
149+
"last_modified": "2023-09-04T16:24:30Z",
150+
"resolved": "github:NixOS/nixpkgs/3c15feef7770eb5500a4b8792623e2d6f598c9c1#kubernetes-controller-tools",
151151
"source": "devbox-search",
152-
"version": "0.12.1"
152+
"version": "0.13.0"
153153
},
154154
"kubernetes-helm@latest": {
155155
"last_modified": "2023-07-23T03:35:12Z",
@@ -163,6 +163,9 @@
163163
"source": "devbox-search",
164164
"version": "5.1.1"
165165
},
166+
"path:./hack/flakes/go-mod-upgrade": {},
167+
"path:./hack/flakes/golangci-lint": {},
168+
"path:./hack/flakes/setup-envtest": {},
166169
"pre-commit@latest": {
167170
"last_modified": "2023-06-30T04:44:22Z",
168171
"resolved": "github:NixOS/nixpkgs/3c614fbc76fc152f3e1bc4b2263da6d90adf80fb#pre-commit",

docs/package-lock.json

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hack/flakes/go-mod-upgrade/flake.lock

Lines changed: 44 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hack/flakes/go-mod-upgrade/flake.nix

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Copyright 2023 D2iQ, Inc. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
{
5+
description = "Update outdated Go dependencies interactively";
6+
7+
inputs = {
8+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
9+
utils.url = "github:numtide/flake-utils/v1.0.0";
10+
};
11+
12+
outputs =
13+
{ self
14+
, nixpkgs
15+
, utils
16+
,
17+
}:
18+
let
19+
appReleaseVersion = "0.9.1";
20+
appReleaseBinaries = {
21+
"x86_64-linux" = {
22+
fileName = "go-mod-upgrade_${appReleaseVersion}_Linux_x86_64.tar.gz";
23+
sha256 = "38b7f36b275fa08bedf0e4c7fb1eaf256fa632a7489abe7c40a1d2b87a688b01";
24+
};
25+
"x86_64-darwin" = {
26+
fileName = "go-mod-upgrade_${appReleaseVersion}_Darwin_x86_64.tar.gz";
27+
sha256 = "e1e0294040cfadde0f119590f37fbff73654abc482ac60c1e3ca60b867326713";
28+
};
29+
"aarch64-darwin" = {
30+
fileName = "go-mod-upgrade_${appReleaseVersion}_Darwin_arm64.tar.gz";
31+
sha256 = "15027f435a85f31346fd0796977180c43c737b7fe7bbb4fc3bcc5f4b8f32804c";
32+
};
33+
};
34+
supportedSystems = builtins.attrNames appReleaseBinaries;
35+
in
36+
utils.lib.eachSystem supportedSystems (system:
37+
let
38+
pkgs = nixpkgs.legacyPackages.${system};
39+
appReleaseBinary = appReleaseBinaries.${system};
40+
in
41+
rec {
42+
packages.go-mod-upgrade = pkgs.stdenv.mkDerivation {
43+
pname = "go-mod-upgrade";
44+
version = appReleaseVersion;
45+
46+
src = pkgs.fetchurl {
47+
url = "https://github.com/oligot/go-mod-upgrade/releases/download/v${appReleaseVersion}/${appReleaseBinary.fileName}";
48+
sha256 = appReleaseBinary.sha256;
49+
};
50+
51+
sourceRoot = ".";
52+
53+
installPhase = ''
54+
install -m755 -D go-mod-upgrade $out/bin/go-mod-upgrade
55+
'';
56+
};
57+
packages.default = packages.go-mod-upgrade;
58+
59+
apps.go-mod-upgrade = utils.lib.mkApp {
60+
drv = packages.go-mod-upgrade;
61+
};
62+
apps.default = apps.go-mod-upgrade;
63+
});
64+
}

hack/flakes/golangci-lint/flake.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hack/flakes/golangci-lint/flake.nix

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
{
5-
description = "Fast linters Runner for Go ";
5+
description = "Fast linters Runner for Go";
66

77
inputs = {
88
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
@@ -16,36 +16,36 @@
1616
,
1717
}:
1818
let
19-
golangciLintVersion = "1.54.2";
20-
golangciLintBinaries = {
19+
appReleaseVersion = "1.54.2";
20+
appReleaseBinaries = {
2121
"x86_64-linux" = {
22-
fileName = "golangci-lint-${golangciLintVersion}-linux-amd64.tar.gz";
22+
fileName = "golangci-lint-${appReleaseVersion}-linux-amd64.tar.gz";
2323
sha256 = "17c9ca05253efe833d47f38caf670aad2202b5e6515879a99873fabd4c7452b3";
2424
};
2525
"x86_64-darwin" = {
26-
fileName = "golangci-lint-${golangciLintVersion}-darwin-amd64.tar.gz";
26+
fileName = "golangci-lint-${appReleaseVersion}-darwin-amd64.tar.gz";
2727
sha256 = "925c4097eae9e035b0b052a66d0a149f861e2ab611a4e677c7ffd2d4e05b9b89";
2828
};
2929
"aarch64-darwin" = {
30-
fileName = "golangci-lint-${golangciLintVersion}-darwin-arm64.tar.gz";
30+
fileName = "golangci-lint-${appReleaseVersion}-darwin-arm64.tar.gz";
3131
sha256 = "7b33fb1be2f26b7e3d1f3c10ce9b2b5ce6d13bb1d8468a4b2ba794f05b4445e1";
3232
};
3333
};
34-
supportedSystems = builtins.attrNames golangciLintBinaries;
34+
supportedSystems = builtins.attrNames appReleaseBinaries;
3535
in
3636
utils.lib.eachSystem supportedSystems (system:
3737
let
3838
pkgs = nixpkgs.legacyPackages.${system};
39-
golangciLintBinary = golangciLintBinaries.${system};
39+
appReleaseBinary = appReleaseBinaries.${system};
4040
in
4141
rec {
4242
packages.golangci-lint = pkgs.stdenv.mkDerivation {
4343
pname = "golangci-lint";
44-
version = golangciLintVersion;
44+
version = appReleaseVersion;
4545

4646
src = pkgs.fetchurl {
47-
url = "https://github.com/golangci/golangci-lint/releases/download/v${golangciLintVersion}/${golangciLintBinary.fileName}";
48-
sha256 = golangciLintBinary.sha256;
47+
url = "https://github.com/golangci/golangci-lint/releases/download/v${appReleaseVersion}/${appReleaseBinary.fileName}";
48+
sha256 = appReleaseBinary.sha256;
4949
};
5050

5151
sourceRoot = ".";

0 commit comments

Comments
 (0)