Skip to content

Commit

Permalink
chore: add renovate monitoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ajgon committed Oct 27, 2024
1 parent b1528ae commit 9231727
Show file tree
Hide file tree
Showing 15 changed files with 346 additions and 28 deletions.
42 changes: 42 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base",
":dependencyDashboard",
":disableRateLimiting",
"docker:enableMajor",
"docker:pinDigests",
":automergeDigest",
":automergePatch",
":enablePreCommit",
":timezone(Europe/Warsaw)",
"github>deedee-ops/nixlab//.github/renovate/autoMerge.json5",
"github>deedee-ops/nixlab//.github/renovate/commitMessage.json5",
"github>deedee-ops/nixlab//.github/renovate/labels.json5",
"github>deedee-ops/nixlab//.github/renovate/semanticCommits.json5"
],
"gitAuthor": "robodexo2000 <150604236+robodexo2000[bot]@users.noreply.github.com>",
"dependencyDashboardTitle": "Renovate Dashboard 🤖",
"suppressNotifications": ["prEditedNotification", "prIgnoreNotification"],
"commitBodyTable": true,
"rebaseWhen": "auto",

"nix": {
"enabled": "true",
},

"lockFileMaintenance": {
"enabled": "true",
"automerge": "true",
"schedule": [ "before 4am on Sunday" ],
},

"regexManagers": [
{
fileMatch: ["^modules/.*\\.nix$", "^flyio/.*\\.toml$"],
matchStrings: [
'image *= *"(?<depName>.*?):(?<currentValue>.*?)(@(?<currentDigest>sha256:[a-f0-9]+))?"',
],
datasourceTemplate: "docker",
}
}
14 changes: 14 additions & 0 deletions .github/renovate/autoMerge.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"packageRules": [
{
"description": "Auto merge GitHub Actions",
"matchManagers": ["github-actions"],
"matchDatasources": ["github-tags"],
"automerge": true,
"ignoreTests": true,
"automergeType": "branch",
"matchUpdateTypes": ["minor", "patch", "digest"]
}
]
}
6 changes: 6 additions & 0 deletions .github/renovate/commitMessage.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"commitMessageTopic": "{{depName}}",
"commitMessageExtra": "to {{newVersion}}",
"commitMessageSuffix": "",
}
41 changes: 41 additions & 0 deletions .github/renovate/labels.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"packageRules": [
{
"matchUpdateTypes": ["major"],
"labels": ["type/major"]
},
{
"matchUpdateTypes": ["minor"],
"labels": ["type/minor"]
},
{
"matchUpdateTypes": ["patch"],
"labels": ["type/patch"]
},
{
"matchUpdateTypes": ["digest"],
"labels": ["type/digest"]
},
{
"matchDatasources": ["docker"],
"addLabels": ["renovate/container"]
},
{
"matchDatasources": ["helm"],
"addLabels": ["renovate/helm"]
},
{
"matchDatasources": ["terraform-provider"],
"addLabels": ["renovate/tofu"]
},
{
"matchDatasources": ["github-releases", "github-tags"],
"addLabels": ["renovate/github-release"]
},
{
"matchManagers": ["github-actions"],
"addLabels": ["renovate/github-action"]
}
]
}
112 changes: 112 additions & 0 deletions .github/renovate/semanticCommits.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"packageRules": [
{
"matchDatasources": ["docker"],
"matchUpdateTypes": ["major"],
"commitMessagePrefix": "feat(container)!: ",
"commitMessageTopic": "{{depName}}",
"commitMessageExtra": " ( {{currentVersion}} → {{newVersion}} )"
},
{
"matchDatasources": ["docker"],
"matchUpdateTypes": ["minor"],
"semanticCommitType": "feat",
"semanticCommitScope": "container",
"commitMessageTopic": "{{depName}}",
"commitMessageExtra": "( {{currentVersion}} → {{newVersion}} )"
},
{
"matchDatasources": ["docker"],
"matchUpdateTypes": ["patch"],
"semanticCommitType": "fix",
"semanticCommitScope": "container",
"commitMessageTopic": "{{depName}}",
"commitMessageExtra": "( {{currentVersion}} → {{newVersion}} )"
},
{
"matchDatasources": ["docker"],
"matchUpdateTypes": ["digest"],
"semanticCommitType": "chore",
"semanticCommitScope": "container",
"commitMessageTopic": "{{depName}}",
"commitMessageExtra": "( {{currentDigestShort}} → {{newDigestShort}} )"
},
{
"matchDatasources": ["helm"],
"matchUpdateTypes": ["major"],
"commitMessagePrefix": "feat(helm)!: ",
"commitMessageTopic": "{{depName}}",
"commitMessageExtra": "( {{currentVersion}} → {{newVersion}} )"
},
{
"matchDatasources": ["terraform-provider"],
"matchUpdateTypes": ["major"],
"commitMessagePrefix": "feat(terraform)!: ",
"commitMessageTopic": "{{depName}}",
"commitMessageExtra": "( {{currentVersion}} → {{newVersion}} )"
},
{
"matchDatasources": ["terraform-provider"],
"matchUpdateTypes": ["minor"],
"semanticCommitType": "feat",
"semanticCommitScope": "terraform",
"commitMessageTopic": "{{depName}}",
"commitMessageExtra": "( {{currentVersion}} → {{newVersion}} )"
},
{
"matchDatasources": ["terraform-provider"],
"matchUpdateTypes": ["patch"],
"semanticCommitType": "fix",
"semanticCommitScope": "terraform",
"commitMessageTopic": "{{depName}}",
"commitMessageExtra": "( {{currentVersion}} → {{newVersion}} )"
},
{
"matchDatasources": ["github-releases", "github-tags"],
"matchUpdateTypes": ["major"],
"commitMessagePrefix": "feat(github-release)!: ",
"commitMessageTopic": "{{depName}}",
"commitMessageExtra": "( {{currentVersion}} → {{newVersion}} )"
},
{
"matchDatasources": ["github-releases", "github-tags"],
"matchUpdateTypes": ["minor"],
"semanticCommitType": "feat",
"semanticCommitScope": "github-release",
"commitMessageTopic": "{{depName}}",
"commitMessageExtra": "( {{currentVersion}} → {{newVersion}} )"
},
{
"matchDatasources": ["github-releases", "github-tags"],
"matchUpdateTypes": ["patch"],
"semanticCommitType": "fix",
"semanticCommitScope": "github-release",
"commitMessageTopic": "{{depName}}",
"commitMessageExtra": "( {{currentVersion}} → {{newVersion}} )"
},
{
"matchManagers": ["github-actions"],
"matchUpdateTypes": ["major"],
"commitMessagePrefix": "feat(github-action)!: ",
"commitMessageTopic": "{{depName}}",
"commitMessageExtra": "( {{currentVersion}} → {{newVersion}} )"
},
{
"matchManagers": ["github-actions"],
"matchUpdateTypes": ["minor"],
"semanticCommitType": "feat",
"semanticCommitScope": "github-action",
"commitMessageTopic": "{{depName}}",
"commitMessageExtra": "( {{currentVersion}} → {{newVersion}} )"
},
{
"matchManagers": ["github-actions"],
"matchUpdateTypes": ["patch"],
"semanticCommitType": "fix",
"semanticCommitScope": "github-action",
"commitMessageTopic": "{{depName}}",
"commitMessageExtra": "( {{currentVersion}} → {{newVersion}} )"
}
]
}
78 changes: 78 additions & 0 deletions .github/workflows/renovate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# yamllint disable rule:comments
---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: "Renovate"

'on':
workflow_dispatch:
inputs:
dryRun:
description: Dry Run
default: "false"
required: false
logLevel:
description: Log Level
default: debug
required: false
version:
description: Renovate version
default: latest
required: false
schedule:
- cron: "0 * * * *" # Every hour
push:
branches:
- master
paths:
- .github/renovate.json5
- .github/renovate/**.json5

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true

# Retrieve BOT_USER_ID via `curl -s "https://api.github.com/users/${BOT_USERNAME}%5Bbot%5D" | jq .id`
env:
RENOVATE_PLATFORM: github
RENOVATE_PLATFORM_COMMIT: true
RENOVATE_ONBOARDING_CONFIG_FILE_NAME: .github/renovate.json5
RENOVATE_AUTODISCOVER: true
RENOVATE_AUTODISCOVER_FILTER: "${{ github.repository }}"
RENOVATE_USERNAME: "${{ secrets.BOT_USERNAME }}[bot]"
RENOVATE_GIT_AUTHOR: >-
${{ secrets.BOT_USERNAME }}
<${{ secrets.BOT_USER_ID }}+${{ secrets.BOT_USERNAME }}[bot]@users.noreply.github.com>
WORKFLOW_RENOVATE_DRY_RUN: false
WORKFLOW_RENOVATE_LOG_LEVEL: debug
WORKFLOW_RENOVATE_VERSION: latest

jobs:
renovate:
name: Renovate
runs-on: ubuntu-latest
steps:
- name: Generate Token
uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1
id: app-token
with:
app-id: "${{ secrets.BOT_APP_ID }}"
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"

- name: Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
token: "${{ steps.app-token.outputs.token }}"

- name: Override Default Config
shell: bash
run: |
echo "RENOVATE_DRY_RUN=${{ github.event.inputs.dryRun || env.WORKFLOW_RENOVATE_DRY_RUN }}" >> "${GITHUB_ENV}"
echo "LOG_LEVEL=${{ github.event.inputs.logLevel || env.WORKFLOW_RENOVATE_LOG_LEVEL }}" >> "${GITHUB_ENV}"
- name: Renovate
uses: renovatebot/github-action@80eaf969abf68ad62aa94d9ab392421b31621634 # v40.3.4
with:
configurationFile: "${{ env.RENOVATE_ONBOARDING_CONFIG_FILE_NAME }}"
token: "${{ steps.app-token.outputs.token }}"
renovate-version: "${{ github.event.inputs.version || env.WORKFLOW_RENOVATE_VERSION }}"
# yamllint enable rule:comments
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
result
tmp
.direnv
.pre-commit-config.yaml
3 changes: 3 additions & 0 deletions .gitleaksignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
30f633ede83f2fa1a25e142287b00c6a0db3070c:modules/system/apps/postgresql/default.nix:hashicorp-tf-password:69
5ceb97149857e5deb0a58a25b7c0360acce66168:modules/system/apps/postgresql/default.nix:hashicorp-tf-password:50
4590e239a2ee354f8c9fdd363e2cf349fb8c5969:modules/system/services/adguardhome.nix:hashicorp-tf-password:36
2 changes: 1 addition & 1 deletion .luarc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"diagnostics.globals": [
"vim"
]
}
}
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
63 changes: 44 additions & 19 deletions local/configs/git-hooks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,54 @@
check.enable = true;

settings = {
excludes = [ ".direnv" ];
excludes = [
".direnv"
"secrets.tar.gz.enc"
];

hooks = {
check-case-conflicts.enable = true;
check-shebang-scripts-are-executable.enable = true;
mixed-line-endings.enable = true;
hooks =
let
inherit (inputs.nixpkgs) lib;
pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
in
{
check-case-conflicts.enable = true;
check-executables-have-shebangs.enable = true;
check-merge-conflicts.enable = true;
check-shebang-scripts-are-executable.enable = true;
end-of-file-fixer.enable = true;
fix-byte-order-marker.enable = true;
mixed-line-endings.enable = true;
pre-commit-hook-ensure-sops = {
enable = true;
files = ".+\.sops\..*";
};
trim-trailing-whitespace.enable = true;

deadnix.enable = true;
flake-checker.enable = true;
statix.enable = true;
nixfmt-rfc-style.enable = true;
deadnix.enable = true;
flake-checker.enable = true;
statix.enable = true;
nixfmt-rfc-style.enable = true;

lua-ls.enable = true;
shellcheck = {
enable = true;
excludes = [ ".*\.zsh" ];
};
stylua.enable = true;
yamllint.enable = true;
lua-ls.enable = true;
shellcheck = {
enable = true;
excludes = [ ".*\.zsh" ];
};
stylua.enable = true;
yamllint.enable = true;

actionlint.enable = true;
commitizen.enable = true;

actionlint.enable = true;
commitizen.enable = true;
};
# custom hooks
gitleaks = {
enable = true;
name = "gitleaks";
package = pkgs.gitleaks;
entry = "${lib.getExe pkgs.gitleaks} protect --verbose --redact --staged";
};
};
};
};
};
Expand Down
Loading

0 comments on commit 9231727

Please sign in to comment.