From 9555a5c8e5891e46b7788a3a2eda3dcf672ebc15 Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Thu, 16 Nov 2023 09:21:34 +0100 Subject: [PATCH] feat(compute01/ds-fr): Make update autonomous and update to latest version --- machines/compute01/ds-fr/package/default.nix | 12 +++++++----- machines/compute01/ds-fr/package/meta.nix | 5 +++++ .../compute01/ds-fr/package/rubyEnv/Gemfile.lock | 6 +++--- .../compute01/ds-fr/package/rubyEnv/gemset.nix | 8 ++++---- machines/compute01/ds-fr/package/update.sh | 14 ++++++++++++-- 5 files changed, 31 insertions(+), 14 deletions(-) create mode 100644 machines/compute01/ds-fr/package/meta.nix diff --git a/machines/compute01/ds-fr/package/default.nix b/machines/compute01/ds-fr/package/default.nix index 060cb13..0d0942c 100644 --- a/machines/compute01/ds-fr/package/default.nix +++ b/machines/compute01/ds-fr/package/default.nix @@ -1,16 +1,18 @@ -{ lib, stdenv, fetchFromGitHub, fetchYarnDeps, yarn, fixup_yarn_lock, nodejs, ruby_3_2 -, bundlerEnv, logDir ? "/var/log/ds-fr", dataDir ? "/var/lib/ds-fr" +{ lib, stdenv, fetchFromGitHub, fetchYarnDeps, yarn, fixup_yarn_lock, nodejs +, ruby_3_2, bundlerEnv, logDir ? "/var/log/ds-fr", dataDir ? "/var/lib/ds-fr" , initialDeploymentDate ? "17941030" }: let pname = "ds-fr"; - version = "2023-11-10-01"; + meta = import ./meta.nix; + + inherit (meta) version; src = fetchFromGitHub { owner = "demarches-simplifiees"; repo = "demarches-simplifiees.fr"; rev = version; - hash = "sha256-NRCHISV2EE5sePvVTZfxCJVt7+SgEyMQu/fNDWoLhkk="; + hash = meta.src-hash; }; rubyEnv = bundlerEnv { @@ -37,7 +39,7 @@ let offlineCache = fetchYarnDeps { yarnLock = "${src}/yarn.lock"; - hash = "sha256-/CI6LHI2I0BinrDduN0NNfBSGDynz0lQuySdFaWGaOo="; + hash = meta.deps-hash; }; buildInputs = [ rubyEnv ]; diff --git a/machines/compute01/ds-fr/package/meta.nix b/machines/compute01/ds-fr/package/meta.nix new file mode 100644 index 0000000..3f21462 --- /dev/null +++ b/machines/compute01/ds-fr/package/meta.nix @@ -0,0 +1,5 @@ +{ + version = "2023-11-16-01"; + src-hash = "sha256-A+l8jEWSlCrCdC2/4XGQ9tzXolw7pJbABIPNcgLz52Y="; + deps-hash = "sha256-bEjrlOsnzcX3InQ3QwNCmGBPnX4m740F7cf94n52Tu8="; +} diff --git a/machines/compute01/ds-fr/package/rubyEnv/Gemfile.lock b/machines/compute01/ds-fr/package/rubyEnv/Gemfile.lock index 78c32ca..1257c85 100644 --- a/machines/compute01/ds-fr/package/rubyEnv/Gemfile.lock +++ b/machines/compute01/ds-fr/package/rubyEnv/Gemfile.lock @@ -161,7 +161,7 @@ GEM nokogiri (~> 1.10, >= 1.10.4) rubyzip (>= 1.3.0, < 3) charlock_holmes (0.7.7) - chartkick (4.1.3) + chartkick (5.0.4) choice (0.2.0) chunky_png (1.4.0) clamav-client (3.2.0) @@ -293,8 +293,8 @@ GEM bundler (>= 1.14) graphql (>= 1.10, < 3.0) thor (>= 0.19, < 2.0) - groupdate (5.2.2) - activesupport (>= 5) + groupdate (6.4.0) + activesupport (>= 6.1) haml (6.0.5) temple (>= 0.8.2) thor diff --git a/machines/compute01/ds-fr/package/rubyEnv/gemset.nix b/machines/compute01/ds-fr/package/rubyEnv/gemset.nix index c3974fd..464eafe 100644 --- a/machines/compute01/ds-fr/package/rubyEnv/gemset.nix +++ b/machines/compute01/ds-fr/package/rubyEnv/gemset.nix @@ -505,10 +505,10 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "0qjnm98ki484xy8xqz7xwxvja3j01ybl7v30viz1wff48w5y51gh"; + sha256 = "0838bglijxsv3yyl3xif7fvs1x7rn4sv2kld90b52ybyazvjsldh"; type = "gem"; }; - version = "4.1.3"; + version = "5.0.4"; }; choice = { groups = ["default" "development"]; @@ -1121,10 +1121,10 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "0zfa34vczk21c2sz6xq8n0y7c7dn9628kj6yicyazlx3rg5r18wg"; + sha256 = "0m7cbahlhd7akkizrn2rjp4g6y6wkg8s3dqas6rgjj1apx2hd535"; type = "gem"; }; - version = "5.2.2"; + version = "6.4.0"; }; haml = { dependencies = ["temple" "thor" "tilt"]; diff --git a/machines/compute01/ds-fr/package/update.sh b/machines/compute01/ds-fr/package/update.sh index 81653fa..304f4c0 100755 --- a/machines/compute01/ds-fr/package/update.sh +++ b/machines/compute01/ds-fr/package/update.sh @@ -52,10 +52,20 @@ cp gemset.nix Gemfile Gemfile.lock "$CWD/rubyEnv/" # Print the new source details echo "[+] New hash:" -nix-shell -p nurl --run "nurl --hash $gitUrl $version" +SRC_HASH=$(nix-shell -p nurl --run "nurl --hash $gitUrl $version") # Print Yarn deps hash echo "[+] New dependencies hash:" hash=$(nix-shell -p prefetch-yarn-deps --run "prefetch-yarn-deps yarn.lock") -nix-hash --to-sri --type sha256 "$hash" +DEPS_HASH=$(nix-hash --to-sri --type sha256 "$hash") + +cat < "$CWD/meta.nix" +{ + version = "$version"; + src-hash = "$SRC_HASH"; + deps-hash = "$DEPS_HASH"; +} +EOF + +rm -rf "$TMP"