Epinova / epinova-dxp-deployment

DXP deployment with Azure DevOps release tasks
MIT License
14 stars 10 forks source link

Handle zip file #250

Closed ovelartelius closed 1 year ago

ovelartelius commented 1 year ago

If you send in a zip file instead of nupkg file you will get error.

2022-11-15T13:43:44.4071794Z 2022-11-15T13:43:44.4072147Z 2022-11-15T13:43:44.4111598Z Loaded cms package:
2022-11-15T13:43:44.4112132Z 2022-11-15T13:43:44.4112363Z 2022-11-15T13:43:44.7136163Z ##[error]Publish-Package : Cannot bind argument to parameter 'PackageFile' because it is null.

In EpinovaDxpDeploymentUtil.ps1 function Publish-Package it is only looking for nupkg files. It would be nice to also check for zip files and handle that. Rename or something simular...

tomludd commented 1 year ago

@ovelartelius any updates on this? :)

Here is some powershell that could work.

Get-ChildItem . -Recurse | Where {$_.Name -Match '.*\.cms\.app\..*.zip'} | Rename-Item -NewName {$_.name -replace '.zip','.nupkg' }
ovelartelius commented 1 year ago

Get-Item [filepath] | Rename-Item -newname { [io.path]::ChangeExtension($_.name, "nupkg") }

ovelartelius commented 1 year ago

The error when try to upload zip with old task:

[error]Exception: API call failed! The error was: Response status code does not indicate success:

400 (Bad Request). StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers: { Date: Mon, 11 Sep 2023 11:50:28 GMT Connection: keep-alive Cache-Control: no-cache
Pragma: no-cache Set-Cookie: ARRAffinity=34dc192faaa9d0b965caeb984296252404f91dd2795ce26d868945f67daac397;Pat h=/;HttpOnly;Secure;Domain=paasportal.episerver.net Set-Cookie: ARRAffinitySameSite=34dc192faaa9d0b965caeb984296252404f91dd2795ce26d868945f67daa c397;Path=/;HttpOnly;SameSite=None;Secure;Domain=paasportal.episerver.net
Strict-Transport-Security: max-age=31536000; includeSubDomains;
X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET X-XSS-Protection: 1
X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN
Referrer-Policy: no-referrer X-Permitted-Cross-Domain-Policies: none
CF-Cache-Status: DYNAMIC Server: cloudflare CF-RAY: 804fb17b1a16d512-CDG
Content-Type: application/json; charset=utf-8 Content-Length: 123 Expires: -1 }

ovelartelius commented 1 year ago

Will now find .zip file and rename it to .nupkg.

No *.cms.*.nupkg found. Will try to find *.cms.*.zip
Found /home/vsts/work/r1/a/_Build/DeployableArtifacts/Site.cms.app.2023.0911.2-develop.zip . Will rename to *.nuget. EPICloud does not support zip.
Renamed to *.nuget.
Loaded cms package:    /home/vsts/work/r1/a/_Build/DeployableArtifacts/Site.cms.app.2023.0911.2-develop.nupkg
cms package 'Site.cms.app.2023.0911.2-develop.nupkg' start upload...
cms package 'Site.cms.app.2023.0911.2-develop.nupkg' is uploaded.
Package 'Site.cms.app.2023.0911.2-develop.nupkg' file size => 146889794.
ovelartelius commented 1 year ago

Tested both with zip and nupkg. Works as expected. Close task.