Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bench nomad exec #4852

Merged
merged 6 commits into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ trace-documentation:
###
### Workbench
###
workbench-ci: workbench-ci-test ci-test-auto ci-test-autonix ci-test-autonomad
workbench-ci: workbench-ci-test ci-test-auto ci-test-autonix ci-test-autonomadpodman
fmaste marked this conversation as resolved.
Show resolved Hide resolved
CI_TARGETS := hlint workbench-ci haddock-hoogle
ci: ci-report ci-targets
ci-report:
Expand Down
24 changes: 14 additions & 10 deletions lib.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@ endif
endef

define define_profile_targets
$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof), $$(prof),false, true,false,false,false, supervisor)))
$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-prof, $$(prof),false, true,false,false, true, supervisor)))
$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-auto, $$(prof),false, true, true,false,false, supervisor)))
$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-autostay, $$(prof),false, true, true, true,false, supervisor)))
$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-nix, $$(prof), true,false,false,false,false, supervisor)))
$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-autonix, $$(prof), true,false, true,false,false, supervisor)))
$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-nomad, $$(prof), true,false,false,false,false, nomad)))
$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-autonomad, $$(prof), true,false, true,false,false, nomad)))
$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-nixops, $$(prof), true, true,false,false,false, nixops)))
$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-autonixops, $$(prof), true, true, true, true,false, nixops)))
$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof), $$(prof),false, true,false,false,false, supervisor)))
$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-prof, $$(prof),false, true,false,false, true, supervisor)))
$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-auto, $$(prof),false, true, true,false,false, supervisor)))
$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-autostay, $$(prof),false, true, true, true,false, supervisor)))
$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-nix, $$(prof), true,false,false,false,false, supervisor)))
$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-autonix, $$(prof), true,false, true,false,false, supervisor)))
$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-nomad, $$(prof), true,false,false,false,false, nomad)))
$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-nomad-auto, $$(prof), true,false, true,false,false, nomad)))
$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-nomadpodman, $$(prof), true,false,false,false,false, nomadpodman)))
$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-nomadpodman-auto, $$(prof), true,false, true,false,false, nomadpodman)))
$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-nomadexec, $$(prof), true,false,false,false,false, nomadexec)))
$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-nomadexec-auto, $$(prof), true,false, true,false,false, nomadexec)))
$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-nixops, $$(prof), true, true,false,false,false, nixops)))
$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-autonixops, $$(prof), true, true, true, true,false, nixops)))
endef
31 changes: 20 additions & 11 deletions nix/pkgs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,26 @@ let
# A conveniently-parametrisable workbench preset.
# See https://input-output-hk.github.io/haskell.nix/user-guide/development/
# The general idea is:
# 1. backendName -> useCabalRun -> backend
# 2. stateDir -> batchName -> profileName -> backend -> workbench -> runner
# 1. backendName -> stateDir -> basePort -> useCabalRun -> backend
# 2. batchName -> profileName -> backend -> workbench -> runner
# * `workbench` is in case a pinned version of the workbench is needed.
workbench-runner =
let backendRegistry =
{
nixops = ./workbench/backend/nixops.nix;
nomad = ./workbench/backend/nomad.nix;
supervisor = ./workbench/backend/supervisor.nix;
};
in
let
backendRegistry =
{
nixops = params:
import ./workbench/backend/nixops.nix params;
nomad = params:
import ./workbench/backend/nomad.nix (params // {execTaskDriver=false;});
nomadexec = params:
import ./workbench/backend/nomad.nix (params // {execTaskDriver=true; });
nomadpodman = params:
import ./workbench/backend/nomad.nix (params // {execTaskDriver=false;});
supervisor = params:
import ./workbench/backend/supervisor.nix params;
}
;
in
{ stateDir ? customConfig.localCluster.stateDir
, batchName ? customConfig.localCluster.batchName
, profileNix ? null
Expand All @@ -40,12 +49,12 @@ let
# The `useCabalRun` flag is set in the backend to allow the backend to
# override its value. The runner uses the value of `useCabalRun` from
# the backend to prevent a runner using a different value.
backend = import (backendRegistry."${backendName}")
backend = (backendRegistry."${backendName}")
{ inherit pkgs lib stateDir basePort useCabalRun; };
in import ./workbench/backend/runner.nix
{
inherit pkgs lib cardanoNodePackages;
inherit stateDir batchName profileName backend;
inherit batchName profileName backend;
inherit cardano-node-rev;
inherit workbench workbenchDevMode;
};
Expand Down
2 changes: 1 addition & 1 deletion nix/workbench/backend/backend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ case "${op}" in
cleanup-cluster ) backend_$WB_BACKEND "$@";;

## Handle non-generic calls:
passthrough | pass ) backend_$WB_BACKEND "$@";;
passthrough | pass ) shift; backend_$WB_BACKEND "$@";;

validate )
local usage="USAGE: wb run $op"
Expand Down
6 changes: 4 additions & 2 deletions nix/workbench/backend/nixops.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{ pkgs
, lib
, stateDir # Not used here, just returned
, basePort
## `useCabalRun` not used here unlike `supervisor.nix`.
, ...
}:
with lib; with pkgs.commonLib;
Expand Down Expand Up @@ -265,7 +267,7 @@ let
};

materialise-profile =
{ stateDir, profileNix }:
{ profileNix }:
let
in pkgs.runCommand "workbench-backend-output-${profileNix.profileName}-nixops"
{}
Expand Down Expand Up @@ -307,7 +309,7 @@ in
{
name = "nixops";

inherit extraShellPkgs materialise-profile overlay service-modules basePort;
inherit extraShellPkgs materialise-profile overlay service-modules stateDir basePort;

useCabalRun = false;
}
Loading