Skip to content

Commit

Permalink
Cherry-pick [TCQA] Handle escaping based on PowerShell Module Cache I…
Browse files Browse the repository at this point in the history
…nitialization @ Windows 2022
  • Loading branch information
AndreyKoltsov1997 committed Nov 27, 2023
1 parent 1e13eea commit fa3b0a7
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion configs/windows/Agent/nanoserver/NanoServer2022.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion context/generated/windows/Agent/nanoserver/2022/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit fa3b0a7

Please sign in to comment.