Skip to content

Commit ca04671

Browse files
committed
wb | check correct commit when using the nomadcloud backend
1 parent 96b90dd commit ca04671

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

nix/workbench/backend/nomad.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ let
5252
# path of this packages while keeping the extra details as a `jq` friendly
5353
# reference that are used to change it later appending the desired commit
5454
# (interchanging commits it's still an untested feature).
55-
# For cloud runs references:
55+
# For "nomadcloud" runs workbench's `$WB_GITREV` is used as commit:
5656
# installable="${flakeReference}/${commit}#${flakeOutput}"
5757
installables =
5858
{
@@ -142,7 +142,7 @@ let
142142
{
143143
# Provided that all the "start.sh" scripts are taking it into account,
144144
# this packages could be configured to come from a different commit than
145-
# the one used to enter the shell ??????????
145+
# the one used to enter the shell.
146146
cardano-node = rec {
147147
# Local reference only used if not "cloud".
148148
# Avoid rebuilding on every commit because of `set-git-rev`.

nix/workbench/backend/nomad/cloud.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,8 @@ allocate-run-nomadcloud() {
334334
# outputs it needs inside the container, these are built using the packages
335335
# metadata in "containerPkgs" and the current commit.
336336
local gitrev
337-
gitrev="$(git rev-parse HEAD)"
338-
msg $(blue "INFO: Found GitHub commit with ID \"$gitrev\"")
337+
gitrev="${WB_GITREV:?"No WB_GITREV"}"
338+
msg $(blue "INFO: Found GitHub commit with ID \"$gitrev\" set on shell creation")
339339
# Check if the Nix package was created from a dirty git tree
340340
if test "$gitrev" = "0000000000000000000000000000000000000000"
341341
then

nix/workbench/backend/runner.nix

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ let
3838
# build plan as computed by nix
3939
nixPlanJson = cardanoNodeProject.plan-nix.json;
4040

41+
# Optimize cache hits setting gitrev using bash once inside the shell.
4142
workbench-envars =
4243
''
4344
export WB_CHAP_PATH=${chap}
@@ -50,6 +51,10 @@ let
5051
export WB_DEPLOYMENT_NAME=''${WB_DEPLOYMENT_NAME:-$(basename $(pwd))}
5152
export WB_MODULAR_GENESIS=''${WB_MODULAR_GENESIS:-0}
5253
export WB_LOCLI_DB=''${WB_LOCLI_DB:-1}
54+
if test -z "$(git status --porcelain --untracked-files=no)"
55+
then export WB_GITREV="$(git rev-parse HEAD)"
56+
else export WB_GITREV="0000000000000000000000000000000000000000"
57+
fi
5358
export CARDANO_NODE_SOCKET_PATH=${stateDir}/node-0/node.socket
5459
''
5560
+ lib.optionalString (profileBundle.profile.value.scenario == "chainsync") (
@@ -112,7 +117,7 @@ let
112117
gnused
113118
procps
114119
nix
115-
git
120+
git # `workbench-envars` set the gitrev
116121
jq
117122
]
118123
)

0 commit comments

Comments
 (0)