CircleCI builds are always retried - amazon-web-services

I'm using CircleCI with AWS CodeDeploy to automate the deployment of my app on EC2 from a Github repository.. The problem is that the build is always getting retried with this message given:
"Looks like we had a bug in our infrastructure, or that of our providers (generally GitHub or AWS). We should have automatically retried this build. We've been alerted of the issue and are almost certainly looking into it, please contact us if you're interested in the cause or if the problem persists."
The last step the build stops after is called: "Bootstrap AWS CodeDeploy"
I don't know whether the problem is from the circle.yml file or the appspec.yml file!
Any Help??

Are you able to see a deployment created on your AWS CodeDeploy console? If a deployment is created, then it means the build process succeeded, but the deployment failed. If deployment is failed, you can try to see the root cause for further investigation. Otherwise the failure should be something related to CircleCI.
Thanks,
Binbin

Related

Codedeploy rollback not picking the previous successful build version

For some reason AWS Codedeploy rollback seems to always pick up the latest version and fails
Deployment 1 is success and a revision is created in S3 bucket.
Deployment 2 is failure and Codedeploy rollback kicks in which is Automatic
Deployment 3 also fails for the same reason as Deployment 2
Expected Codedeploy behaviour is for Deployment 3 it should pick up the Deployment 1 S3 build version.
I am not sure if there are any missing links in S3 bucket with Codedeploy. Any thoughts much appreciated.
Thank you
Not sure if this applies to your situation specifically, but "strange" rollback behavior of CodeDeploy is documented:
However, if the deployment that failed was configured to overwrite, instead of retain files, an unexpected result can occur during the rollback.
Thus it is possible that you are observing these "unexpected results" that can occur when you deploy and fail with an existing content.
You can read up more on that in:
Rollback behavior with existing content
After a bit of investigation with AWS CLI, I can see the the version being re written. Things are more clear when using the AWS CLI than what is shown in the console.
Thank you for taking the time to post back with a possible answer

AWS CodeDeploy hangs before ApplicationStop on a Windows Server 2016

I have gotten a little bit stuck with this one. I am trying to use Code Deploy on a Windows Server EC2 instance with no luck, it keeps getting stuck before Application Stop and all phases are Pending until it fails then they are all Skipped.
What I've checked so far:
I have installed the Code-Deploy Agent on the server and made sure it was running
I have checked and double checked the in-bound and out-bound permissions on the EC2 instance (allowed all HTTP/HTTPS requests)
I have checked the IAM role on the Code Deploy application itself (I have given all the permissions i can think of)
I checked the appspec.yml (it only needs to transfer build files from the build phase to a folder on the EC2 itself
version: 0.0
os: windows
files:
- source: \path
destination: \path
hooks:
BeforeInstall:
AfterInstall:
ApplicationStart:
I have no idea why this would happen (I've deployed on Linux instances without this problem - the agent always started reading the appspec.yml)
Any help would be appreciated. Thanks!
By design, ApplicationStop is always executed from your last successful deployment's archive since that's when you started your application. This way CodeDeploy makes sure the scripts used for starting and stopping an application belong to the same revision [1]. We don't have complete data, but it could be that the ApplicationStop script from last deployment is causing the issue.
As per [1]:
If the cause of the failure is a script from the last successful
deployment that never runs successfully, create a deployment and
specify that the ApplicationStop, BeforeBlockTraffic, and
AfterBlockTraffic failures should be ignored. There are two ways to do
this:
Use the CodeDeploy console to create a deployment. On the Create
deployment page, under ApplicationStop lifecycle event failure, choose
Don't fail the deployment to an instance if this lifecycle event on
the instance fails.
Use the AWS CLI to call the create-deployment command and include the
--ignore-application-stop-failures option.
[1] https://docs.aws.amazon.com/codedeploy/latest/userguide/troubleshooting-deployments.html#troubleshooting-deployments-lifecycle-event-failures
If any future readers com across this thread then may I refer them to the following article which helped me with a "Net::OpenTimeout" error in CodeDeploy that manifested itself in a similar way.
https://aws.amazon.com/premiumsupport/knowledge-center/codedeploy-net-opentimeout-errors/

How to debug failed NetCore AWS Elastic Beanstalk deployment?

I have an DotNet Core AWS Elastic Beanstalk environment which has started failing to deploy. The environment waits up to 10 minutes for the healthcheck to pass, but consistent gets "403 - Forbidden: Access is denied.".
I've RDP'd to the environment and the folder C:\inetpub\AspNetCoreWebApps is empty. In working environments, this contains the code.
I've tried redeploying the entire environment and deploying a package from a week ago which was previously fine. Additionally, I've tried deploying using the AWS Toolkit for Visual Studio and by uploading a package rather than using CodePipeline. All of these actions result in the same behaviour.
I'm struggling to find any logs which indicate why the code isn't being deployed to the environment. Requesting the last 100 lines doesn't contain anything useful and I can't find any deployment logs on the filesystem. In the pulled logs there is no AWS.DeploymentCommands log file.
The environment is configured to deploy as rolling with batch +1. As such, it is a new EC2 which is being written to.
What is the next step in debugging the cause of the failure?
I was able to diagnose the problem - a public file referenced in the ebextension folder had been deleted. The log file I was looking for was in C:\cfn\log\cfn-init.txt.

Code Deploy fails without any error message

so I have been trying to setup code deploy for my application, but it keeps on failing. Initially, I didn't have an appspec.yml file in repository, so I got the error message that the appspec.yml file doesn't exist.
I have now included an appspec.yml file, but it still doesn't work and it doesn't give any error message. There are no events mentioned, like it used to before adding the appspec file.
I have less than a beginner's knowledge when it comes to creating a appspec.yml file, but I took hint from a youtube tutorial, and here is the file.
version: 0.0
os: linux
files:
- source: /
destination: /var/www/cms
If it helps, the ec2 instance is running an ubuntu server, /var/www/cms is that directory out of which the nginx is supposed to serve files.
The most likely problem you're facing is that the agent either isn't installed or the instance doesn't have sufficient permissions. When there are no events started on the instance for the deployment, it means that CodeDeploy couldn't talk to the host for some reasons.
Here's the steps I would take:
Confirm that you installed the CodeDeploy agent
Confirm that you've created the IAM service role
Confirm that you have the IAM Instance Profile and that it's associated with the instance
Check that you can reach the CodeDeploy commands endpoint in your region from the box. i.e. ping codedeploy.us-east-1.amazonaws.com Otherwise, your networking setup might be too restrictive.
Look at the logs on the host to see what's going on
I faced at sometime this thing and it was due to the following:
If we initially created and turned on the ec2 instance without setting the IAM service role, and after that we added the service role, it will not take effect until we restart the instance.
I had attached IAM role to EC2 instance but I did not restart my systemd service. And that was the cause of failure.
Also, without rebooting instance, you can just restart systemd service of codedeploy-agent.
In case it helps, I had the same problem and the reason was that codedeploy agent was not installed in the ec2 instance.
After installing it, everything worked like a charm.

Github to Aws code deploy

Can anybody please guide me how to easily deploy code from github to aws using aws cpde deploy ? I gave tried my best to deploy my code and it is not working as it gives error every time it launch deploy revision.
You mentioned deployment is failing. So I'm assuming github automatically kicking off the deployment part is working. Now for the deployment failure, do you see the instance being deployed marked failed? Can you also look into the instance and see if the codedeploy agent is running fine and paste the log here if possible?
-Surya