From fa3b0a72c1f5e872d2dd51c9b4c9fc353db2a264 Mon Sep 17 00:00:00 2001 From: Andrey Koltsov Date: Mon, 27 Nov 2023 22:51:28 +0100 Subject: [PATCH] Cherry-pick [TCQA] Handle escaping based on PowerShell Module Cache Initialization @ Windows 2022 --- configs/windows/Agent/nanoserver/NanoServer2022.Dockerfile | 2 +- .../windowsservercore/WindowsServerCore2022.Dockerfile | 6 +++--- .../MinimalAgent/nanoserver/NanoServer2022.Dockerfile | 2 +- configs/windows/Server/nanoserver/NanoServer2022.Dockerfile | 2 +- context/generated/windows/Agent/nanoserver/2022/Dockerfile | 2 +- .../windows/Agent/windowsservercore/2022/Dockerfile | 6 +++--- .../windows/MinimalAgent/nanoserver/2022/Dockerfile | 2 +- context/generated/windows/Server/nanoserver/2022/Dockerfile | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/configs/windows/Agent/nanoserver/NanoServer2022.Dockerfile b/configs/windows/Agent/nanoserver/NanoServer2022.Dockerfile index 5451a32e..933cb705 100644 --- a/configs/windows/Agent/nanoserver/NanoServer2022.Dockerfile +++ b/configs/windows/Agent/nanoserver/NanoServer2022.Dockerfile @@ -95,7 +95,7 @@ ENV CONFIG_FILE="C:\BuildAgent\conf\buildAgent.properties" \ # In order to set system PATH, ContainerAdministrator must be used USER ContainerAdministrator RUN setx /M PATH "%PATH%;%JAVA_HOME%\bin;C:\Program Files\Git\cmd;C:\Program Files\dotnet" -# Grant Permissions for ContainerUser (Default Account), OI - Object Inherit, CI - Contaiber Inherit, F - full control +# Grant Permissions for ContainerUser (Default Account), OI - Object Inherit, CI - Container Inherit, F - full control RUN cmd /c icacls.exe C:\\BuildAgent\\* /grant:r DefaultAccount:(OI)(CI)F RUN cmd /c icacls.exe C:\\BuildAgent\\* /grant:r Users:(OI)(CI)F USER ContainerUser diff --git a/configs/windows/Agent/windowsservercore/WindowsServerCore2022.Dockerfile b/configs/windows/Agent/windowsservercore/WindowsServerCore2022.Dockerfile index 568d6ce3..a7b2f043 100644 --- a/configs/windows/Agent/windowsservercore/WindowsServerCore2022.Dockerfile +++ b/configs/windows/Agent/windowsservercore/WindowsServerCore2022.Dockerfile @@ -105,7 +105,7 @@ ENV CONFIG_FILE="C:\BuildAgent\conf\buildAgent.properties" \ USER ContainerAdministrator RUN setx /M PATH ('{0};{1}\bin;C:\Program Files\Git\cmd;C:\Program Files\Mercurial' -f $env:PATH, $env:JAVA_HOME) -# Grant Permissions for ContainerUser (Default Account), OI - Object Inherit, CI - Contaiber Inherit, F - full control -RUN cmd /c icacls.exe C:\\BuildAgent\\* /grant:r DefaultAccount:(OI)(CI)F -RUN cmd /c icacls.exe C:\\BuildAgent\\* /grant:r Users:(OI)(CI)F +# Grant Permissions for ContainerUser (Default Account), OI - Object Inherit, CI - Container Inherit, F - full control +RUN cmd /c icacls.exe "C:\\BuildAgent\\*" /grant:r 'DefaultAccount:(OI)(CI)F' +RUN cmd /c icacls.exe "C:\\BuildAgent\\*" /grant:r 'Users:(OI)(CI)F' USER ContainerUser diff --git a/configs/windows/MinimalAgent/nanoserver/NanoServer2022.Dockerfile b/configs/windows/MinimalAgent/nanoserver/NanoServer2022.Dockerfile index 9fb53b23..e0d13982 100644 --- a/configs/windows/MinimalAgent/nanoserver/NanoServer2022.Dockerfile +++ b/configs/windows/MinimalAgent/nanoserver/NanoServer2022.Dockerfile @@ -85,7 +85,7 @@ ENV JAVA_HOME="C:\Program Files\Java\OpenJDK" \ COPY --chown=ContainerUser --from=base /BuildAgent /BuildAgent USER ContainerAdministrator -# Grant Permissions for ContainerUser (Default Account), OI - Object Inherit, CI - Contaiber Inherit, F - full control +# Grant Permissions for ContainerUser (Default Account), OI - Object Inherit, CI - Container Inherit, F - full control RUN cmd /c icacls.exe C:\\BuildAgent\\* /grant:r DefaultAccount:(OI)(CI)F RUN cmd /c icacls.exe C:\\BuildAgent\\* /grant:r Users:(OI)(CI)F USER ContainerUser diff --git a/configs/windows/Server/nanoserver/NanoServer2022.Dockerfile b/configs/windows/Server/nanoserver/NanoServer2022.Dockerfile index 73857962..eecc5c7d 100644 --- a/configs/windows/Server/nanoserver/NanoServer2022.Dockerfile +++ b/configs/windows/Server/nanoserver/NanoServer2022.Dockerfile @@ -121,7 +121,7 @@ CMD ["pwsh", "C:/TeamCity/run-server.ps1"] # In order to set system PATH, ContainerAdministrator must be used USER ContainerAdministrator RUN setx /M PATH "%PATH%;%JAVA_HOME%\bin;C:\Program Files\Git\cmd" -# Grant Permissions for ContainerUser (Default Account), OI - Object Inherit, CI - Contaiber Inherit, F - full control +# Grant Permissions for ContainerUser (Default Account), OI - Object Inherit, CI - Container Inherit, F - full control RUN cmd /c icacls.exe C:\\TeamCity\\* /grant:r DefaultAccount:(OI)(CI)F RUN cmd /c icacls.exe C:\\TeamCity\\* /grant:r Users:(OI)(CI)F USER ContainerUser \ No newline at end of file diff --git a/context/generated/windows/Agent/nanoserver/2022/Dockerfile b/context/generated/windows/Agent/nanoserver/2022/Dockerfile index a1e8ee08..4a516192 100644 --- a/context/generated/windows/Agent/nanoserver/2022/Dockerfile +++ b/context/generated/windows/Agent/nanoserver/2022/Dockerfile @@ -85,7 +85,7 @@ ENV CONFIG_FILE="C:\BuildAgent\conf\buildAgent.properties" \ # In order to set system PATH, ContainerAdministrator must be used USER ContainerAdministrator RUN setx /M PATH "%PATH%;%JAVA_HOME%\bin;C:\Program Files\Git\cmd;C:\Program Files\dotnet" -# Grant Permissions for ContainerUser (Default Account), OI - Object Inherit, CI - Contaiber Inherit, F - full control +# Grant Permissions for ContainerUser (Default Account), OI - Object Inherit, CI - Container Inherit, F - full control RUN cmd /c icacls.exe C:\\BuildAgent\\* /grant:r DefaultAccount:(OI)(CI)F RUN cmd /c icacls.exe C:\\BuildAgent\\* /grant:r Users:(OI)(CI)F USER ContainerUser diff --git a/context/generated/windows/Agent/windowsservercore/2022/Dockerfile b/context/generated/windows/Agent/windowsservercore/2022/Dockerfile index a646ed89..ae1aad85 100644 --- a/context/generated/windows/Agent/windowsservercore/2022/Dockerfile +++ b/context/generated/windows/Agent/windowsservercore/2022/Dockerfile @@ -100,7 +100,7 @@ ENV CONFIG_FILE="C:\BuildAgent\conf\buildAgent.properties" \ USER ContainerAdministrator RUN setx /M PATH ('{0};{1}\bin;C:\Program Files\Git\cmd;C:\Program Files\Mercurial' -f $env:PATH, $env:JAVA_HOME) -# Grant Permissions for ContainerUser (Default Account), OI - Object Inherit, CI - Contaiber Inherit, F - full control -RUN cmd /c icacls.exe C:\\BuildAgent\\* /grant:r DefaultAccount:(OI)(CI)F -RUN cmd /c icacls.exe C:\\BuildAgent\\* /grant:r Users:(OI)(CI)F +# Grant Permissions for ContainerUser (Default Account), OI - Object Inherit, CI - Container Inherit, F - full control +RUN cmd /c icacls.exe "C:\\BuildAgent\\*" /grant:r 'DefaultAccount:(OI)(CI)F' +RUN cmd /c icacls.exe "C:\\BuildAgent\\*" /grant:r 'Users:(OI)(CI)F' USER ContainerUser diff --git a/context/generated/windows/MinimalAgent/nanoserver/2022/Dockerfile b/context/generated/windows/MinimalAgent/nanoserver/2022/Dockerfile index f965025f..e77a8ec8 100644 --- a/context/generated/windows/MinimalAgent/nanoserver/2022/Dockerfile +++ b/context/generated/windows/MinimalAgent/nanoserver/2022/Dockerfile @@ -78,7 +78,7 @@ ENV JAVA_HOME="C:\Program Files\Java\OpenJDK" \ COPY --chown=ContainerUser --from=base /BuildAgent /BuildAgent USER ContainerAdministrator -# Grant Permissions for ContainerUser (Default Account), OI - Object Inherit, CI - Contaiber Inherit, F - full control +# Grant Permissions for ContainerUser (Default Account), OI - Object Inherit, CI - Container Inherit, F - full control RUN cmd /c icacls.exe C:\\BuildAgent\\* /grant:r DefaultAccount:(OI)(CI)F RUN cmd /c icacls.exe C:\\BuildAgent\\* /grant:r Users:(OI)(CI)F USER ContainerUser diff --git a/context/generated/windows/Server/nanoserver/2022/Dockerfile b/context/generated/windows/Server/nanoserver/2022/Dockerfile index 05de8f79..8e335bdf 100644 --- a/context/generated/windows/Server/nanoserver/2022/Dockerfile +++ b/context/generated/windows/Server/nanoserver/2022/Dockerfile @@ -117,7 +117,7 @@ CMD ["pwsh", "C:/TeamCity/run-server.ps1"] # In order to set system PATH, ContainerAdministrator must be used USER ContainerAdministrator RUN setx /M PATH "%PATH%;%JAVA_HOME%\bin;C:\Program Files\Git\cmd" -# Grant Permissions for ContainerUser (Default Account), OI - Object Inherit, CI - Contaiber Inherit, F - full control +# Grant Permissions for ContainerUser (Default Account), OI - Object Inherit, CI - Container Inherit, F - full control RUN cmd /c icacls.exe C:\\TeamCity\\* /grant:r DefaultAccount:(OI)(CI)F RUN cmd /c icacls.exe C:\\TeamCity\\* /grant:r Users:(OI)(CI)F USER ContainerUser