Skip to content

build: Upgrade everything and use nix flakes for go tools #135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ updates:
schedule:
interval: "weekly"

- package-ecosystem: "npm"
directory: "/docs"
schedule:
interval: "weekly"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
2 changes: 0 additions & 2 deletions .go-tools

This file was deleted.

10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ repos:
- id: actionlint-system
stages: [commit]
- repo: https://github.com/hadolint/hadolint
rev: v2.12.0
rev: v2.12.1-beta
hooks:
- id: hadolint
- repo: https://github.com/jorisroovers/gitlint
Expand All @@ -73,19 +73,19 @@ repos:
- id: script-must-have-extension
stages: [commit]
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.2
rev: v0.9.0.5
hooks:
- id: shellcheck
stages: [commit]
args: ["-e", "SC2211", "-x"]
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.34.0
rev: v0.36.0
hooks:
- id: markdownlint
stages: [commit]
exclude: ^(CHANGELOG.md|charts/.+/README.md)$
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.1
rev: v1.5.4
hooks:
- id: insert-license
name: License headers - Go
Expand Down Expand Up @@ -118,7 +118,7 @@ repos:
- <!--|| -->
- --use-current-year
- repo: https://github.com/norwoodj/helm-docs
rev: v1.11.0
rev: v1.11.1
hooks:
- id: helm-docs
stages: [commit]
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# hadolint ignore=DL3029
FROM --platform=linux/amd64 gcr.io/distroless/static@sha256:1b4dbd7d38a0fd4bbaf5216a21a615d07b56747a96d3c650689cbb7fdc412b49 as linux-amd64
# hadolint ignore=DL3029
FROM --platform=linux/arm64 gcr.io/distroless/static@sha256:05810557ec4b4bf01f4df548c06cc915bb29d81cb339495fe1ad2e668434bf8e as linux-arm64
FROM --platform=linux/arm64 gcr.io/distroless/static@sha256:dcf9c9cafaa9c328eff2ceff5f6057588336b48c9b91ddc0913102b33bbce723 as linux-arm64

# hadolint ignore=DL3006,DL3029
FROM --platform=linux/${TARGETARCH} linux-${TARGETARCH}
Expand Down
2 changes: 2 additions & 0 deletions devbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"gnumake@latest",
"gnused@latest",
"go@latest",
"path:./hack/flakes/go-mod-upgrade",
"gojq@latest",
"path:./hack/flakes/golangci-lint",
"golines@latest",
Expand All @@ -28,6 +29,7 @@
"kubernetes-helm@latest",
"kustomize@latest",
"pre-commit@latest",
"path:./hack/flakes/setup-envtest",
"shfmt@latest",
"upx@latest",
"yamale@latest",
Expand Down
27 changes: 15 additions & 12 deletions devbox.lock
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
"version": "2.1.0"
},
"ginkgo@latest": {
"last_modified": "2023-06-30T04:44:22Z",
"resolved": "github:NixOS/nixpkgs/3c614fbc76fc152f3e1bc4b2263da6d90adf80fb#ginkgo",
"last_modified": "2023-09-04T16:24:30Z",
"resolved": "github:NixOS/nixpkgs/3c15feef7770eb5500a4b8792623e2d6f598c9c1#ginkgo",
"source": "devbox-search",
"version": "2.11.0"
"version": "2.12.0"
},
"git@latest": {
"last_modified": "2023-07-23T03:35:12Z",
Expand Down Expand Up @@ -98,10 +98,10 @@
"version": "433.0.1"
},
"goreleaser@latest": {
"last_modified": "2023-07-23T03:35:12Z",
"resolved": "github:NixOS/nixpkgs/af8cd5ded7735ca1df1a1174864daab75feeb64a#goreleaser",
"last_modified": "2023-09-04T16:24:30Z",
"resolved": "github:NixOS/nixpkgs/3c15feef7770eb5500a4b8792623e2d6f598c9c1#goreleaser",
"source": "devbox-search",
"version": "1.19.2"
"version": "1.20.0"
},
"gotestsum@latest": {
"last_modified": "2023-07-23T03:35:12Z",
Expand Down Expand Up @@ -140,16 +140,16 @@
"version": "3.11.1"
},
"kubectl@latest": {
"last_modified": "2023-08-08T03:07:33Z",
"resolved": "github:NixOS/nixpkgs/844ffa82bbe2a2779c86ab3a72ff1b4176cec467#kubectl",
"last_modified": "2023-09-04T16:24:30Z",
"resolved": "github:NixOS/nixpkgs/3c15feef7770eb5500a4b8792623e2d6f598c9c1#kubectl",
"source": "devbox-search",
"version": "1.27.4"
"version": "1.28.1"
},
"kubernetes-controller-tools@latest": {
"last_modified": "2023-07-23T03:35:12Z",
"resolved": "github:NixOS/nixpkgs/af8cd5ded7735ca1df1a1174864daab75feeb64a#kubernetes-controller-tools",
"last_modified": "2023-09-04T16:24:30Z",
"resolved": "github:NixOS/nixpkgs/3c15feef7770eb5500a4b8792623e2d6f598c9c1#kubernetes-controller-tools",
"source": "devbox-search",
"version": "0.12.1"
"version": "0.13.0"
},
"kubernetes-helm@latest": {
"last_modified": "2023-07-23T03:35:12Z",
Expand All @@ -163,6 +163,9 @@
"source": "devbox-search",
"version": "5.1.1"
},
"path:./hack/flakes/go-mod-upgrade": {},
"path:./hack/flakes/golangci-lint": {},
"path:./hack/flakes/setup-envtest": {},
"pre-commit@latest": {
"last_modified": "2023-06-30T04:44:22Z",
"resolved": "github:NixOS/nixpkgs/3c614fbc76fc152f3e1bc4b2263da6d90adf80fb#pre-commit",
Expand Down
32 changes: 16 additions & 16 deletions docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions hack/flakes/go-mod-upgrade/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 64 additions & 0 deletions hack/flakes/go-mod-upgrade/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Copyright 2023 D2iQ, Inc. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

{
description = "Update outdated Go dependencies interactively";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
utils.url = "github:numtide/flake-utils/v1.0.0";
};

outputs =
{ self
, nixpkgs
, utils
,
}:
let
appReleaseVersion = "0.9.1";
appReleaseBinaries = {
"x86_64-linux" = {
fileName = "go-mod-upgrade_${appReleaseVersion}_Linux_x86_64.tar.gz";
sha256 = "38b7f36b275fa08bedf0e4c7fb1eaf256fa632a7489abe7c40a1d2b87a688b01";
};
"x86_64-darwin" = {
fileName = "go-mod-upgrade_${appReleaseVersion}_Darwin_x86_64.tar.gz";
sha256 = "e1e0294040cfadde0f119590f37fbff73654abc482ac60c1e3ca60b867326713";
};
"aarch64-darwin" = {
fileName = "go-mod-upgrade_${appReleaseVersion}_Darwin_arm64.tar.gz";
sha256 = "15027f435a85f31346fd0796977180c43c737b7fe7bbb4fc3bcc5f4b8f32804c";
};
};
supportedSystems = builtins.attrNames appReleaseBinaries;
in
utils.lib.eachSystem supportedSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
appReleaseBinary = appReleaseBinaries.${system};
in
rec {
packages.go-mod-upgrade = pkgs.stdenv.mkDerivation {
pname = "go-mod-upgrade";
version = appReleaseVersion;

src = pkgs.fetchurl {
url = "https://github.com/oligot/go-mod-upgrade/releases/download/v${appReleaseVersion}/${appReleaseBinary.fileName}";
sha256 = appReleaseBinary.sha256;
};

sourceRoot = ".";

installPhase = ''
install -m755 -D go-mod-upgrade $out/bin/go-mod-upgrade
'';
};
packages.default = packages.go-mod-upgrade;

apps.go-mod-upgrade = utils.lib.mkApp {
drv = packages.go-mod-upgrade;
};
apps.default = apps.go-mod-upgrade;
});
}
6 changes: 3 additions & 3 deletions hack/flakes/golangci-lint/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions hack/flakes/golangci-lint/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

{
description = "Fast linters Runner for Go ";
description = "Fast linters Runner for Go";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
Expand All @@ -16,36 +16,36 @@
,
}:
let
golangciLintVersion = "1.54.2";
golangciLintBinaries = {
appReleaseVersion = "1.54.2";
appReleaseBinaries = {
"x86_64-linux" = {
fileName = "golangci-lint-${golangciLintVersion}-linux-amd64.tar.gz";
fileName = "golangci-lint-${appReleaseVersion}-linux-amd64.tar.gz";
sha256 = "17c9ca05253efe833d47f38caf670aad2202b5e6515879a99873fabd4c7452b3";
};
"x86_64-darwin" = {
fileName = "golangci-lint-${golangciLintVersion}-darwin-amd64.tar.gz";
fileName = "golangci-lint-${appReleaseVersion}-darwin-amd64.tar.gz";
sha256 = "925c4097eae9e035b0b052a66d0a149f861e2ab611a4e677c7ffd2d4e05b9b89";
};
"aarch64-darwin" = {
fileName = "golangci-lint-${golangciLintVersion}-darwin-arm64.tar.gz";
fileName = "golangci-lint-${appReleaseVersion}-darwin-arm64.tar.gz";
sha256 = "7b33fb1be2f26b7e3d1f3c10ce9b2b5ce6d13bb1d8468a4b2ba794f05b4445e1";
};
};
supportedSystems = builtins.attrNames golangciLintBinaries;
supportedSystems = builtins.attrNames appReleaseBinaries;
in
utils.lib.eachSystem supportedSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
golangciLintBinary = golangciLintBinaries.${system};
appReleaseBinary = appReleaseBinaries.${system};
in
rec {
packages.golangci-lint = pkgs.stdenv.mkDerivation {
pname = "golangci-lint";
version = golangciLintVersion;
version = appReleaseVersion;

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

sourceRoot = ".";
Expand Down
Loading