I created an AWS CodePipeline pipeline to pull from Github, build with Jenkins, and deploy to an ElasticBeanstalk project. I can deploy the war to beanStack directly and validate.
When i try to do the same from CodePipeLine i see the below error in AWS CodePipeline Polling Log of Jenkins -
ERROR: Failed to record SCM polling for hudson.model.FreeStyleProject#ae44565e6[AppPortal]
com.amazonaws.services.codepipeline.model.ActionTypeNotFoundException: ActionType (Category: 'Build', Owner: 'Custom', Provider: 'MPiplelineProvider', Version: '1') is not available (Service: AWSCodePipeline; Status Code: 400; Error Code: ActionTypeNotFoundException; Request ID: e35456561d-999f-56e7-3rgf-75985675533b3)
at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:1401)
at com.amazonaws.http.AmazonHttpClient.executeOneRequest(AmazonHttpClient.java:945)
at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:723)
at com.amazonaws.http.AmazonHttpClient.doExecute(AmazonHttpClient.java:475)
at com.amazonaws.http.AmazonHttpClient.executeWithTimer(AmazonHttpClient.java:437)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:386)
at com.amazonaws.services.codepipeline.AWSCodePipelineClient.doInvoke(AWSCodePipelineClient.java:2078)
I have set the SCM poll to * * * * * for testing purpose.
Post-build Actions - AWS CodePipeline publisher - Location - target/AppPortal
I installed only AWS Codepipeline pulgin in jenkins.
Can you let me know what I'm missing.
Thanks
Did you register the Jenkins custom action type in CodePipeline, in the same region you're polling?
Check your Jenkins job configuration for:
AWS Region
Category
Provider
Version
From your error message:
ActionType (Category: 'Build', Owner: 'Custom', Provider: 'MPiplelineProvider', Version: '1')
Then use the AWS CLI to list your custom action types, in that region, and make sure the Category, Provider, and Version match:
aws codepipeline list-action-types --action-owner-filter Custom --region us-west-2
If you created the Jenkins action type through the AWS Console, it should have these values:
ActionType (Category: 'Build', Owner: 'Custom', Provider: 'Jenkins', Version: '1')
If that's the case, updating your Jenkins job Provider from MPiplelineProvider to Jenkins should fix your problem.
In our scenario:
Trigger: moving the Jenkins master (ec2) behind a Load Balancer.
Symptom: we started getting the same error (as above) after updating all security group setting so that load balancer does not get in the way.
Resolution:
On the Jenkins (ec2) box, we deleted the "project" and re-creating it with the exact same setting (including name) as before. This allowed Jenkins to reconnect with Code Pipeline and job started working again.
Here is the codepipeline stage action settings:
{
"inputArtifacts": [],
"name": "foobar-test",
"region": "us-west-2",
"actionTypeId": {
"category": "Test",
"owner": "Custom",
"version": "1",
"provider": "foobar-provider"
},
"outputArtifacts": [],
"configuration": {
"ProjectName": "foobar-api-qa-aws_trigger"
},
"runOrder": 1
Related
I have followed the simplest route to create a basic AWS lambda function on my PC - but when I try to deploy it it fails with an obscure message.
Error: Failed to create changeset for the stack: sam-app, An error occurred (InternalFailure) when calling the CreateChangeSet operation (reached max retries: 4): Unknown
I believe I have provided all the required permissions :
AmazonS3FullAccess
AWSCodeDeployFullAccess
AWSLambdaRole
AWSCloudFormationFullAccess
AWSLambda_FullAccess
and additionally :
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"iam:DetachRolePolicy",
"iam:ListAttachedRolePolicies",
"iam:CreateRole"
],
"Resource": "*"
}
]
}
My terminal session commands & responses are :
c:\My Projects\Nuzum-AWS\sam-app>sam deploy --guided --template-file .aws-sam\build\template.yaml
Configuring SAM deploy
Looking for config file [samconfig.toml] : Not found
Setting default arguments for 'sam deploy'
=========================================
Stack Name [sam-app]:
AWS Region [eu-west-1]:
#Shows you resources changes to be deployed and require a 'Y' to initiate deploy
Confirm changes before deploy [y/N]:
#SAM needs permission to be able to create roles to connect to the resources in your template
Allow SAM CLI IAM role creation [Y/n]:
#Preserves the state of previously provisioned resources when an operation fails
Disable rollback [y/N]:
HelloWorldFunction may not have authorization defined, Is this okay? [y/N]: y
Save arguments to configuration file [Y/n]:
SAM configuration file [samconfig.toml]:
SAM configuration environment [default]:
Looking for resources needed for deployment:
Managed S3 bucket: aws-sam-cli-managed-default-samclisourcebucket-dee0ker00dts
A different default S3 bucket can be set in samconfig.toml
Saved arguments to config file
Running 'sam deploy' for future deployments will use the parameters saved above.
The above parameters can be changed by modifying samconfig.toml
Learn more about samconfig.toml syntax at
https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-config.html
Uploading to sam-app/7b33e513850748d9482c8e504aacefb2 533 / 533 (100.00%)
Deploying with following values
===============================
Stack name : sam-app
Region : eu-west-1
Confirm changeset : False
Disable rollback : False
Deployment s3 bucket : aws-sam-cli-managed-default-samclisourcebucket-dee0ker00dts
Capabilities : ["CAPABILITY_IAM"]
Parameter overrides : {}
Signing Profiles : {}
Initiating deployment
Uploading to sam-app/4e272b888be3f30dedd7ac0cf77b1925.template 1361 / 1361 (100.00%)
Error: Failed to create changeset for the stack: sam-app, An error occurred (InternalFailure) when calling the CreateChangeSet operation (reached max retries: 4): Unknown
You gave confirm change set value as false. you have to give that as true.
Can you try giving these values while deploying?
Confirm changes before deploy [y/N]:y.
Allow SAM CLI IAM role creation [Y/n]:y
Disable rollback [y/N]:n
Save arguments to configuration file [Y/n]:y
I am implementing a Blue/Green deployment using aws-code-deploy orb. My infrastructure is being implemented using terraform which consists of the following resources.
S3 bucket → stores the appspec.yml which is used to create the deployment.
VPC for networking ( It was easier to spin mine up for this demo. Too lazy to navigate the Legitscript networking lol )
An application Load balancer, 2 Listener Groups and 2 Target Groups. On initial deployment of infrastructure, go to EC2 → Target groups and you will see TG1 will have a healthy target associated with it but TG2 will not. It will change once we implement the Blue green deployment.
ECS → A cluster, service and task definition will be available.
CodeDeploy → CodeDeploy application and deployment group.
This is my terraform file for S3 resource :-
resource "aws_s3_bucket" "bucket" {
bucket = "blue-green-cd-ls"
}
resource "aws_s3_object" "appspec" {
bucket = aws_s3_bucket.bucket.id
key = "appspec.yaml"
content = templatefile("${path.module}/appspec.yaml.tpl", {
task_definition_arn = var.task_definition_arn
})
}
Which successfuly creates the S3 bucket with the appspec.yml file in it. I am trying to create a deployment using CircleCI and my config.yml looks like this :-
version: 2.1
orbs:
aws-cli: circleci/aws-cli#3.1.3
aws-code-deploy: circleci/aws-code-deploy#2.0.0
jobs:
deploy:
executor: aws-cli/default
steps:
- checkout
- aws-cli/setup
- aws-code-deploy/deploy-bundle:
application-name: "blue-green"
bundle-bucket: "blue-green-cd-ls"
bundle-key: "appspec.yaml"
deployment-group: "blue-green-ls"
bundle-type: "YAML"
deployment-config: "CodeDeployDefault.ECSAllAtOnce"
workflows:
build-and-deploy:
jobs:
- deploy
But my deployment keeps on failing with the following error :-
Deployment failed!
{
"deploymentInfo": {
"applicationName": "blue-green",
"deploymentGroupName": "*************",
"deploymentConfigName": "CodeDeployDefault.ECSAllAtOnce",
"deploymentId": "d-85LKXCPMJ",
"revision": {
"revisionType": "S3",
"s3Location": {
"bucket": "blue-green-cd-ls",
"key": "appspec.yaml.YAML",
"bundleType": "YAML"
}
},
"status": "Failed",
"errorInformation": {
"code": "INVALID_REVISION",
"message": "The AppSpec file cannot be located in the specified S3 bucket. Verify your AppSpec file is present and that the name and key value pair specified for your S3 bucket are correct. The S3 bucket must be in your current region"
I double checked and the S3 bucket is definitely in the right region i.e. us-east-1. Anyone has any ideas what might be wrong? Thank you.
I have performed aws configure and ask configure after installing ask-cli.
While setting up new skill using ask new selected NodeJS, AWS with CloudFormation.
Trying to deploy the skill using ask deploy, getting [Error]: CliError: The CloudFormation deploy failed for Alexa region "default": Access Denied.
Tried setting the region in ~/.aws/config and in ~/.aws/credentials, still running into same error.
What should be done to fix the issue?
Skill creation
Error deploying skill
I've been able to deploy.
After running aws configure, I called ask new, and I think the solution was to not select AWS With CloudFormation but AWS Lambda:
I wanted to use an existing skill that I previously created in the web UI. So I created two folders: lambda and skill-package. Then I used ask init saying I don't want to use AWS CloudFormation to deploy:
Next, I added my region in ask-resources.json, under skillInfrastructure:
{
"askcliResourcesVersion": "2020-03-31",
"profiles": {
"default": {
"skillMetadata": {
"src": "./skill-package"
},
"code": {
"default": {
"src": "./lambda"
}
},
"skillInfrastructure": {
"type": "#ask-cli/lambda-deployer",
"userConfig": {
"runtime": "nodejs12.x",
"handler": "index.js",
"awsRegion": "eu-west-1"
}
}
}
}
}
And I finished with ask deploy that worked!
I am having a weird issue in CodePipeline + CodeDeploy, we have checked all the aws forums and stackoverflow but no one has had the particular issue and close issues suggestion have been already been taken into account but nothing has helped.
The issue in particular is the following :
We have a CodePipeline:
It happens that "randomly" we get the error:
(x) An AppSpec file is required, but could not be found in the revision
But the required file is in the Revision, we have checked dozens of times, and the files are in there and are the same name and format as the times that follow without problems.
This is happening in the same Deployment Group, with the same configuration, so is not a poorly configured Group because most of the times work without issues.
Just to be sure i add both .yml and .yaml versions in the revision. And the appspec is as simple as this:
version: 0.0
Resources:
- TargetService:
Type: AWS::ECS::Service
Properties:
TaskDefinition: "arn:aws:ecs:us-east-1:xxxxxxxx:task-definition/my_app_cd:258"
LoadBalancerInfo:
ContainerName: "nginx_main"
ContainerPort: 80
PlatformVersion: null
The above error I suspect is related to the wrong configuration for your codepipeline. To perform ECS codedeploy deployments, the provider in your codepipeline stage for deployment must be "ECS (blue/green)" not "Codedeploy" ( codedeploy is used for EC2 deployments.
Even though in the back-end it uses codedeploy, the name of the provider is "ECS (blue/green)".
Pipeline configuration can be checked as:
$ aws codepipeline get-pipeline --name <pipeline_name>
{
"name": "Deploy",
"blockers": null,
"actions": [
{
"name": "Deploy",
"actionTypeId": {
"category": "Deploy",
"owner": "AWS",
"provider": "CodeDeploy", <===== should be "CodeDeployToECS"
"version": "1"
},
I am trying to set AWS codepipeline and use github as the source by using cloudformation. The github repository is owned by an organization and I have admin access to it.
I was able to create webhook and successfully create entire service through codepipeline UI. But when I am trying to do same thing through Cloudformation Document, it returns error
Webhook could not be registered with GitHub. Error cause: Not found [StatusCode: 404, Body: {"message":"Not Found","documentation_url":"https://developer.github.com/v3/repos/hooks/#create-a-hook"}]
I used same credential both times (OAuth token in cloudformation and actual login popups in codepipeline UI), but when I do it through Cloudformation it failed.
I suspected my cloudformation document was the issue. But when I create my own repository, cloudformation successfully create webhook and created full codepipeline service.
Below is the summary of tests I did to understand where it went wrong.
Codepipeline UI. Organization Github Repo. It asked to login the github. Logged in with my admin credential => successfully created webhook and services.
Cloudformation. Organization Github Repo. Used OAuth Token from admin credential with repo and admin:repo_hook enabled. => Gave out error above
Cloudformation. Personal Github Repo. Used Oauth Token from admin credential with repo and admin:repo_hook enabled => successfully created webhook and services
The following is portion of cloudformation document where I create Webhook.
AppPipelineWebhook:
Type: 'AWS::CodePipeline::Webhook'
Properties:
Authentication: GITHUB_HMAC
AuthenticationConfiguration:
SecretToken: !Ref GitHubSecret
Filters:
- JsonPath: $.ref
MatchEquals: 'refs/heads/{Branch}'
TargetPipeline: !Ref cfSSMAutomationDev
TargetAction: SourceAction
Name: AppPipelineWebhook
TargetPipelineVersion: !GetAtt cfSSMAutomationDev.Version
RegisterWithThirdParty: true
So I am not sure what is wrong. My suspicion is that OAuth token requires more privilege. Does anyone have similar experience with this? Any suggestion is much appreciated
Even I was facing the same issue, by seeing codepipeline UI configuration's Repository I used
{
"Configuration": {
"Owner": "myUserName",
"Repo": "orgname/repository-name",
}
}
so cloudformation was checking for the repository myUserName/orgname/repository-name which wasn't exist.
It got solved after following the below solution:
{
"Configuration": {
"Owner": "orgname",
"Repo": "repository-name",
}
}
private repo -> ownerName: YourUserName
organisation repo -> ownerName: OrganisationName