@@ -213,6 +213,7 @@ var allTests = integration.TestFuncs(
213
213
testLocalCustomSessionID ,
214
214
testTargetStageNameArg ,
215
215
testStepNames ,
216
+ testPowershellInDefaultPathOnWindows ,
216
217
)
217
218
218
219
// Tests that depend on the `security.*` entitlements
@@ -1813,7 +1814,7 @@ COPY Dockerfile .
1813
1814
entrypoint []string
1814
1815
env []string
1815
1816
}{
1816
- {p : "windows/amd64" , entrypoint : []string {"cmd" , "/S" , "/C" , "foo bar" }, env : []string {"PATH=c:\\ Windows\\ System32;c:\\ Windows" }},
1817
+ {p : "windows/amd64" , entrypoint : []string {"cmd" , "/S" , "/C" , "foo bar" }, env : []string {"PATH=c:\\ Windows\\ System32;c:\\ Windows;C: \\ Windows \\ System32 \\ WindowsPowerShell \\ v1.0 " }},
1817
1818
{p : "linux/amd64" , entrypoint : []string {"/bin/sh" , "-c" , "foo bar" }, env : []string {"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" }},
1818
1819
} {
1819
1820
t .Run (exp .p , func (t * testing.T ) {
@@ -1950,6 +1951,49 @@ COPY --from=base /out/ /
1950
1951
require .Equal (t , "value:final" , string (dt ))
1951
1952
}
1952
1953
1954
+ func testPowershellInDefaultPathOnWindows (t * testing.T , sb integration.Sandbox ) {
1955
+ integration .SkipOnPlatform (t , "!windows" )
1956
+
1957
+ f := getFrontend (t , sb )
1958
+
1959
+ // just testing that the powershell path is in PATH
1960
+ // but not testing powershell itself since it will need
1961
+ // servercore image that is too bulky for just one single test.
1962
+ dockerfile := []byte (`
1963
+ FROM nanoserver
1964
+ USER ContainerAdministrator
1965
+ RUN echo %PATH% > env_path.txt
1966
+ ` )
1967
+ dir := integration .Tmpdir (
1968
+ t ,
1969
+ fstest .CreateFile ("Dockerfile" , dockerfile , 0600 ),
1970
+ )
1971
+ c , err := client .New (sb .Context (), sb .Address ())
1972
+ require .NoError (t , err )
1973
+ defer c .Close ()
1974
+
1975
+ destDir := t .TempDir ()
1976
+ _ , err = f .Solve (sb .Context (), c , client.SolveOpt {
1977
+ Exports : []client.ExportEntry {
1978
+ {
1979
+ Type : client .ExporterLocal ,
1980
+ OutputDir : destDir ,
1981
+ },
1982
+ },
1983
+ LocalMounts : map [string ]fsutil.FS {
1984
+ dockerui .DefaultLocalNameDockerfile : dir ,
1985
+ dockerui .DefaultLocalNameContext : dir ,
1986
+ },
1987
+ }, nil )
1988
+ require .NoError (t , err )
1989
+
1990
+ dt , err := os .ReadFile (filepath .Join (destDir , "env_path.txt" ))
1991
+ require .NoError (t , err )
1992
+
1993
+ envPath := string (dt )
1994
+ require .Contains (t , envPath , "C:\\ Windows\\ System32\\ WindowsPowerShell\\ v1.0" )
1995
+ }
1996
+
1953
1997
func testExportMultiPlatform (t * testing.T , sb integration.Sandbox ) {
1954
1998
integration .SkipOnPlatform (t , "windows" )
1955
1999
workers .CheckFeatureCompat (t , sb , workers .FeatureOCIExporter , workers .FeatureMultiPlatform )
0 commit comments