@@ -73,37 +73,51 @@ let private publishZip _ =
73
73
]
74
74
zip " docs-builder"
75
75
zip " docs-assembler"
76
+
77
+ let private prNumber () =
78
+ match Environment.environVarOrNone " GITHUB_REF_NAME" with
79
+ | None -> None
80
+ | Some s when s.EndsWith " /merge" -> Some ( s.Split( '/' ) |> Seq.head)
81
+ | _ -> None
82
+
83
+ let private imageTags () =
84
+ let pr = prNumber()
85
+ let exitCode = exec {
86
+ validExitCode ( fun _ -> true )
87
+ exit_ code_ of " git" " describe" " --tags" " --exact-match" " HEAD"
88
+ }
89
+ match ( exitCode, pr) with
90
+ | 0 , _ -> " edge;latest"
91
+ | _, None -> " edge"
92
+ | _, Some pr -> $" ci-%s {pr}"
93
+
94
+ let private runLocalContainer _ =
95
+ let tag =
96
+ match imageTags() with
97
+ | ci when ci.StartsWith( " ci-" ) -> ci
98
+ | _ -> " edge"
99
+ let image = $" elastic/docs-builder:%s {tag}"
100
+ exec { run " docker" [ " docker" ; " run" ; image; " --help" ] }
76
101
77
102
let private publishContainers _ =
78
103
79
104
let createImage project =
80
105
let ci = Environment.environVarOrNone " GITHUB_ACTIONS"
81
- let pr =
82
- match Environment.environVarOrNone " GITHUB_REF_NAME" with
83
- | None -> None
84
- | Some s when s.EndsWith " /merge" -> Some ( s.Split( '/' ) |> Seq.head)
85
- | _ -> None
86
- let imageTag =
106
+ let pr = prNumber()
107
+ let baseImageTag =
87
108
match project with
88
109
| _ -> " 9.0-noble-chiseled-aot"
89
- let labels =
90
- let exitCode = exec {
91
- validExitCode ( fun _ -> true )
92
- exit_ code_ of " git" " describe" " --tags" " --exact-match" " HEAD"
93
- }
94
- match ( exitCode, pr) with
95
- | 0 , _ -> " edge;latest"
96
- | _, None -> " edge"
97
- | _, Some pr -> $" ci-%s {pr}"
110
+ let labels = imageTags()
98
111
let args =
99
112
[ " publish" ; $" src/tooling/%s {project}/%s {project}.csproj" ]
100
113
@ [
101
114
" /t:PublishContainer" ;
102
115
" -p" ; " DebugType=none" ;
103
- " -p" ; $" ContainerBaseImage=mcr.microsoft.com/dotnet/nightly/runtime-deps:%s {imageTag }" ;
116
+ " -p" ; $" ContainerBaseImage=mcr.microsoft.com/dotnet/nightly/runtime-deps:%s {baseImageTag }" ;
104
117
" -p" ; $" ContainerImageTags=\" %s {labels};%s {Software.Version.Normalize()}\" "
105
118
" -p" ; $" ContainerRepository=elastic/%s {project}"
106
119
]
120
+
107
121
let noPublish = Environment.environVarOrNone " DOCKER_NO_PUBLISH"
108
122
let registry =
109
123
match ( ci, pr, noPublish) with
@@ -172,6 +186,7 @@ let Setup (parsed:ParseResults<Build>) =
172
186
| PristineCheck -> Build.Step pristineCheck
173
187
| PublishBinaries -> Build.Step publishBinaries
174
188
| PublishContainers -> Build.Step publishContainers
189
+ | RunLocalContainer -> Build.Step runLocalContainer
175
190
| PublishZip -> Build.Step publishZip
176
191
| ValidateLicenses -> Build.Step validateLicenses
177
192
0 commit comments