0

I was following this article from Microsoft to use Azure pipeline for build and release. Reached upto this section and confused about the following code:

az batch application package create --application-id $(batchApplicationId) 

--name $(batchAccountName) 

--resource-group $(resourceGroupName) 

--version $(batchApplicationVersion) 

--package-file=$(System.DefaultWorkingDirectory)/$(Release.Artifacts.{YourBuildArtifactSourceAlias}.BuildId).zip

I have configured the following in pipeline variables:

  • batchApplicationId
  • batchAccountName
  • resourceGroupName
  • batchApplicationVersion

The only thing remaning is configuring the package-file

As far as I understand, I just have to replace YourBuildArtifactSourceAlias with my artifact source alias, and I have done that. But when deploying the release pipeline, I get the following error:

.zip was unexpected at this time. 
##[error]Script failed with exit code: 255

As we can see in this screenshot, the only failing part of this whole process is when uploading the package to the application created, which is the final step.

Can someone help me with this?

  • Have you tried replacing the = between --package-file and the path with a space? Might be that the article has a typo? `--package-file $(System.DefaultWorkingDirectory)/$(Release.Artifacts.{YourBuildArtifactSourceAlias}.BuildId).zip` – j-petty Jun 15 '21 at 23:07
  • @j-petty Hi, I just tried what you suggested but still getting the same error :( – Emmanuel Mathew Jun 15 '21 at 23:49
  • add a simple "commandline" task and do `echo $(System.DefaultWorkingDirectory)/$(Release.Artifacts.{YourBuildArtifactSourceAlias}.BuildId).zip` inside. I suspect there's something wrong with the path - maybe some variable isn't expanded, or there's space somewhere. You can also try using `$(Build.BuildId)` instead of `$(Release.Artifacts.xxx)`, that should be the [same thing for the primary artifact](https://learn.microsoft.com/en-us/azure/devops/pipelines/release/variables?view=azure-devops&tabs=batch#default-variables---primary-artifact) – qbik Jun 16 '21 at 04:11
  • Please list all files in that folder `ls $(System.DefaultWorkingDirectory)`. It should help you figure out. – Krzysztof Madej Jun 16 '21 at 07:41
  • Hi guys, I tried configuring by following the methods you both advised and was able to get it running. Like qbik mentioned, instead of $(Release.Artifacts.xxx), I put $(Build.BuildId), and like Krzysztof Madej mentioned, I listed all the folders and subfolders and configured the path that way. Thanks so much! – Emmanuel Mathew Jun 16 '21 at 12:21

0 Answers0