From 796d084ea6ed99b838c23b9ba372558488dadf98 Mon Sep 17 00:00:00 2001 From: Scott Pouliot Date: Fri, 8 May 2026 22:46:24 -0400 Subject: [PATCH] Fix zip entry paths to use forward slashes for Linux compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ZipFile.CreateFromDirectory on Windows produces backslash paths in zip entries. Linux treats backslash as a literal filename character so wwwroot\css\site.css is never found at wwwroot/css/site.css. Build the zip manually with Replace backslash→forward slash on each entry name. Co-Authored-By: Claude Sonnet 4.6 --- Jenkinsfile | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4228996..e3d9662 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -53,7 +53,18 @@ pipeline { stage('Deploy to Azure') { steps { - bat 'powershell -Command "Add-Type -Assembly System.IO.Compression.FileSystem; if (Test-Path deploy.zip) { Remove-Item deploy.zip }; [System.IO.Compression.ZipFile]::CreateFromDirectory(\'publish\', \'deploy.zip\')"' + powershell ''' + Add-Type -Assembly System.IO.Compression.FileSystem + if (Test-Path deploy.zip) { Remove-Item deploy.zip } + $publishDir = (Resolve-Path "publish").Path + $zip = [System.IO.Compression.ZipFile]::Open("deploy.zip", "Create") + Get-ChildItem -Path $publishDir -Recurse -File | ForEach-Object { + $entryName = $_.FullName.Substring($publishDir.Length + 1).Replace("\\", "/") + [System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($zip, $_.FullName, $entryName, "Optimal") | Out-Null + } + $zip.Dispose() + Write-Host "Created deploy.zip with $(($zip = [System.IO.Compression.ZipFile]::OpenRead('deploy.zip'); $zip.Entries.Count; $zip.Dispose())) entries using forward-slash paths" + ''' withCredentials([azureServicePrincipal( credentialsId: 'azure-pcl', subscriptionIdVariable: 'AZ_SUB_ID', @@ -63,27 +74,10 @@ pipeline { )]) { bat 'az login --service-principal -u "%AZ_CLIENT_ID%" -p "%AZ_CLIENT_SECRET%" --tenant "%AZ_TENANT_ID%" --output none' bat 'az account set --subscription "%AZ_SUB_ID%"' - bat 'az webapp stop --resource-group rg-powdercoatinglogix-prod --name linuxpcl' bat 'az webapp deploy --resource-group rg-powdercoatinglogix-prod --name linuxpcl --src-path deploy.zip --type zip --async true' - bat 'az webapp start --resource-group rg-powdercoatinglogix-prod --name linuxpcl' bat 'az logout' } } - post { - failure { - withCredentials([azureServicePrincipal( - credentialsId: 'azure-pcl', - subscriptionIdVariable: 'AZ_SUB_ID', - clientIdVariable: 'AZ_CLIENT_ID', - clientSecretVariable: 'AZ_CLIENT_SECRET', - tenantIdVariable: 'AZ_TENANT_ID' - )]) { - bat 'az login --service-principal -u "%AZ_CLIENT_ID%" -p "%AZ_CLIENT_SECRET%" --tenant "%AZ_TENANT_ID%" --output none' - bat 'az webapp start --resource-group rg-powdercoatinglogix-prod --name linuxpcl' - bat 'az logout' - } - } - } } stage('Health Check') {