jenkins: Inline update script, add test reference
This commit is contained in:
parent
820f3be9b4
commit
66d8c7d29a
@ -1,4 +1,4 @@
|
|||||||
{ stdenv, fetchurl }:
|
{ stdenv, fetchurl, common-updater-scripts, coreutils, git, gnused, nix, nixfmt, writeScript, nixosTests, jq, cacert, curl }:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "jenkins";
|
pname = "jenkins";
|
||||||
@ -14,11 +14,50 @@ stdenv.mkDerivation rec {
|
|||||||
cp "$src" "$out/webapps/jenkins.war"
|
cp "$src" "$out/webapps/jenkins.war"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
passthru = {
|
||||||
|
tests = { inherit (nixosTests) jenkins; };
|
||||||
|
|
||||||
|
updateScript = writeScript "update.sh" ''
|
||||||
|
#!${stdenv.shell}
|
||||||
|
set -o errexit
|
||||||
|
PATH=${
|
||||||
|
stdenv.lib.makeBinPath [
|
||||||
|
cacert
|
||||||
|
common-updater-scripts
|
||||||
|
coreutils
|
||||||
|
curl
|
||||||
|
git
|
||||||
|
gnused
|
||||||
|
jq
|
||||||
|
nix
|
||||||
|
nixfmt
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
core_json="$(curl -s --fail --location https://updates.jenkins.io/stable/update-center.actual.json | jq .core)"
|
||||||
|
oldVersion=$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion jenkins" | tr -d '"')
|
||||||
|
|
||||||
|
version="$(jq -r .version <<<$core_json)"
|
||||||
|
sha256="$(jq -r .sha256 <<<$core_json)"
|
||||||
|
hash="$(nix-hash --type sha256 --to-base32 "$sha256")"
|
||||||
|
url="$(jq -r .url <<<$core_json)"
|
||||||
|
|
||||||
|
if [ ! "$oldVersion" = "$version" ]; then
|
||||||
|
update-source-version jenkins "$version" "$hash" "$url"
|
||||||
|
nixpkgs="$(git rev-parse --show-toplevel)"
|
||||||
|
default_nix="$nixpkgs/pkgs/development/tools/continuous-integration/jenkins/default.nix"
|
||||||
|
nixfmt "$default_nix"
|
||||||
|
else
|
||||||
|
echo "jenkins is already up-to-date"
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
description = "An extendable open source continuous integration server";
|
description = "An extendable open source continuous integration server";
|
||||||
homepage = "https://jenkins-ci.org";
|
homepage = "https://jenkins-ci.org";
|
||||||
license = licenses.mit;
|
license = licenses.mit;
|
||||||
platforms = platforms.all;
|
platforms = platforms.all;
|
||||||
maintainers = with maintainers; [ coconnor fpletz earldouglas ];
|
maintainers = with maintainers; [ coconnor fpletz earldouglas nequissimus ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
#!/usr/bin/env nix-shell
|
|
||||||
#!nix-shell -i bash -p curl common-updater-scripts jq
|
|
||||||
|
|
||||||
set -eu -o pipefail
|
|
||||||
|
|
||||||
core_json="$(curl -s --fail --location https://updates.jenkins.io/stable/update-center.actual.json | jq .core)"
|
|
||||||
oldVersion=$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion jenkins" | tr -d '"')
|
|
||||||
|
|
||||||
version="$(jq -r .version <<<$core_json)"
|
|
||||||
sha256="$(jq -r .sha256 <<<$core_json)"
|
|
||||||
hash="$(nix-hash --type sha256 --to-base32 "$sha256")"
|
|
||||||
url="$(jq -r .url <<<$core_json)"
|
|
||||||
|
|
||||||
if [ ! "${oldVersion}" = "${version}" ]; then
|
|
||||||
update-source-version jenkins "$version" "$hash" "$url"
|
|
||||||
nixpkgs="$(git rev-parse --show-toplevel)"
|
|
||||||
default_nix="$nixpkgs/pkgs/development/tools/continuous-integration/jenkins/default.nix"
|
|
||||||
git add "${default_nix}"
|
|
||||||
git commit -m "jenkins: ${oldVersion} -> ${version}"
|
|
||||||
else
|
|
||||||
echo "jenkins is already up-to-date"
|
|
||||||
fi
|
|
Loading…
x
Reference in New Issue
Block a user