2021-01-23 12:26:19 +00:00
|
|
|
{ lib, stdenv, fetchurl, common-updater-scripts, coreutils, git, gnused, nix, nixfmt
|
2020-11-05 18:09:36 +00:00
|
|
|
, writeScript, nixosTests, jq, cacert, curl }:
|
2014-02-10 20:07:12 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "jenkins";
|
2021-01-15 15:19:48 +00:00
|
|
|
version = "2.263.2";
|
2014-02-10 20:07:12 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2018-02-14 14:07:08 +00:00
|
|
|
url = "http://mirrors.jenkins.io/war-stable/${version}/jenkins.war";
|
2021-01-15 15:19:48 +00:00
|
|
|
sha256 = "13l7y1307iv54z2zsjy0slzv2hpqv9i35qb15xa8s6sl7lcm9l49";
|
2014-02-10 20:07:12 +00:00
|
|
|
};
|
2016-07-15 12:45:23 +00:00
|
|
|
|
|
|
|
buildCommand = ''
|
2016-07-15 14:57:16 +00:00
|
|
|
mkdir -p "$out/webapps"
|
|
|
|
cp "$src" "$out/webapps/jenkins.war"
|
2016-07-15 12:45:23 +00:00
|
|
|
'';
|
|
|
|
|
2020-11-05 18:08:06 +00:00
|
|
|
passthru = {
|
|
|
|
tests = { inherit (nixosTests) jenkins; };
|
|
|
|
|
|
|
|
updateScript = writeScript "update.sh" ''
|
|
|
|
#!${stdenv.shell}
|
|
|
|
set -o errexit
|
|
|
|
PATH=${
|
2021-01-23 12:26:19 +00:00
|
|
|
lib.makeBinPath [
|
2020-11-05 18:08:06 +00:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2021-01-23 12:26:19 +00:00
|
|
|
meta = with lib; {
|
2014-09-08 15:05:15 +00:00
|
|
|
description = "An extendable open source continuous integration server";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://jenkins-ci.org";
|
2014-09-08 15:05:15 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.all;
|
2020-11-05 18:08:06 +00:00
|
|
|
maintainers = with maintainers; [ coconnor fpletz earldouglas nequissimus ];
|
2014-02-10 20:07:12 +00:00
|
|
|
};
|
|
|
|
}
|