azure webapp deployment from local git fails but returns exit code 0 - deployment

I use bitbucket pipelines to push code to an azure webapp (the webapp has "local git" setup as the deployment source).
I sometimes have the case that the bitbucket pipeline shows success even though the azure deployment failed. This seems to happen because the azure deployment returns exit code 0 even though it encountered an exception. Is there some config that allows to forward the actual exit code?
This is an example of the azure deployment log:
remote:
remote: SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP 'reports
remote: _user_id_foreign'; check that column/key exists
remote:
remote:
remote: Script #php artisan migrate handling the post-autoload-dump event returned with error code 1
remote: An error has occurred during web site deployment.
remote:
remote: Deployment Failed.
remote: Error - Changes committed to remote repository but deployment to website failed.

I think your deployment issue is tied to your SQL error you're getting. It appears that you're doing a database migration during deployment against existing data. I would suggest doing database migrations as a separate pipeline so you can have more granular control.
Also, you mentioned
the webapp has "local git" setup as the deployment source
Is there any reason why you didn't configure the deployment source as your BitBucket repo?

Related

Azure Pipeline Deployment Fails - Error in changing file permissions

I'm using an Azure Pipeline to deploy to an App Service. I make it through the built stage, but am getting errors when deploying.
The deployment logs say "An unknown error has occurred. Check the diagnostic log for details."
Below are the errors in diagnostic log with system diagnostics turned on:
Error in changing file permissions : 124
##[error]Failed to deploy web package to App Service.
##[debug]Processed: ##vso[task.issue type=error;]Failed to deploy web package to App Service.
##[error]To debug further please check Kudu stack trace URL : https://$app-dev:***#app-dev-django.scm.azurewebsites.net/api/vfs/LogFiles/kudu/trace
##[debug]Processed: ##vso[task.issue type=error;]To debug further please check Kudu stack trace URL : https://$app-dev:***#app-dev.scm.azurewebsites.net/api/vfs/LogFiles/kudu/trace
##[debug]Deployment Failed with Error: Error: Package deployment using ZIP Deploy failed. Refer logs for more details.
##[debug]task result: Failed
##[error]Error: Package deployment using ZIP Deploy failed. Refer logs for more details.
I've tried restarting both the deploy VM and the app service. I've also tried disconnecting the in the App Service Deployment Center before running the pipeline.
text: No space left on device, stackTrace: at System.IO.FileStream.WriteNative(ReadOnlySpan1 source)
The cause of the issue could be that storage space of the App Service plan has reached the upper limit. It can be that the temp space in App service takes up too much space.
You can restart all the App Services present in that App Service Plan to clear out the temp space.
Or you can upgrade your APP Service Plan to get more space.

Github pages fails to deploy

This error is popping-up intermittently while trying to deploy my github webpages. I have no clue what to do, I already deleted and recreated the repository but the error persists. I have the same problem for all my github pages repositories.
Here is one repository example: https://github.com/cnftstats/borgs
Run actions/deploy-pages#v1
Actor: github-pages[bot]
Action ID: 1998855719
Artifact URL: https://pipelines.actions.githubusercontent.com/odmqpuZ7yGar25NNWIM53v9pBjO9vEwDjecGIYtf9ECZfcxi8V/_apis/pipelines/workflows/1998855719/artifacts?api-version=6.0-preview
{"count":1,"value":[{"containerId":359584,"size":14684160,"signedContent":null,"fileContainerResourceUrl":"https://pipelines.actions.githubusercontent.com/odmqpuZ7yGar25NNWIM53v9pBjO9vEwDjecGIYtf9ECZfcxi8V/_apis/resources/Containers/359584","type":"actions_storage","name":"github-pages","url":"https://pipelines.actions.githubusercontent.com/odmqpuZ7yGar25NNWIM53v9pBjO9vEwDjecGIYtf9ECZfcxi8V/_apis/pipelines/1/runs/21/artifacts?artifactName=github-pages","expiresOn":"2022-06-15T13:26:01.9505756Z","items":null}]}
Creating deployment with payload:
{
"artifact_url": "https://pipelines.actions.githubusercontent.com/odmqpuZ7yGar25NNWIM53v9pBjO9vEwDjecGIYtf9ECZfcxi8V/_apis/pipelines/1/runs/21/artifacts?artifactName=github-pages&%24expand=SignedContent",
"pages_build_version": "bf8f96d22c5dd116a5d94ee24cd398bdda60035f",
"oidc_token": "***"
}
Failed to create deployment for bf8f96d22c5dd116a5d94ee24cd398bdda60035f.
{"message":"Deployment request failed for bf8f96d22c5dd116a5d94ee24cd398bdda60035f due to in progress deployment. Please cancel e92de3f483b775a12d4f784d7cc661ff2847fa62 first or wait for it to complete.","documentation_url":"https://docs.github.com/rest/reference/repos#create-a-github-pages-deployment"}
Error: Error: Request failed with status code 400
Error: Error: Request failed with status code 400
Sending telemetry for run id 1998855719
GitHub Actions is currently experiencing degraded performance and published this on their status page. Therefore, you are most likely experiencing a side effect of the current problems. Other users are reporting the same issue as well. Try again later when the issue has been resolved by GitHub.
Update: More products are now affected and experience degraded performance. Check their status page for more details: https://www.githubstatus.com
[It was a bug of GitHub, happens to all its users---date: 18/03/2022]
It happens to me today too.. :(
Maybe is a bug of GitHub pages: https://github.com/actions/deploy-pages/issues/22
https://github.community/t/pages-deploy-wedged-incorrect-request-failed-due-to-in-progress-deployment/234793/4
If someone has an error 500 make sure you enabled the Build and deployment Source from "GitHub Actions".
Settings -> Pages section -> Build and deployment -> Source: GitHub Actions

NuGet Package Artifact not downloading in Azure Release Pipeline

I'm currently trying to setup a release pipeline in Azure DevOps server, with multiple Artifacts. The first Artifact is published from a build pipeline and the other artifact is a NuGet Package hosted in an Azure Artifacts feed.
When I create and deploy the release, it successfully downloads the first Artifact without issue, when it moves on to download the NuGet Package, the task is labelled a success, however it fails to download the NuGet package with the below in the logs.
2022-02-23T09:53:38.0879772Z ##[debug]SYSTEMVSSCONNECTION exists true
2022-02-23T09:53:38.0880158Z ##[debug]Got auth token
2022-02-23T09:53:38.0881320Z ##[debug]System.ServerType=OnPremises
2022-02-23T09:53:38.0882074Z ##[debug]Agent.ProxyUrl=undefined
2022-02-23T09:53:38.1247667Z ##[debug]Operation failed, waiting 100ms before retrying, retries remaining: 4
2022-02-23T09:53:42.2527259Z ##[debug]Operation failed, waiting 200ms before retrying, retries remaining: 3
2022-02-23T09:53:46.4835921Z ##[debug]Operation failed, waiting 400ms before retrying, retries remaining: 2
2022-02-23T09:53:50.9173777Z ##[debug]Operation failed, waiting 800ms before retrying, retries remaining: 1
2022-02-23T09:53:55.7558510Z ##[debug]Getting URL from versioning data failed with error: Error: unable to get local issuer certificate
2022-02-23T09:53:55.7560354Z ##[debug]Getting download url for this package failed with error: Error: unable to get local issuer certificate
Any ideas what could be going on?
First link from Jukkak in the comments was the answer. Had to export the cert as a .pem file and set an environment variable pointing to it on the agent machine. I tried with the .cer file but that didn't work.

How can we implement CI/CD on Azure VMSS created using custom image

I have created VMSS using custom image. I have hosted web application build in .Net MVC on VMSS. I have configured CI/CD from Azure DevOps by referring following https://learn.microsoft.com/en-us/azure/devops/pipelines/apps/cd/azure/deploy-azure-scaleset?view=azure-devops .
It is showing error D:\a\_temp\1575277721063\packer\packer.exe failed with return code: 1 . Any suggestion/recommendation is appreciated.
Below is some failed commands in Log:
1. azure-arm: resources.DeploymentsClient#CreateOrUpdate: Failure sending request: StatusCode=200 -- Original Error: Long running operation terminated with status 'Failed': Code="DeploymentFailed" Message="At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details."
2. Some builds didn't complete successfully and had errors:
2019-12-02T09:57:31.5222618Z --> azure-arm: resources.DeploymentsClient#CreateOrUpdate: Failure sending request: StatusCode=200 -- Original Error: Long running operation terminated with status 'Failed': Code="DeploymentFailed" Message="At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details."
3. 2019-12-02T09:57:31.5222868Z ==> Builds finished but no artifacts were created.
Since the error message (DeploymentFailed) from the pipeline is a generic one, it would be tough to investigate the issue without looking at the underlying logs or your pipeline details.
For troubleshooting it further, please try the following:
View deployment history with Azure Resource Manager as mentioned in the error message itself.
Gather logs to diagnose problems, such as debug/verbose pipeline logs, worker/agent diagnostics logs etc..
Look at some common issues and resolutions if it helps.
Send feedback and report problems through the Developer Community for Azure DevOps.

Get Error while cloning for BitBucket repeatedly

For SourceTree or Eclipse, I was unable to clone the repositories. Every time I try to clone that, I get the message:
fatal: The remote end hung up unexpectedly
error: RPC failed; result=22, HTTP code = 504
Any clue what is causing this? THANKS
You can find a similar issue in this thread:
The HTTP error 504 is related to a Gateway Timeout, what means your request couldn’t be completed.
When attempting to clone your Git repository over HTTP, it probably means that there's a size issue. Git is not designed to perform well over HTTP with repositories larger than about 1 GB.
Over HTTP, Git has to be served using FastCGI and so the FastCGI process can sometimes time out before the command can return results
You have some workaround (for push in Stash, but applicable to git clone in general) in "error: RPC failed result=22 - Push to Stash fails"
You can diagnose the root cause with more information displayed when you set:
export GIT_TRACE_PACKET=1
export GIT_TRACE=1
export GIT_CURL_VERBOSE=1
http.postBuffer might be an issue, as in "Git fetch github: Index-pack failed".