summary refs log tree commit diff
path: root/pkgs/development/tools/continuous-integration/jenkins/update.sh
blob: 66d1b4ceff668d46ed1d40638fe54853f1fc85f8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/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 ./. {}; jenkins.version or (builtins.parseDrvName jenkins.name).version" | 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