Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
c9b9727
implement inline attribute and behavior
pchalamet Sep 14, 2025
af7d5d8
rename GraphBuilder
pchalamet Sep 14, 2025
55229d5
rename GraphBuilder as NodeBuilder
pchalamet Sep 14, 2025
95b225f
implement node state evaluator
pchalamet Sep 14, 2025
a2f2ade
use node action in build
pchalamet Sep 14, 2025
8842f20
revert inline and prepare for cluster build
pchalamet Sep 20, 2025
af08b4c
compute node generation
pchalamet Sep 20, 2025
3b0d67a
fix buildOrRestore
pchalamet Sep 20, 2025
3ce1b79
remove idempotent
pchalamet Sep 20, 2025
631c032
remove +status on task id
pchalamet Sep 20, 2025
1716698
update build scheduling
pchalamet Sep 20, 2025
d4bf3fd
reformat
pchalamet Sep 20, 2025
50275a2
discard non buildable root node
pchalamet Sep 20, 2025
27471c8
add title for logs
pchalamet Sep 20, 2025
36c7092
better ignore node build
pchalamet Sep 20, 2025
f8ec22b
better max date computation
pchalamet Sep 20, 2025
9c99478
better max date computation
pchalamet Sep 20, 2025
1c0512c
rename generation as lineage
pchalamet Sep 20, 2025
ba1aad4
continuation based build
pchalamet Sep 20, 2025
e71c478
schedule info once dependencies done
pchalamet Sep 20, 2025
4dc9fff
only keep buildable root nodes
pchalamet Sep 20, 2025
4f99abc
remove Rebuild as this can be inferred
pchalamet Sep 20, 2025
326cc63
code cleanup
pchalamet Sep 20, 2025
e7a2689
update smoke tests
pchalamet Sep 20, 2025
8779cbc
fix rendering issue
pchalamet Sep 20, 2025
b7eee96
schedule cluster
pchalamet Sep 20, 2025
a4e588d
code cleanup
pchalamet Sep 20, 2025
bf2f208
fix lineage computation for root node
pchalamet Sep 20, 2025
b01fac2
compute cluster
pchalamet Sep 20, 2025
d917bd4
add cluster builder
pchalamet Sep 20, 2025
0beb535
rename as action builder
pchalamet Sep 20, 2025
3c8b40d
fix merge root nodes
pchalamet Sep 20, 2025
9c6bfd6
add smoke tests for action and build graph
pchalamet Sep 21, 2025
fdd0d94
do not create virtual root node if nothing has been merged
pchalamet Sep 21, 2025
c4c6b8d
code cleanup
pchalamet Sep 21, 2025
0bdae86
add batch attribute for extension
pchalamet Sep 21, 2025
f080eeb
propagate cluster hash
pchalamet Sep 21, 2025
6ff72fb
build cluster for all nodes
pchalamet Sep 21, 2025
22948f2
add batch attribute
pchalamet Sep 21, 2025
c17139a
prepare build for batching
pchalamet Sep 21, 2025
d83ea20
remove useless info in graph
pchalamet Sep 21, 2025
36e9fc4
fix build correct id
pchalamet Sep 21, 2025
954c327
prepare cluster node builder
pchalamet Sep 22, 2025
11f050f
compute cluster to cluster dependencies
pchalamet Sep 24, 2025
47c5eb7
prepare for batch commands
pchalamet Sep 24, 2025
e738e96
setup context for extension
pchalamet Sep 24, 2025
6971fe5
implement batch for .net extension
pchalamet Sep 24, 2025
3e4b59d
code cleanup
pchalamet Sep 25, 2025
3f2da45
use relative path respective to working dir
pchalamet Sep 25, 2025
35c2041
initialize clusters in graph
pchalamet Sep 25, 2025
4e7aeac
implement cluster nodes
pchalamet Sep 25, 2025
6b29b26
use home dir
pchalamet Sep 25, 2025
aa1ae4c
relative path
pchalamet Sep 25, 2025
3df006a
code cleanup
pchalamet Sep 25, 2025
fb1978e
implement batch build
pchalamet Sep 26, 2025
b80aa9a
fix cluster nodes scheduling info
pchalamet Sep 26, 2025
f1fc2ba
fix cluster node status
pchalamet Sep 26, 2025
038811d
fix progress for batched nodes
pchalamet Sep 26, 2025
82c2733
code cleanup
pchalamet Sep 26, 2025
ede9f10
fix batch build caching
pchalamet Sep 26, 2025
4195e0f
post-copy logs to cluster nodes
pchalamet Sep 26, 2025
cd7a251
batch log update
pchalamet Sep 26, 2025
27ba6a3
update smoke tests
pchalamet Sep 26, 2025
87b7501
enable batch build for self terrabuild
pchalamet Sep 26, 2025
1527ca7
enable cluster build for simple tests
pchalamet Sep 26, 2025
f0a2d0a
async upload summaries
pchalamet Sep 26, 2025
20e58d5
cluster must build and have 1 node
pchalamet Sep 26, 2025
f9c7ac3
compute dependencies for batch nodes
pchalamet Sep 26, 2025
bf22334
fix dependencies of cluster
pchalamet Sep 26, 2025
cf2cbdf
fix rebuild date
pchalamet Sep 26, 2025
b5b9e2b
schedule node after dependencies
pchalamet Sep 26, 2025
b514e35
add missing files
pchalamet Sep 27, 2025
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: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -420,3 +420,5 @@ terrabuild-debug.md
.mono
*.zip
*.fsyacc.output

!**/results/terrabuild-debug.*
8 changes: 5 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
// self build
// "args": ["run", "build", "test", "dist", "--parallel", "1", "--debug", "--log", "--retry", "--local-only" ],
// "args": ["run", "build", "test", "--workspace", "tests/simple", "--parallel", "1", "--debug", "--log" ],
"args": ["run", "build", "test", "plan", "apply", "--workspace", "tests/indirect-target", "--parallel", "1", "--debug", "--log" ],

// "args": ["run", "build", "test", "plan", "apply", "--workspace", "tests/indirect-target", "--parallel", "1", "--debug", "--log" ],

"args": ["run", "build", "--workspace", "../../matis/matis-next", "--configuration", "local", "--retry", "--debug", "--local-only" ],

// "args": ["run", "build", "--workspace", "tests/cluster-layers", "--force", "--debug", "-p", "1", "--whatif" ],
// "args": ["run", "build", "--workspace", "tests/cluster-layers", "--force", "--debug", "-p", "1", "--whatif" ],
// "args": ["run", "plan", "dist", "build", "test", "--workspace", "../insights", "--log", "-c", "dev", "--debug", "-p", "1", "--whatif" ],
// "args": ["run", "build", "test", "plan", "apply", "--log", "--debug", "--parallel", "1" ],
// "args": ["run", "build", "test", "dist", "--log", "--debug", "--parallel", "1", "--retry", "--local-only", "-p", "terrabuild" ],
// "args": [ "run", "build", "-w", "tests/basic", "--whatif", "-p", "1" ],
// "args": ["run", "build", "-w", "tests/simple", "--debug", "-p", "1", "--force" ],
// "cwd": "${workspaceFolder}/tests/indirect-target",
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ docs:
dotnet run --project tools/DocGen -- src/Terrabuild.Extensions/bin/$(config)/net9.0/Terrabuild.Extensions.xml ../terrabuild.io/content/docs/extensions

self: clean publish
$(PWD)/.out/dotnet/terrabuild run build test dist --configuration $(config) --debug --log --retry --local-only
$(PWD)/.out/dotnet/terrabuild run build --configuration $(config) --debug --log --retry --local-only -p terrabuild

self-logs:
$(PWD)/.out/dotnet/terrabuild logs build test dist --configuration $(config) --debug --log --local-only
Expand Down Expand Up @@ -151,6 +151,8 @@ endef
define diff_results
$(call diff_file,$(1),terrabuild-debug.config.json)
$(call diff_file,$(1),terrabuild-debug.build-graph.json)
$(call diff_file,$(1),terrabuild-debug.action-graph.json)
$(call diff_file,$(1),terrabuild-debug.cluster-graph.json)
$(call diff_file,$(1),terrabuild-debug.info.md)
endef

Expand Down
6 changes: 1 addition & 5 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ locals {
configuration = local.is_prod ? "Release" : "Debug"
}

target install {
cache = "local"
idempotent = true
}

target build {
depends_on = [ target.install
target.^build ]
Expand All @@ -33,6 +28,7 @@ target publish {

extension @dotnet {
container = "mcr.microsoft.com/dotnet/sdk:9.0.304"
batch = true
defaults {
configuration = local.configuration
}
Expand Down
7 changes: 2 additions & 5 deletions src/Terrabuild.Common.Tests/PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ project {
@dotnet { }
}

target install {
@dotnet restore { }
}

target build {
@dotnet build { }
@dotnet restore { dependencies = true }
@dotnet build { dependencies = true }
}

target test {
Expand Down
7 changes: 2 additions & 5 deletions src/Terrabuild.Common/PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ project {
@dotnet { }
}

target install {
@dotnet restore { }
}

target build {
@dotnet build { }
@dotnet restore { dependencies = true }
@dotnet build { dependencies = true }
}
7 changes: 2 additions & 5 deletions src/Terrabuild.Configuration.Tests/PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ project {
@dotnet { }
}

target install {
@dotnet restore { }
}

target build {
@dotnet build { }
@dotnet restore { dependencies = true }
@dotnet build { dependencies = true }
}

target test {
Expand Down
16 changes: 8 additions & 8 deletions src/Terrabuild.Configuration.Tests/Project.fs
Original file line number Diff line number Diff line change
Expand Up @@ -27,42 +27,42 @@ let parseProject() =
Platform = None
Variables = None
Script = None
Defaults = Map [ "configuration", Expr.Variable "var.configuration" ] |> Some }
Defaults = Map [ "configuration", Expr.Variable "var.configuration" ] |> Some
Batch = Some Expr.True }
let extDocker =
{ Container = None
Platform = None
Variables = Expr.List [ Expr.String "ARM_TENANT_ID" ] |> Some
Script = None
Defaults = Map [ "configuration", Expr.Variable "local.configuration"
"image", Expr.String "ghcr.io/magnusopera/dotnet-app" ] |> Some }
"image", Expr.String "ghcr.io/magnusopera/dotnet-app" ] |> Some
Batch = None }
let extDummy =
{ Container = None
Platform = None
Variables = None
Script = "dummy.fsx" |> Expr.String |> Some
Defaults = None }
Defaults = None
Batch = None }

let targetBuild =
{ TargetBlock.DependsOn = Set [ "dist" ] |> Some
TargetBlock.Rebuild = None
TargetBlock.Outputs = None
TargetBlock.Cache = None
TargetBlock.Idempotent = Expr.True |> Some
TargetBlock.Steps = [ { Extension = "@dotnet"; Command = "build"; Parameters = Map.empty } ] }
let targetDist =
{ TargetBlock.DependsOn = None
TargetBlock.Rebuild = None
TargetBlock.Outputs = None
TargetBlock.Cache = None
TargetBlock.Idempotent = None
TargetBlock.Steps = [ { Extension = "@dotnet"; Command = "build"; Parameters = Map.empty }
{ Extension = "@dotnet"; Command = "publish"; Parameters = Map.empty } ] }
let targetDocker =
{ TargetBlock.DependsOn = None
TargetBlock.Rebuild = Some (Expr.Bool false)
TargetBlock.Outputs = None
TargetBlock.Cache = "always" |> Expr.String |> Some
TargetBlock.Idempotent = None
TargetBlock.Steps = [ { Extension = "@shell"; Command = "echo"
Parameters = Map [ "arguments", Expr.Function (Function.Trim,
[ Expr.Function (Function.Plus,
Expand Down Expand Up @@ -108,7 +108,8 @@ let parseProject2() =
Platform = None
Variables = None
Script = None
Defaults = None }
Defaults = None
Batch = None }

let buildTarget =
{ TargetBlock.Rebuild = Expr.Bool true |> Some
Expand All @@ -118,7 +119,6 @@ let parseProject2() =
Expr.String ".dll" ])] |> Some
TargetBlock.DependsOn = None
TargetBlock.Cache = None
TargetBlock.Idempotent = None
TargetBlock.Steps = [ { Extension = "@dotnet"; Command = "build"; Parameters = Map.empty } ] }

let locals =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
target build {
depends_on = [ target.dist ]

@dotnet build { }
@dotnet build { dependencies = true }
}

target build {
depends_on = [ target.dist ]

@dotnet build { }
@dotnet build { dependencies = true }
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# comment at top of file

extension @dotnet {
batch = true
defaults { # comment at end of line
configuration = var.configuration
}
Expand Down Expand Up @@ -32,7 +33,6 @@ project id {

target build {
depends_on = [ target.dist ]
idempotent = true

@dotnet build { }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ workspace {

target build { # comment at end of line
depends_on = [ target.^build ]
idempotent = false
}

# comment in the middle of the file
Expand All @@ -22,6 +21,7 @@ target dummy { }

extension dotnet {
container = "mcr.microsoft.com/dotnet/sdk:8.0.101"
batch = false
defaults {
configuration = local.configuration
}
Expand Down
33 changes: 16 additions & 17 deletions src/Terrabuild.Configuration.Tests/Workspace.fs
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,37 @@ let parseWorkspace() =
let targetBuild =
{ TargetBlock.DependsOn = Set [ "^build" ] |> Some
TargetBlock.Rebuild = None
TargetBlock.Cache = None
TargetBlock.Idempotent = Expr.False |> Some }
TargetBlock.Cache = None }
let targetDist =
{ TargetBlock.DependsOn = Set [ "build" ] |> Some
TargetBlock.Rebuild = Expr.Bool true |> Some
TargetBlock.Cache = "never" |> Expr.String |> Some
TargetBlock.Idempotent = None }
TargetBlock.Cache = "never" |> Expr.String |> Some }
let targetDummy =
{ TargetBlock.DependsOn = None
TargetBlock.Rebuild = None
TargetBlock.Cache = None
TargetBlock.Idempotent = None }
TargetBlock.Cache = None }

let extDotnet =
{ Container = Some (Expr.String "mcr.microsoft.com/dotnet/sdk:8.0.101")
Platform = None
Variables = None
Script = None
Defaults = Map [ "configuration", Expr.Variable "local.configuration" ] |> Some }
Defaults = Map [ "configuration", Expr.Variable "local.configuration" ] |> Some
Batch = Some Expr.False }
let extDocker =
{ Container = None
Platform = None
Variables = None
Script = None
Defaults = None }
Defaults = None
Batch = None }
let extNpm =
{ Container = Some (Expr.String "node:20")
Platform = None
Variables = None
Script = "scripts/npm.fsx" |> Expr.String |> Some
Defaults = None }
Defaults = None
Batch = None }

{ WorkspaceFile.Workspace = { Id = "d7528db2-83e0-4164-8c8e-1e0d6d6357ca" |> Some
Ignores = Set [ "**/node_modules" ] |> Some
Expand All @@ -71,18 +71,15 @@ let parseWorkspace2() =
let targetBuild =
{ TargetBlock.DependsOn = Set [ "^build" ] |> Some
TargetBlock.Rebuild = None
TargetBlock.Cache = None
TargetBlock.Idempotent = None }
TargetBlock.Cache = None }
let targetDist =
{ TargetBlock.DependsOn = Set [ "build" ] |> Some
TargetBlock.Rebuild = Expr.Bool true |> Some
TargetBlock.Cache = None
TargetBlock.Idempotent = None }
TargetBlock.Cache = None }
let targetDummy =
{ TargetBlock.DependsOn = None
TargetBlock.Rebuild = None
TargetBlock.Cache = None
TargetBlock.Idempotent = None }
TargetBlock.Cache = None }

let extDotnet =
{ Container = Expr.String "mcr.microsoft.com/dotnet/sdk:8.0.101" |> Some
Expand All @@ -91,13 +88,15 @@ let parseWorkspace2() =
Script = None
Defaults = Map [ "configuration1", Expr.Function (Function.Item, [Expr.Variable "var.map"; Expr.String "toto"])
"configuration2", Expr.Function (Function.Item, [Expr.Variable "var.map"; Expr.String "titi"])
"configuration3", Expr.Function (Function.Replace, [Expr.String "toto titi"; Expr.String "toto"; Expr.String "titi"]) ] |> Some }
"configuration3", Expr.Function (Function.Replace, [Expr.String "toto titi"; Expr.String "toto"; Expr.String "titi"]) ] |> Some
Batch = None }
let extDocker =
{ Container = None
Platform = None
Variables = None
Script = None
Defaults = None }
Defaults = None
Batch = None }

{ WorkspaceFile.Workspace = { Id = None; Ignores = None; Version = None }
WorkspaceFile.Targets = Map [ "build", targetBuild
Expand Down
4 changes: 2 additions & 2 deletions src/Terrabuild.Configuration/AST/Common.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ type ExtensionBlock =
Platform: Expr option
Variables: Expr option
Script: Expr option
Defaults: Map<string, Expr> option }

Defaults: Map<string, Expr> option
Batch: Expr option }
1 change: 0 additions & 1 deletion src/Terrabuild.Configuration/AST/Project.fs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ type TargetBlock =
DependsOn: Set<string> option
Rebuild: Expr option
Cache: Expr option
Idempotent: Expr option
Steps: Step list }

[<RequireQualifiedAccess>]
Expand Down
3 changes: 1 addition & 2 deletions src/Terrabuild.Configuration/AST/Workspace.fs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ type WorkspaceBlock =
type TargetBlock =
{ DependsOn: Set<string> option
Rebuild: Expr option
Cache: Expr option
Idempotent: Expr option }
Cache: Expr option }

[<RequireQualifiedAccess>]
type WorkspaceFile =
Expand Down
7 changes: 2 additions & 5 deletions src/Terrabuild.Configuration/PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ project {
@dotnet { }
}

target install {
@dotnet restore { }
}

target build {
@dotnet build { }
@dotnet restore { dependencies = true }
@dotnet build { dependencies = true }
}
6 changes: 4 additions & 2 deletions src/Terrabuild.Configuration/Transpiler/Common.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ open Helpers

let toExtension (block: Block) =
block
|> checkAllowedAttributes ["container"; "platform"; "variables"; "script"; "defaults"]
|> checkAllowedAttributes ["container"; "platform"; "variables"; "script"; "defaults"; "batch"]
|> checkAllowedNestedBlocks ["defaults"]
|> ignore

let container = block |> tryFindAttribute "container"
let platform = block |> tryFindAttribute "platform"
let variables = block |> tryFindAttribute "variables"
let script = block |> tryFindAttribute "script"
let batch = block |> tryFindAttribute "batch"
let defaults =
block
|> tryFindBlock "defaults"
Expand All @@ -29,7 +30,8 @@ let toExtension (block: Block) =
ExtensionBlock.Platform = platform
ExtensionBlock.Variables = variables
ExtensionBlock.Script = script
ExtensionBlock.Defaults = defaults }
ExtensionBlock.Defaults = defaults
ExtensionBlock.Batch = batch }

let toLocals (block: Block) =
block
Expand Down
4 changes: 1 addition & 3 deletions src/Terrabuild.Configuration/Transpiler/Project.fs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ let toProject (block: Block) =

let toTarget (block: Block) =
block
|> checkAllowedAttributes ["outputs"; "depends_on"; "rebuild"; "cache"; "idempotent"]
|> checkAllowedAttributes ["outputs"; "depends_on"; "rebuild"; "cache"]
|> ignore

let outputs = block |> tryFindAttribute "outputs"
Expand All @@ -85,7 +85,6 @@ let toTarget (block: Block) =
| _ -> raiseInvalidArg $"Invalid target dependency '{dependency}'"))
let rebuild = block |> tryFindAttribute "rebuild"
let cache = block |> tryFindAttribute "cache"
let idempotent = block |> tryFindAttribute "idempotent"
let steps =
block.Blocks
|> List.map (fun step ->
Expand All @@ -111,7 +110,6 @@ let toTarget (block: Block) =
TargetBlock.DependsOn = dependsOn
TargetBlock.Rebuild = rebuild
TargetBlock.Cache = cache
TargetBlock.Idempotent = idempotent
TargetBlock.Steps = steps }


Expand Down
Loading
Loading