Here is the complete pipeline that should publish the .net package as zip and store as an artifact. Next step should use that artifact to deploy on azure. Tab artifact is always empty. Is there anything I made wrong or it can be related to the bitbucket server?
image: mcr.microsoft.com/dotnet/sdk:6.0
pipelines:
branches:
master:
- step:
name: Build and publish .NET app
caches:
- dotnetcore
script:
- curl -sL https://deb.nodesource.com/setup_14.x | bash -
- apt-get install -y nodejs
- cd DutchKnittingCompany
- dotnet publish -o publish -c Release
- cd publish
- apt-get -y install zip
- zip -r api-$BITBUCKET_BUILD_NUMBER.zip .
artifacts:
- "*.zip"
- step:
name: Deploy .NET to Azure AppService
deployment: Azure
script:
- pipe: atlassian/azure-web-apps-deploy:1.0.1
variables:
AZURE_APP_ID: $AZURE_APP_ID
AZURE_PASSWORD: $AZURE_PASSWORD
AZURE_TENANT_ID: $AZURE_TENANT_ID
AZURE_RESOURCE_GROUP: $RESOURCE_GROUP
AZURE_APP_NAME: $APP_NAME
ZIP_FILE: 'api-$BITBUCKET_BUILD_NUMBER.zip'
Error I'm getting:
INFO: Starting deployment to Azure app service...az webapp deployment source config-zip --resource-group DKCResGroup --name dkcapi --src api-40.zipERROR: [Errno 2] No such file or directory: '/opt/atlassian/pipelines/agent/build/api-40.zip'Traceback (most recent call last):File "/usr/local/lib/python3.6/site-packages/knack/cli.py", line 206, in invokecmd_result = self.invocation.execute(args)File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 328, in executeraise exFile "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 386, in _run_jobs_seriallyresults.append(self._run_job(expanded_arg, cmd_copy))File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 379, in _run_jobsix.reraise(*sys.exc_info())File "/usr/local/lib/python3.6/site-packages/six.py", line 693, in reraiseraise valueFile "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 356, in _run_jobresult = cmd_copy(params)File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 171, in __call__return self.handler(*args, **kwargs)File "/usr/local/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 441, in default_command_handlerreturn op(**command_args)File "/usr/local/lib/python3.6/site-packages/azure/cli/command_modules/appservice/custom.py", line 267, in enable_zip_deploywith open(os.path.realpath(os.path.expanduser(src)), 'rb') as fs:FileNotFoundError: [Errno 2] No such file or directory: '/opt/atlassian/pipelines/agent/build/api-40.zip'✖ Deployment failed.Hello @nuclearforce ,
Welcome to Atlassian Community!
Just sharing a bit of context, at the end of the build bitbucket will look for artifacts that are within BITBUCKET_CLONE_DIR. The BITBUCKET_CLONE_DIR is the directory in which the repository was initially cloned. More on that in Use artifacts in steps.
Looking at your YML file, it seems like you are generating the artifact inside a folder called DutchKnittingCompany/publish, while your current YML configuration is looking for *.zip files only in the root folder (BITBUCKET_CLONE_DIR).
To generate an artifact for every .zip file inside a folder called DutchKnittingCompany/publish, you should configure the artifact section of your step as the following example :
script:
- curl -sL https://deb.nodesource.com/setup_14.x | bash -
- apt-get install -y nodejs
- cd DutchKnittingCompany
- dotnet publish -o publish -c Release
- cd publish
- apt-get -y install zip
- zip -r api-$BITBUCKET_BUILD_NUMBER.zip .
artifacts:
- DutchKnittingCompany/publish/*.zip
Could you try using the suggestion above and let us know how it goes?
Thank you, @nuclearforce .
Patrik S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.