diff --git a/configs/windows/MinimalAgent/nanoserver/NanoServer1809.Dockerfile b/configs/windows/MinimalAgent/nanoserver/NanoServer1809.Dockerfile index 2538f64c1..55ff50555 100644 --- a/configs/windows/MinimalAgent/nanoserver/NanoServer1809.Dockerfile +++ b/configs/windows/MinimalAgent/nanoserver/NanoServer1809.Dockerfile @@ -32,10 +32,6 @@ COPY TeamCity/buildAgent C:/BuildAgent COPY scripts/*.cs /scripts/ SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] -# Workaround for TW-87124 - Windows-based plugin directories receive incorrect case, causing their inability ... -# ... to load. The directory will be fetched from the server upon the first update with proper case. -RUN Remove-Item -Recurse -Force C:/BuildAgent/plugins - COPY run-agent.ps1 /BuildAgent/run-agent.ps1 # JDK diff --git a/configs/windows/MinimalAgent/nanoserver/NanoServer2022.Dockerfile b/configs/windows/MinimalAgent/nanoserver/NanoServer2022.Dockerfile index 90b520074..36af28b41 100644 --- a/configs/windows/MinimalAgent/nanoserver/NanoServer2022.Dockerfile +++ b/configs/windows/MinimalAgent/nanoserver/NanoServer2022.Dockerfile @@ -32,10 +32,6 @@ SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference RUN mkdir C:\\BuildAgent COPY TeamCity/buildAgent C:/BuildAgent -# Workaround for TW-87124 - Windows 2022-based plugin directories receive incorrect case, causing their inability ... -# ... to load. The directory will be fetched from the server upon the first update with proper case. -RUN Remove-Item -Recurse -Force C:/BuildAgent/plugins - COPY run-agent.ps1 /BuildAgent/run-agent.ps1 # JDK diff --git a/context/generated/windows/MinimalAgent/nanoserver/1809/Dockerfile b/context/generated/windows/MinimalAgent/nanoserver/1809/Dockerfile index b4a65c35b..761862ea5 100644 --- a/context/generated/windows/MinimalAgent/nanoserver/1809/Dockerfile +++ b/context/generated/windows/MinimalAgent/nanoserver/1809/Dockerfile @@ -26,10 +26,6 @@ COPY TeamCity/buildAgent C:/BuildAgent COPY scripts/*.cs /scripts/ SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] -# Workaround for TW-87124 - Windows-based plugin directories receive incorrect case, causing their inability ... -# ... to load. The directory will be fetched from the server upon the first update with proper case. -RUN Remove-Item -Recurse -Force C:/BuildAgent/plugins - COPY run-agent.ps1 /BuildAgent/run-agent.ps1 # JDK diff --git a/context/generated/windows/MinimalAgent/nanoserver/1903/Dockerfile b/context/generated/windows/MinimalAgent/nanoserver/1903/Dockerfile index 9676c6405..824eced81 100644 --- a/context/generated/windows/MinimalAgent/nanoserver/1903/Dockerfile +++ b/context/generated/windows/MinimalAgent/nanoserver/1903/Dockerfile @@ -26,10 +26,6 @@ COPY TeamCity/buildAgent C:/BuildAgent COPY scripts/*.cs /scripts/ SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] -# Workaround for TW-87124 - Windows-based plugin directories receive incorrect case, causing their inability ... -# ... to load. The directory will be fetched from the server upon the first update with proper case. -RUN Remove-Item -Recurse -Force C:/BuildAgent/plugins - COPY run-agent.ps1 /BuildAgent/run-agent.ps1 # JDK diff --git a/context/generated/windows/MinimalAgent/nanoserver/1909/Dockerfile b/context/generated/windows/MinimalAgent/nanoserver/1909/Dockerfile index 81d4f4b64..bdc0fbca4 100644 --- a/context/generated/windows/MinimalAgent/nanoserver/1909/Dockerfile +++ b/context/generated/windows/MinimalAgent/nanoserver/1909/Dockerfile @@ -26,10 +26,6 @@ COPY TeamCity/buildAgent C:/BuildAgent COPY scripts/*.cs /scripts/ SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] -# Workaround for TW-87124 - Windows-based plugin directories receive incorrect case, causing their inability ... -# ... to load. The directory will be fetched from the server upon the first update with proper case. -RUN Remove-Item -Recurse -Force C:/BuildAgent/plugins - COPY run-agent.ps1 /BuildAgent/run-agent.ps1 # JDK diff --git a/context/generated/windows/MinimalAgent/nanoserver/2022/Dockerfile b/context/generated/windows/MinimalAgent/nanoserver/2022/Dockerfile index 4dab7a497..76d290a3e 100644 --- a/context/generated/windows/MinimalAgent/nanoserver/2022/Dockerfile +++ b/context/generated/windows/MinimalAgent/nanoserver/2022/Dockerfile @@ -26,10 +26,6 @@ SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference RUN mkdir C:\\BuildAgent COPY TeamCity/buildAgent C:/BuildAgent -# Workaround for TW-87124 - Windows 2022-based plugin directories receive incorrect case, causing their inability ... -# ... to load. The directory will be fetched from the server upon the first update with proper case. -RUN Remove-Item -Recurse -Force C:/BuildAgent/plugins - COPY run-agent.ps1 /BuildAgent/run-agent.ps1 # JDK diff --git a/tool/agent-upgrade-dist/src/main/kotlin/Files.kt b/tool/agent-upgrade-dist/src/main/kotlin/Files.kt index a3f693dc6..db76bee95 100644 --- a/tool/agent-upgrade-dist/src/main/kotlin/Files.kt +++ b/tool/agent-upgrade-dist/src/main/kotlin/Files.kt @@ -2,30 +2,27 @@ import java.io.ByteArrayInputStream import java.io.ByteArrayOutputStream import java.io.File import java.io.InputStream +import java.nio.file.Paths fun File.dir(): Sequence = this.listFiles()?.asSequence() ?: emptySequence() fun File.ensureDirExists(description: String = "", createIfNotExists: Boolean = false): File { - if (this.isDirectory()) { - if (description.isNotBlank()) { - println("$description directory: ${this.canonicalFile}") + if (this.exists()) { + if (this.isDirectory) { + throw Exception("\"$this\" - is not a directory."); } - return this.canonicalFile + return Paths.get(path).toRealPath().toFile() } - if (!this.exists()) { - if (createIfNotExists) { - this.mkdirs(); - if (description.isNotBlank()) { - println("$description directory: ${this.canonicalFile}") - } - return this.canonicalFile + if (createIfNotExists) { + this.mkdirs() + if (description.isNotBlank()) { + println("$description directory: ${this.canonicalFile}") } - - throw Exception("Cannot find directory \"$this\"."); + return Paths.get(path).toRealPath().toFile() } - throw Exception("\"$this\" - is not a directory."); + throw Exception("\"$this\" does not exist") } fun InputStream.buffered(bufferSize: Long): InputStream {