mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-23 21:18:27 +01:00
Compare commits
No commits in common. "f11aabab648f83777ca948e7e3e1ee5627299f33" and "67d3b8ca50e0113bcf58d25dfa8befe227c73aec" have entirely different histories.
f11aabab64
...
67d3b8ca50
5 changed files with 4 additions and 41 deletions
31
.github/workflows/ci.yml
vendored
31
.github/workflows/ci.yml
vendored
|
|
@ -60,46 +60,15 @@ jobs:
|
||||||
server: ${{ fromJson(needs.parse-flake.outputs.servers) }}
|
server: ${{ fromJson(needs.parse-flake.outputs.servers) }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- uses: cachix/install-nix-action@v31
|
- uses: cachix/install-nix-action@v31
|
||||||
with:
|
with:
|
||||||
extra_nix_config: experimental-features = nix-command flakes pipe-operators
|
extra_nix_config: experimental-features = nix-command flakes pipe-operators
|
||||||
- name: Check if build can be skipped
|
|
||||||
id: skip-check
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
run: |
|
|
||||||
last_sha=$(gh api \
|
|
||||||
"repos/${{ github.repository }}/actions/workflows/ci.yml/runs?branch=main&status=success&per_page=1" \
|
|
||||||
--jq '.workflow_runs[0].head_sha // empty')
|
|
||||||
|
|
||||||
if [[ -z "$last_sha" ]]; then
|
|
||||||
echo "No previous successful run found, build required"
|
|
||||||
echo "skip=false" >> "$GITHUB_OUTPUT"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Comparing current (${{ github.sha }}) with last successful ($last_sha)"
|
|
||||||
|
|
||||||
current_drv=$(nix eval .#nixosConfigurations.${{ matrix.server }}.config.system.build.toplevel.drvPath --raw)
|
|
||||||
previous_drv=$(nix eval "git+file://$(pwd)?rev=$last_sha#nixosConfigurations.${{ matrix.server }}.config.system.build.toplevel.drvPath" --raw)
|
|
||||||
|
|
||||||
if [[ "$current_drv" == "$previous_drv" ]]; then
|
|
||||||
echo "Derivations match, skipping build"
|
|
||||||
echo "skip=true" >> "$GITHUB_OUTPUT"
|
|
||||||
else
|
|
||||||
echo "Derivations differ, build required"
|
|
||||||
echo "skip=false" >> "$GITHUB_OUTPUT"
|
|
||||||
fi
|
|
||||||
- uses: cachix/cachix-action@v15
|
- uses: cachix/cachix-action@v15
|
||||||
if: steps.skip-check.outputs.skip != 'true'
|
|
||||||
with:
|
with:
|
||||||
name: sebastian-stork
|
name: sebastian-stork
|
||||||
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
||||||
useDaemon: false
|
useDaemon: false
|
||||||
- name: Build server
|
- name: Build server
|
||||||
if: steps.skip-check.outputs.skip != 'true'
|
|
||||||
run: nix build .#nixosConfigurations.${{ matrix.server }}.config.system.build.toplevel --print-build-logs
|
run: nix build .#nixosConfigurations.${{ matrix.server }}.config.system.build.toplevel --print-build-logs
|
||||||
deploy:
|
deploy:
|
||||||
needs: [build-check, build-server]
|
needs: [build-check, build-server]
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@
|
||||||
private-nameserver.enable = true;
|
private-nameserver.enable = true;
|
||||||
public-nameserver = {
|
public-nameserver = {
|
||||||
enable = true;
|
enable = true;
|
||||||
publicHostName = "ns1";
|
|
||||||
zones = [
|
zones = [
|
||||||
"sprouted.cloud"
|
"sprouted.cloud"
|
||||||
"sstork.dev"
|
"sstork.dev"
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@
|
||||||
|
|
||||||
services.public-nameserver = {
|
services.public-nameserver = {
|
||||||
enable = true;
|
enable = true;
|
||||||
publicHostName = "ns2";
|
|
||||||
zones = [
|
zones = [
|
||||||
"sprouted.cloud"
|
"sprouted.cloud"
|
||||||
"sstork.dev"
|
"sstork.dev"
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ let
|
||||||
|> lib.attrValues
|
|> lib.attrValues
|
||||||
|> lib.filter (host: host.config.custom.services.public-nameserver.enable)
|
|> lib.filter (host: host.config.custom.services.public-nameserver.enable)
|
||||||
|> lib.map (host: {
|
|> lib.map (host: {
|
||||||
name = host.config.custom.services.public-nameserver.publicHostName;
|
name = host.config.custom.networking.hostName;
|
||||||
inherit (host.config.custom.networking.underlay) address;
|
inherit (host.config.custom.networking.underlay) address;
|
||||||
});
|
});
|
||||||
in
|
in
|
||||||
|
|
@ -66,10 +66,6 @@ in
|
||||||
{
|
{
|
||||||
options.custom.services.public-nameserver = {
|
options.custom.services.public-nameserver = {
|
||||||
enable = lib.mkEnableOption "";
|
enable = lib.mkEnableOption "";
|
||||||
publicHostName = lib.mkOption {
|
|
||||||
type = lib.types.nonEmptyStr;
|
|
||||||
default = netCfg.hostName;
|
|
||||||
};
|
|
||||||
port = lib.mkOption {
|
port = lib.mkOption {
|
||||||
type = lib.types.port;
|
type = lib.types.port;
|
||||||
default = 53;
|
default = 53;
|
||||||
|
|
|
||||||
|
|
@ -104,12 +104,12 @@ in
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
alert = "CominDeploymentCommitMismatch";
|
alert = "CominDeploymentDifferentCommits";
|
||||||
expr = "count(count by (commit_id) (comin_deployment_info)) > 1";
|
expr = "count(count by (commit_id) (comin_deployment_info)) > 1";
|
||||||
for = "10m";
|
for = "10m";
|
||||||
annotations = {
|
annotations = {
|
||||||
summary = "Hosts are running different commits";
|
summary = "Comin commit mismatch";
|
||||||
description = "Not all hosts are running the same git commit, which may indicate a failed deployment and could lead to incompatible configurations.";
|
description = "Two or more comin deployments are on different commits.";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue