2021-08-05 21:33:18 +00:00
|
|
|
{ lib, stdenv, fetchurl, common-updater-scripts, coreutils, git, gnused
|
|
|
|
, makeWrapper, nix, nixfmt, openjdk, writeScript, nixosTests, jq, cacert, curl
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "jenkins";
|
2023-11-16 04:20:00 +00:00
|
|
|
version = "2.414.3";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2022-05-18 14:49:53 +00:00
|
|
|
url = "https://get.jenkins.io/war-stable/${version}/jenkins.war";
|
2023-11-16 04:20:00 +00:00
|
|
|
hash = "sha256-LZMlS8GG3zSbxK0GtrHddXxJMZDwVY0RHb2pUXqEe1k=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
buildCommand = ''
|
2021-07-14 22:03:04 +00:00
|
|
|
mkdir -p "$out/bin" "$out/share" "$out/webapps"
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
cp "$src" "$out/webapps/jenkins.war"
|
2021-07-14 22:03:04 +00:00
|
|
|
|
|
|
|
# Create the `jenkins-cli` command.
|
|
|
|
${openjdk}/bin/jar -xf "$src" WEB-INF/lib/cli-${version}.jar \
|
|
|
|
&& mv WEB-INF/lib/cli-${version}.jar "$out/share/jenkins-cli.jar"
|
|
|
|
|
|
|
|
makeWrapper "${openjdk}/bin/java" "$out/bin/jenkins-cli" \
|
|
|
|
--add-flags "-jar $out/share/jenkins-cli.jar"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2020-11-06 00:33:48 +00:00
|
|
|
passthru = {
|
2022-01-25 03:21:06 +00:00
|
|
|
tests = { inherit (nixosTests) jenkins jenkins-cli; };
|
2020-11-06 00:33:48 +00:00
|
|
|
|
|
|
|
updateScript = writeScript "update.sh" ''
|
|
|
|
#!${stdenv.shell}
|
|
|
|
set -o errexit
|
|
|
|
PATH=${
|
2021-02-05 17:12:51 +00:00
|
|
|
lib.makeBinPath [
|
2020-11-06 00:33:48 +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)"
|
2023-03-24 00:07:29 +00:00
|
|
|
hash="$(nix hash to-sri --type sha256 "$sha256")"
|
2020-11-06 00:33:48 +00:00
|
|
|
|
|
|
|
if [ ! "$oldVersion" = "$version" ]; then
|
2023-03-24 00:07:29 +00:00
|
|
|
update-source-version jenkins "$version" "$hash"
|
2020-11-06 00:33:48 +00:00
|
|
|
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-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "An extendable open source continuous integration server";
|
2023-08-22 20:05:09 +00:00
|
|
|
homepage = "https://jenkins.io/";
|
2022-06-16 17:23:12 +00:00
|
|
|
sourceProvenance = with sourceTypes; [ binaryBytecode ];
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
2022-08-12 12:06:08 +00:00
|
|
|
maintainers = with maintainers; [ coconnor earldouglas nequissimus ajs124 ];
|
|
|
|
changelog = "https://www.jenkins.io/changelog-stable/#v${version}";
|
2022-05-18 14:49:53 +00:00
|
|
|
mainProgram = "jenkins-cli";
|
|
|
|
platforms = platforms.all;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|