Merge staging-next-21.05 into staging-21.05

This commit is contained in:
github-actions[bot] 2021-09-08 18:02:50 +00:00 committed by GitHub
commit 7e76877332
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 74 additions and 12 deletions

View File

@ -2,6 +2,7 @@
with lib; with lib;
let let
cfg = config.services.jenkins; cfg = config.services.jenkins;
jenkinsUrl = "http://${cfg.listenAddress}:${toString cfg.port}${cfg.prefix}";
in { in {
options = { options = {
services.jenkins = { services.jenkins = {
@ -141,14 +142,34 @@ in {
Additional command line arguments to pass to the Java run time (as opposed to Jenkins). Additional command line arguments to pass to the Java run time (as opposed to Jenkins).
''; '';
}; };
withCLI = mkOption {
type = types.bool;
default = false;
description = ''
Whether to make the CLI available.
More info about the CLI available at
<link xlink:href="https://www.jenkins.io/doc/book/managing/cli">
https://www.jenkins.io/doc/book/managing/cli</link> .
'';
};
}; };
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
# server references the dejavu fonts environment = {
environment.systemPackages = [ # server references the dejavu fonts
pkgs.dejavu_fonts systemPackages = [
]; pkgs.dejavu_fonts
] ++ optional cfg.withCLI cfg.package;
variables = {}
// optionalAttrs cfg.withCLI {
# Make it more convenient to use the `jenkins-cli`.
JENKINS_URL = jenkinsUrl;
};
};
users.groups = optionalAttrs (cfg.group == "jenkins") { users.groups = optionalAttrs (cfg.group == "jenkins") {
jenkins.gid = config.ids.gids.jenkins; jenkins.gid = config.ids.gids.jenkins;
@ -215,7 +236,7 @@ in {
''; '';
postStart = '' postStart = ''
until [[ $(${pkgs.curl.bin}/bin/curl -L -s --head -w '\n%{http_code}' http://${cfg.listenAddress}:${toString cfg.port}${cfg.prefix} | tail -n1) =~ ^(200|403)$ ]]; do until [[ $(${pkgs.curl.bin}/bin/curl -L -s --head -w '\n%{http_code}' ${jenkinsUrl} | tail -n1) =~ ^(200|403)$ ]]; do
sleep 1 sleep 1
done done
''; '';

View File

@ -0,0 +1,30 @@
import ./make-test-python.nix ({ pkgs, ...} : rec {
name = "jenkins-cli";
meta = with pkgs.lib.maintainers; {
maintainers = [ pamplemousse ];
};
nodes = {
machine =
{ ... }:
{
services.jenkins = {
enable = true;
withCLI = true;
};
};
};
testScript = ''
start_all()
machine.wait_for_unit("jenkins")
assert "JENKINS_URL" in machine.succeed("env")
assert "http://0.0.0.0:8080" in machine.succeed("echo $JENKINS_URL")
machine.succeed(
"jenkins-cli -auth admin:$(cat /var/lib/jenkins/secrets/initialAdminPassword)"
)
'';
})

View File

@ -1,18 +1,29 @@
{ lib, stdenv, fetchurl, common-updater-scripts, coreutils, git, gnused, nix { lib, stdenv, fetchurl, common-updater-scripts, coreutils, git, gnused
, nixfmt, writeScript, nixosTests, jq, cacert, curl }: , makeWrapper, nix, nixfmt, openjdk, writeScript, nixosTests, jq, cacert, curl
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "jenkins"; pname = "jenkins";
version = "2.277.4"; version = "2.303.1";
src = fetchurl { src = fetchurl {
url = "http://mirrors.jenkins.io/war-stable/${version}/jenkins.war"; url = "http://mirrors.jenkins.io/war-stable/${version}/jenkins.war";
sha256 = "19z72d0rkxpvl03aqz102in9ln08r9831lj3ymsgmglk8c37ici6"; sha256 = "0rf06axz1hxssg942w2g66avak30jy6rfdwxynhriqv3vrf17bja";
}; };
nativeBuildInputs = [ makeWrapper ];
buildCommand = '' buildCommand = ''
mkdir -p "$out/webapps" mkdir -p "$out/bin" "$out/share" "$out/webapps"
cp "$src" "$out/webapps/jenkins.war" cp "$src" "$out/webapps/jenkins.war"
# 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"
''; '';
passthru = { passthru = {

View File

@ -24,11 +24,11 @@ let
in in
with py.pkgs; buildPythonApplication rec { with py.pkgs; buildPythonApplication rec {
pname = "matrix-synapse"; pname = "matrix-synapse";
version = "1.41.1"; version = "1.42.0";
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;
sha256 = "1vaym6mxnwg2xdqjcigi2sb0kkdi0ly5d5ghakfsysxcfn08d1z8"; sha256 = "sha256-wJFjjm9apRqjk5eN/kIEgecHgm/XLbtwXHEpM2pmvO8=";
}; };
patches = [ patches = [