radicle-ci-broker: init at 0.21.0

(cherry picked from commit 9a70845186)
This commit is contained in:
Defelo
2025-08-24 11:54:11 +02:00
parent 64108afa7a
commit 5e270dfe22
2 changed files with 91 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
{
lib,
rustPlatform,
fetchFromRadicle,
stdenv,
jq,
gitMinimal,
sqlite,
radicle-node,
versionCheckHook,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "radicle-ci-broker";
version = "0.21.0";
src = fetchFromRadicle {
seed = "seed.radicle.xyz";
repo = "zwTxygwuz5LDGBq255RA2CbNGrz8";
node = "z6MkgEMYod7Hxfy9qCvDv5hYHkZ4ciWmLFgfvm3Wn1b2w2FV";
tag = "v${finalAttrs.version}";
hash = "sha256-c0Qo6dnR9rP4mLXODkNZp+AnhKS0tqJeh1KgzfHBRV4=";
leaveDotGit = true;
postFetch = ''
git -C $out rev-parse --short HEAD > $out/.git_head
rm -rf $out/.git
'';
};
cargoHash = "sha256-9MkZh1hlHgLC9rGmLx5ehtLtZfhXsCqrJrCJNr1edBU=";
postPatch = ''
substituteInPlace build.rs \
--replace-fail "let hash = " "let hash = \"$(<$src/.git_head)\"; "
'';
preCheck = ''
ln -s "$PWD/target/${stdenv.hostPlatform.rust.rustcTarget}/$cargoBuildType" target/debug
'';
nativeCheckInputs = [
jq
gitMinimal
sqlite
radicle-node
];
checkFlags = [
"--skip=acceptance_criteria_for_upgrades"
"--skip=logs_adapter_stderr_output"
"--skip=process_queued_events"
"--skip=runs_adapter_with_configuration"
];
nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgram = "${placeholder "out"}/bin/cib";
versionCheckProgramArg = "--version";
doInstallCheck = true;
passthru.updateScript = ./update.sh;
meta = {
description = "Radicle CI broker";
homepage = "https://app.radicle.xyz/nodes/seed.radicle.xyz/rad:zwTxygwuz5LDGBq255RA2CbNGrz8";
changelog = "https://app.radicle.xyz/nodes/seed.radicle.xyz/rad:zwTxygwuz5LDGBq255RA2CbNGrz8/tree/NEWS.md";
license = with lib.licenses; [
mit
asl20
];
maintainers = with lib.maintainers; [ defelo ];
mainProgram = "cib";
};
})

View File

@@ -0,0 +1,18 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p coreutils gnused gitMinimal nix-update
set -euo pipefail
dirname="$(dirname "${BASH_SOURCE[0]}")"
url=$(nix-instantiate --eval --raw -A radicle-ci-broker.src.url)
old_node=$(nix-instantiate --eval --raw -A radicle-ci-broker.src.node)
ref=$(git ls-remote "$url" 'refs/namespaces/*/refs/tags/v*' \
| cut -f2 | grep -Ev '\^\{\}$' | sort -t/ -k6rV | head -1)
[[ "$ref" =~ ^refs/namespaces/([^/]+)/refs/tags/v([^/]+)$ ]]
new_node="${BASH_REMATCH[1]}"
version="${BASH_REMATCH[2]}"
sed -i "s/${old_node}/${new_node}/g" "${dirname}/package.nix"
nix-update --version="$version" radicle-ci-broker