Coder Social home page Coder Social logo

aws-sam-plugin's Introduction

AWS SAM plugin for Jenkins

License Wiki Build Status

Note

This plugin is DEPRECATED as of February 12, 2024.

We recommend using the AWS SAM build images directly using Jenkins Pipeline.

See here for more information.

The AWS Serverless Application Model (SAM) is an open-source framework you can use to build serverless applications on AWS.

This plugin helps you automate the deployments of your applications that are defined using SAM.

Features

  • Custom build step
  • samDeploy Pipeline step
  • Deploy SAM applications to AWS
  • Package SAM applications to a S3 bucket
    • Use specific or auto-created S3 bucket (if not given, a bucket will be automatically created in your account for you)
  • Template parameters support
  • Template tags support
  • Deploy to a specific region
  • Use an S3 prefix for packaged artifacts to have fine-grained control of where artifacts are uploaded
  • Use a specific KMS key for encrypting packaged artifacts at rest in S3
  • Configurable deployment role

Installation

  1. Navigate to your Jenkins server
  2. On the left, click "Manage Jenkins"
  3. Scroll down to find "Manage Plugins" and click it
  4. Look for the "AWS SAM" plugin

Requirements

AWS account

In order to deploy to AWS you must have an AWS account. Visit https://aws.amazon.com if you do not have one.

AWS credential configuration

Before you can start building, you must have your AWS credentials set up in Jenkins. To do this:

  1. From the main page of your jenkins server go to "Manage Jenkins" > "Manage Credentials" and then click on "Global" domain.
  2. Click "Add Credentials."
  3. Select from the "Kind" dropdown "AWS Credentials". If "AWS Credentials" do not exist, please check if you have AWS SAM plugin installed
  4. Finish the form with your AWS access keys and click "OK."

IAM setup

For deployment you'll need access to an S3 bucket (or permission to create one), CloudFormation and ChangeSet IAM lifecycle actions, as well as any IAM permissions required to create the resources in your SAM (CloudFormation) template.

S3 policy (you may want to limit Resource to specific S3 Buckets)

Version: '2012-10-17'
Statement:
  - Sid: SAMS3Actions
    Resource: '*'
    Effect: Allow
    Action:
      - s3:CreateBucket
      - s3:GetBucketLocation
      - s3:ListBucket
      - s3:PutObject
      - s3:PutObjectAcl
      - s3:PutObjectTagging

CloudFormation policy (you may want to limit Resource to specific stacks)

Version: '2012-10-17'
Statement:
  - Sid: SAMCloudFormationActions
    Resource: '*'
    Effect: Allow
    Action:
      - cloudformation:ValidateTemplate
      - cloudformation:DescribeStacks
      - cloudformation:CreateChangeSet
      - cloudformation:DescribeChangeSet
      - cloudformation:ExecuteChangeSet

Project configuration

There are a few steps to configuring your build.

  1. In your project configuration, scroll down to build steps.
  2. Add the "AWS SAM deploy application" build step.

Configuring the build step

  1. Select your AWS Credentials from the dropdown.
  2. Select the target region to deploy to.
  3. Give the build step a stack name.
  4. Optional: Enter an S3 bucket name to package the artifacts to.
    1. If you leave this blank, the S3 bucket will be auto-generated.
  5. Give the path to the SAM template file.

  1. Optional: If your template has parameters, add parameters where necessary.
  2. Optional: Add any tags to the stack you'd like.

  1. Optional: Finish the "Advanced" configuration
    1. Give an S3 prefix to package the artifacts in the bucket under.
    2. Give a KMS Key ID to encrypt the packaged artifacts.
    3. Give a Role Arn that will be assumed by CloudFormation when executing the changeset.
  2. Select an output template file for the package step to output to.

aws-sam-plugin's People

Contributors

a-melnyk avatar dependabot[bot] avatar edreanernst avatar elsoybean avatar gavinzz avatar hoffa avatar jfuss avatar mbarneyjr avatar mikedeck avatar modmac avatar notmyfault avatar paulhcsun avatar prenx4x avatar seansummers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-sam-plugin's Issues

Exception: Template format error: Unrecognized resource types: [AWS::Serverless::Function] (Service: AmazonCloudFormation; Status Code: 400; Error Code: ValidationError;

Seems to me that the latest plugin version is not entirely supporting all resource types, specifically AWS::Serverless::Function, as it's rejecting this template which does deploy correctly from the Eclipse AWS Toolkit using SAM CLI:

{ "Description" : "Integracion", "Resources" : { "GetFlotaRole" : { "Type" : "AWS::IAM::Role", "Properties" : { "AssumeRolePolicyDocument" : { "Version" : "2012-10-17", "Statement" : [ { "Effect" : "Allow", "Principal" : { "Service" : "lambda.amazonaws.com" }, "Action" : "sts:AssumeRole" } ] }, "ManagedPolicyArns" : [ "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", "arn:aws:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole" ], "Path" : "/integraciones/avis/geoxite/", "RoleName" : "GetFlotaRole" } }, "GetFlota" : { "Type" : "AWS::Serverless::Function", "Properties" : { "Handler" : "com.company.Class", "Runtime" : "java8", "CodeUri" : "./target/myArtifact-1.0.0.jar", "MemorySize" : "256", "Timeout" : "5", "VpcConfig" : { "SecurityGroupIds" : [ "sg-yyyyyy" ], "SubnetIds" : [ "subnet-xxxxxxxxx", "subnet-zzzzz" ] }, "Role" : { "Fn::GetAtt" : [ "GetFlotaRole", "Arn" ] }, "Events" : { "GetResource" : { "Type" : "Api", "Properties" : { "Path" : "/flota", "Method" : "get" } } } } } } }

Jenkins ver. 2.150
AWS SAM plugin 1.2.2
Amazon Web Services SDK plugin 1.11.403

Stacktrace:

com.amazonaws.services.cloudformation.model.AmazonCloudFormationException: Template format error: Unrecognized resource types: [AWS::Serverless::Function] (Service: AmazonCloudFormation; Status Code: 400; Error Code: ValidationError; Request ID: c86c43be-ffd7-11e8-babc-b1d2e9c4fe98) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1658) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1322) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1072) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:745) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:719) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:701) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:669) at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:651) at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:515) at com.amazonaws.services.cloudformation.AmazonCloudFormationClient.doInvoke(AmazonCloudFormationClient.java:2931) at com.amazonaws.services.cloudformation.AmazonCloudFormationClient.invoke(AmazonCloudFormationClient.java:2900) at com.amazonaws.services.cloudformation.AmazonCloudFormationClient.invoke(AmazonCloudFormationClient.java:2889) at com.amazonaws.services.cloudformation.AmazonCloudFormationClient.executeValidateTemplate(AmazonCloudFormationClient.java:2855) at com.amazonaws.services.cloudformation.AmazonCloudFormationClient.validateTemplate(AmazonCloudFormationClient.java:2826) at com.amazonaws.jenkins.plugins.sam.service.CloudFormationService.validateTemplate(CloudFormationService.java:49) at com.amazonaws.jenkins.plugins.sam.DeployBuildStep.perform(DeployBuildStep.java:70)

WaiterUnrecoverableException when deploy a Step Function use SAM

Jenkins and plugins versions report

Result
Jenkins: 2.303.1
OS: Linux - 4.14.231-173.360.amzn2.x86_64

Office-365-Connector:4.15.2
ace-editor:1.1
analysis-model-api:10.8.1
ant:1.13
antisamy-markup-formatter:2.7
apache-httpcomponents-client-4-api:4.5.13-1.0
artifactory:3.15.1
atlassian-jira-software-cloud:1.4.5
authentication-tokens:1.4
aws-credentials:1.33
aws-java-sdk:1.12.131-302.vbef9650c6521
aws-java-sdk-cloudformation:1.12.131-302.vbef9650c6521
aws-java-sdk-codebuild:1.12.131-302.vbef9650c6521
aws-java-sdk-ec2:1.12.131-302.vbef9650c6521
aws-java-sdk-ecr:1.12.131-302.vbef9650c6521
aws-java-sdk-ecs:1.12.131-302.vbef9650c6521
aws-java-sdk-elasticbeanstalk:1.12.131-302.vbef9650c6521
aws-java-sdk-iam:1.12.131-302.vbef9650c6521
aws-java-sdk-logs:1.12.131-302.vbef9650c6521
aws-java-sdk-minimal:1.12.131-302.vbef9650c6521
aws-java-sdk-ssm:1.12.131-302.vbef9650c6521
aws-sam:1.2.5
blueocean:1.25.2
blueocean-autofavorite:1.2.4
blueocean-bitbucket-pipeline:1.25.2
blueocean-commons:1.25.2
blueocean-config:1.25.2
blueocean-core-js:1.25.2
blueocean-dashboard:1.25.2
blueocean-display-url:2.4.1
blueocean-events:1.25.2
blueocean-git-pipeline:1.25.2
blueocean-github-pipeline:1.25.2
blueocean-i18n:1.25.2
blueocean-jwt:1.25.2
blueocean-personalization:1.25.2
blueocean-pipeline-api-impl:1.25.2
blueocean-pipeline-editor:1.25.2
blueocean-pipeline-scm-api:1.25.2
blueocean-rest:1.25.2
blueocean-rest-impl:1.25.2
blueocean-web:1.25.2
bootstrap4-api:4.6.0-3
bootstrap5-api:5.1.3-4
bouncycastle-api:2.25
branch-api:2.7.0
build-environment:1.7
build-name-setter:2.2.0
build-timeout:1.20
caffeine-api:2.9.2-29.v717aac953ff3
checks-api:1.7.2
cloudbees-bitbucket-branch-source:746.v350d2781c184
cloudbees-folder:6.17
cobertura:1.17
code-coverage-api:2.0.4
codedeploy:1.23
command-launcher:1.6
conditional-buildstep:1.4.1
config-file-provider:3.8.2
copyartifact:1.46.2
credentials:2.6.1
credentials-binding:1.27.1
data-tables-api:1.11.3-6
display-url-api:2.3.5
docker-commons:1.18
docker-java-api:3.1.5.2
docker-plugin:1.2.6
docker-workflow:1.27
durable-task:493.v195aefbb0ff2
echarts-api:5.2.2-2
email-ext:2.86
favorite:2.3.3
font-awesome-api:5.15.4-5
forensics-api:1.7.0
git:4.10.1
git-client:3.11.0
git-parameter:0.9.14
git-server:1.10
github:1.34.1
github-api:1.301-378.v9807bd746da5
github-branch-source:2.11.4
gradle:1.38
groovy:2.4
h2-api:1.4.199
handlebars:3.0.8
handy-uri-templates-2-api:2.1.8-1.0
htmlpublisher:1.28
ivy:2.1
jackson2-api:2.13.1-246.va8a9f3eaf46a
javadoc:1.6
javax-activation-api:1.2.0-2
javax-mail-api:1.6.2-5
jaxb:2.3.0.1
jdk-tool:1.5
jenkins-design-language:1.25.2
jira:3.6
jjwt-api:0.11.2-9.c8b45b8bb173
jobConfigHistory:2.31-rc1098.b666422863b2
jquery:1.12.4-1
jquery-detached:1.2.1
jquery3-api:3.6.0-2
jsch:0.1.55.2
junit:1.53
kubernetes-cli:1.10.3
kubernetes-client-api:5.11.2-182.v0f1cf4c5904e
kubernetes-credentials:0.9.0
ldap:2.7
lockable-resources:2.13
mailer:408.vd726a_1130320
matrix-auth:3.0
matrix-project:1.20
maven-plugin:3.16
momentjs:1.1.1
nodejs:1.5.0
okhttp-api:4.9.3-105.vb96869f8ac3a
pam-auth:1.6.1
parameterized-trigger:2.43
pipeline-aws:1.43
pipeline-build-step:2.16
pipeline-github-lib:1.0
pipeline-graph-analysis:1.11
pipeline-input-step:427.va6441fa17010
pipeline-maven:3.10.0
pipeline-milestone-step:1.3.2
pipeline-model-api:1.9.3
pipeline-model-definition:1.9.3
pipeline-model-extensions:1.9.3
pipeline-rest-api:2.21
pipeline-stage-step:291.vf0a8a7aeeb50
pipeline-stage-tags-metadata:1.9.3
pipeline-stage-view:2.20
plain-credentials:1.7
plugin-util-api:2.12.0
popper-api:1.16.1-2
popper2-api:2.11.2-1
prism-api:1.25.0-1
pubsub-light:1.16
python:1.3
rebuild:1.33
resource-disposer:0.17
role-strategy:3.2.0
run-condition:1.5
scm-api:595.vd5a_df5eb_0e39
script-security:1131.v8b_b_5eda_c328e
semantic-versioning-plugin:1.13
snakeyaml-api:1.29.1
sse-gateway:1.24
ssh-credentials:1.19
ssh-slaves:1.33.0
sshd:3.1.0
structs:308.v852b473a2b8c
timestamper:1.16
token-macro:267.vcdaea6462991
trilead-api:1.0.13
variant:1.4
warnings-ng:9.10.3
workflow-aggregator:2.6
workflow-api:1108.v57edf648f5d4
workflow-basic-steps:2.24
workflow-cps:2656.vf7a_e7b_75a_457
workflow-cps-global-lib:561.va_ce0de3c2d69
workflow-durable-task-step:2.40
workflow-job:1145.v7f2433caa07f
workflow-multibranch:707.v71c3f0a_6ccdb_
workflow-scm-step:2.13
workflow-step-api:622.vb_8e7c15b_c95a_
workflow-support:813.vb_d7c3d2984a_0
ws-cleanup:0.40

What Operating System are you using (both controller, and any agents involved in the problem)?

OS: Linux - 4.14.231-173.360.amzn2.x86_64

Reproduction steps

I was trying to deploy a step function (https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-statemachine.html) with lambdas. The step function was defined in a separate json file under the same folder.

It works fine when I use the sam cli with the following commands but failed when using the sam jenkins plugin.

sam build
sam deploy --guided

Here is the example of template.yaml

  DatasetCleanupPipeline:
    Type: AWS::Serverless::StateMachine
    Properties:
      Name: StepFunction-Test
      DefinitionUri: test/step_function.asl.json
      DefinitionSubstitutions:
        ReportDeletionLambdaArn: !GetAtt LambdaFunc.Arn

  LambdaFunc:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: test/functions
      Handler: lambda.lambda_delete_reports
      Timeout: 900

Checking S3 bucket, only lambda functions got upalao

Expected Results

A Step Function and lambda function should be deployed via CloudFormation

Actual Results

.....(some pip installs)
Successfully installed certifi-2022.5.18.1 charset-normalizer-2.0.12 idna-3.3 requests-2.27.1 urllib3-1.26.9

Validating template...
Uploading: cddb8a5df704b2ef1ee15fe90a4a4c5e
Uploading: 8c67376d707350ea521d95067d11d4fb
Successfully packaged artifacts.
Output template: template-19.yaml
Creating ChangeSet...
ERROR: Build step failed with exception
com.amazonaws.waiters.WaiterUnrecoverableException: Resource never entered the desired state as it failed.
at com.amazonaws.waiters.WaiterExecution.pollResource(WaiterExecution.java:78)
at com.amazonaws.waiters.WaiterImpl.run(WaiterImpl.java:88)
at com.amazonaws.jenkins.plugins.sam.service.CloudFormationService.waitForChangeSet(CloudFormationService.java:105)
Caused: com.amazonaws.jenkins.plugins.sam.model.SamPluginException: ChangeSet cannot be created
at com.amazonaws.jenkins.plugins.sam.service.CloudFormationService.waitForChangeSet(CloudFormationService.java:111)
at com.amazonaws.jenkins.plugins.sam.service.CloudFormationService.createChangeSet(CloudFormationService.java:66)
at com.amazonaws.jenkins.plugins.sam.DeployBuildStep.createChangeSet(DeployBuildStep.java:113)
at com.amazonaws.jenkins.plugins.sam.DeployBuildStep.perform(DeployBuildStep.java:84)
at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:81)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:21)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:808)
at hudson.model.Build$BuildExecution.build(Build.java:199)
at hudson.model.Build$BuildExecution.doRun(Build.java:164)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:516)
at hudson.model.Run.execute(Run.java:1889)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:100)
at hudson.model.Executor.run(Executor.java:433)
Build step 'AWS SAM deploy application' marked build as failure

Anything else?

No response

Intrinsic function values are split incorrectly

Version report

Jenkins and plugins versions report:

Jenkins: 2.303.3
OS: Linux - 3.10.0-1160.31.1.el7.x86_64
---
ace-editor:1.1
analysis-model-api:10.6.0
ant:1.12
antisamy-markup-formatter:2.4
apache-httpcomponents-client-4-api:4.5.13-1.0
artifactory:3.13.2
authentication-tokens:1.4
aws-credentials:1.32
aws-java-sdk:1.12.101-300.vc09c7be9cb57
aws-java-sdk-cloudformation:1.12.101-300.vc09c7be9cb57
aws-java-sdk-codebuild:1.12.101-300.vc09c7be9cb57
aws-java-sdk-ec2:1.12.101-300.vc09c7be9cb57
aws-java-sdk-ecr:1.12.101-300.vc09c7be9cb57
aws-java-sdk-ecs:1.12.101-300.vc09c7be9cb57
aws-java-sdk-elasticbeanstalk:1.12.101-300.vc09c7be9cb57
aws-java-sdk-iam:1.12.101-300.vc09c7be9cb57
aws-java-sdk-logs:1.12.101-300.vc09c7be9cb57
aws-java-sdk-minimal:1.12.101-300.vc09c7be9cb57
aws-java-sdk-ssm:1.12.101-300.vc09c7be9cb57
aws-sam:1.2.5
blueocean:1.25.1
blueocean-autofavorite:1.2.4
blueocean-bitbucket-pipeline:1.25.1
blueocean-commons:1.25.1
blueocean-config:1.25.1
blueocean-core-js:1.25.1
blueocean-dashboard:1.25.1
blueocean-display-url:2.4.1
blueocean-events:1.25.1
blueocean-git-pipeline:1.25.1
blueocean-github-pipeline:1.25.1
blueocean-i18n:1.25.1
blueocean-jira:1.25.1
blueocean-jwt:1.25.1
blueocean-personalization:1.25.1
blueocean-pipeline-api-impl:1.25.1
blueocean-pipeline-editor:1.25.1
blueocean-pipeline-scm-api:1.25.1
blueocean-rest:1.25.1
blueocean-rest-impl:1.25.1
blueocean-web:1.25.1
bootstrap4-api:4.6.0-3
bootstrap5-api:5.1.3-1
bouncycastle-api:2.25
branch-api:2.7.0
build-timeout:1.20
caffeine-api:2.9.2-29.v717aac953ff3
checks-api:1.7.2
cloudbees-bitbucket-branch-source:2.9.11
cloudbees-folder:6.16
code-coverage-api:2.0.4
command-launcher:1.6
config-file-provider:3.8.1
copyartifact:1.46.2
credentials:2.6.1
credentials-binding:1.27
data-tables-api:1.11.3-4
display-url-api:2.3.5
docker-commons:1.17
docker-workflow:1.26
durable-task:1.39
echarts-api:5.2.2-1
email-ext:2.84
favorite:2.3.3
font-awesome-api:5.15.4-1
forensics-api:1.6.0
git:4.10.0
git-client:3.10.0
git-server:1.10
github:1.34.1
github-api:1.133
github-branch-source:2.11.3
gradle:1.37.1
handlebars:3.0.8
handy-uri-templates-2-api:2.1.8-1.0
htmlpublisher:1.27
ivy:2.1
jackson2-api:2.13.0-230.v59243c64b0a5
javadoc:1.6
jaxb:2.3.0.1
jdk-tool:1.5
jenkins-design-language:1.25.1
jira:3.6
jira-steps:1.6.0
jjwt-api:0.11.2-9.c8b45b8bb173
jquery:1.12.4-1
jquery3-api:3.6.0-2
jsch:0.1.55.2
junit:1.53
ldap:2.7
lockable-resources:2.12
mailer:1.34
mask-passwords:3.0
matrix-auth:2.6.8
matrix-project:1.19
mattermost:3.1.1
maven-plugin:3.15.1
momentjs:1.1.1
okhttp-api:4.9.2-20211102
pam-auth:1.6.1
pipeline-aws:1.43
pipeline-build-step:2.15
pipeline-github-lib:1.0
pipeline-graph-analysis:1.11
pipeline-input-step:2.12
pipeline-milestone-step:1.3.2
pipeline-model-api:1.9.2
pipeline-model-definition:1.9.2
pipeline-model-extensions:1.9.2
pipeline-rest-api:2.19
pipeline-stage-step:2.5
pipeline-stage-tags-metadata:1.9.2
pipeline-stage-view:2.19
pipeline-utility-steps:2.10.0
plain-credentials:1.7
plugin-util-api:2.5.1
popper-api:1.16.1-2
popper2-api:2.10.2-1
pubsub-light:1.16
resource-disposer:0.16
scm-api:2.6.5
script-security:1.78
snakeyaml-api:1.29.1
sonar:2.13.1
sse-gateway:1.24
ssh-credentials:1.19
ssh-slaves:1.33.0
ssh-steps:2.0.0
sshd:3.1.0
structs:1.23
timestamper:1.13
token-macro:267.vcdaea6462991
trilead-api:1.0.13
variant:1.4
warnings-ng:9.7.0
workflow-aggregator:2.6
workflow-api:2.47
workflow-basic-steps:2.24
workflow-cps:2633.v6baeedc13805
workflow-cps-global-lib:545.v7b28cce323cf
workflow-durable-task-step:2.39
workflow-job:2.42
workflow-multibranch:2.26
workflow-scm-step:2.13
workflow-step-api:2.24
workflow-support:3.8
ws-cleanup:0.39
xray-connector:2.5.1
  • What Operating System are you using (both controller, and any agents involved in the problem)?
CentOS Linux release 7.9.2009

Reproduction steps

  • create a template with nested stacks with outputs
  • reference a nested stack output with GetAtt function like !GetAtt NestedStack.Outputs.SomeOutput
  • try to deploy using sam plugin

Results

Expected result:

Stack should be created/updated (this is what sam deploy does)

Actual result:

  • SAM deployment fails with error message
com.amazonaws.waiters.WaiterUnrecoverableException: Resource never entered the desired state as it failed.
	at com.amazonaws.waiters.WaiterExecution.pollResource(WaiterExecution.java:78)
	at com.amazonaws.waiters.WaiterImpl.run(WaiterImpl.java:88)
	at com.amazonaws.jenkins.plugins.sam.service.CloudFormationService.waitForChangeSet(CloudFormationService.java:105)
Caused: com.amazonaws.jenkins.plugins.sam.model.SamPluginException: ChangeSet cannot be created
	at com.amazonaws.jenkins.plugins.sam.service.CloudFormationService.waitForChangeSet(CloudFormationService.java:111)
	at com.amazonaws.jenkins.plugins.sam.service.CloudFormationService.createChangeSet(CloudFormationService.java:66)
	at com.amazonaws.jenkins.plugins.sam.DeployBuildStep.createChangeSet(DeployBuildStep.java:113)
	at com.amazonaws.jenkins.plugins.sam.DeployBuildStep.perform(DeployBuildStep.java:84)
	at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:100)
	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:70)
	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
  • CloudFormation ChangeSet creation failed with status reason Template error: every Fn::GetAtt object requires two non-empty parameters, the resource name and the resource attribute
  • Resulting template contains invalid configuration, like Fn::GetAtt: [NestedStack, Outputs, SomeOutput]

Fresh install is broken

Looks like when you try to configure the plugin (Fresh installation of the plugin and Jenkins server)
The Region filed return the following stack trace:

java.lang.IllegalArgumentException: Cannot create enum from us-iso-east-1 value!
at com.amazonaws.regions.Regions.fromName(Regions.java:92)
at com.amazonaws.jenkins.plugins.sam.util.BeanHelper.doFillRegionItems(BeanHelper.java:20)
at com.amazonaws.jenkins.plugins.sam.DeploySettings$DescriptorImpl.doFillRegionItems(DeploySettings.java:185)
at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:396)
at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:408)
at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:212)
at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:145)
at org.kohsuke.stapler.MetaClass$11.doDispatch(MetaClass.java:535)
at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:747)
Caused: javax.servlet.ServletException
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:797)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:878)
at org.kohsuke.stapler.MetaClass$4.doDispatch(MetaClass.java:280)
at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:747)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:878)
at org.kohsuke.stapler.MetaClass$4.doDispatch(MetaClass.java:280)
at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:747)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:878)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:676)
at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:873)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1623)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)
at jenkins.telemetry.impl.UserLanguages$AcceptLanguageFilter.doFilter(UserLanguages.java:128)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:157)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:99)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90)
at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1700)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1667)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:505)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:698)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:804)
at java.lang.Thread.run(Thread.java:748)

Open File Leak when zipping a whole directory for deployment

my pipeline usage looks like this:
samDeploy([ credentialsId: '****', region: 'us-east-1', s3Bucket: '****', s3Prefix: env.cloudFormationStack, stackName: "${env.cloudFormationStack}-process-pixel-events-stack", parameters: [[key: 'VGEnvironment', value: env.cloudFormationStack]], templateFile: 'process-pixel-events-stack/template.yaml', outputTemplateFile: "process-pixel-events-stack/packaged-${env.cloudFormationStack}.yaml"])

In the template.yaml, my function is specified like this (specifies a directory to zip up):
ProcessPixelEventsFunction: Type: AWS::Serverless::Function Properties: Runtime: nodejs8.10 CodeUri: process_pixel_events_function/ ...

After each run, Jenkins process maintains open file descriptions, as seen with lsof -p PID:
And it keeps the file descriptions for each file zipped, such as all the files inside my node_modules ,
java 20554 jenkins 5661r REG 202,65 395 35656896 /var/lib/jenkins/jobs/deploy-lambdas/workspace/process-pixel-events-stack/process_pixel_events_function/node_modules/gauge/base-theme.js java 20554 jenkins 5662r REG 202,65 93 35656903 /var/lib/jenkins/jobs/deploy-lambdas/workspace/process-pixel-events-stack/process_pixel_events_function/node_modules/gauge/set-interval.js java 20554 jenkins 5663r REG 202,65 1269 35656940 /var/lib/jenkins/jobs/deploy-lambdas/workspace/process-pixel-events-stack/process_pixel_events_function/node_modules/gauge/plumbing.js java 20554 jenkins 5664r REG 202,65 616 35656909 /var/lib/jenkins/jobs/deploy-lambdas/workspace/process-pixel-events-stack/process_pixel_events_function/node_modules/gauge/error.js java 20554 jenkins 5665r REG 202,65 6376 35656949 /var/lib/jenkins/jobs/deploy-lambdas/workspace/process-pixel-events-stack/process_pixel_events_function/node_modules/gauge/CHANGELOG.md java 20554 jenkins 5666r REG 202,65 6999 35656922 /var/lib/jenkins/jobs/deploy-lambdas/workspace/process-pixel-events-stack/process_pixel_events_function/node_modules/gauge/index.js java 20554 jenkins 5667r REG 202,65 998 35656917 /var/lib/jenkins/jobs/deploy-lambdas/workspace/process-pixel-events-stack/process_pixel_events_function/node_modules/gauge/progress-bar.js java 20554 jenkins 5668r REG 202,65 5739 35656913 /var/lib/jenkins/jobs/deploy-lambdas/workspace/process-pixel-events-stack/process_pixel_events_function/node_modules/gauge/render-template.js java 20554 jenkins 5669r REG 202,65 3693 35656891 /var/lib/jenkins/jobs/deploy-lambdas/workspace/process-pixel-events-stack/process_pixel_events_function/node_modules/gauge/theme-set.js

after maybe 10 runs of this Jenkins job, Jenkins stops being able to do anything and keeps throwing "too many open files" exceptions

Does this plugin support using credentials in folders?

We use Folders pretty extensively, and want to have our users manage their own credentials within those Folders. We ran into an issue today where the plugin wasn't displaying those credentials in the dropdown. After some reading, I moved the credential to the default root credential location and the plugin successfully saw the credential and allowed me to select it in the dropdown. I'm curious if this plugin supports credentials in folders, and if so, what I could look into next?

Thanks!

Parameter Environment Variable Support in GUI

I am not able to use parameters in the AWS Sam plugin

image

Would be great if these env variables could be resolved so I could have one jenkins job deploy all my SAM applications, instead of having a separate jenkins job for each.

Thanks!

LambdaDependency ContentUri Is not Updating

Hello,

I'm using AWS Sam Plugin version 1.2.2.

But in actually sam plugin do not update contentUri for Layer resource of cloudformation.

You can check my cloudformation.yaml file shown as below;

  DependencyLayer:
    Type: AWS::Serverless::LayerVersion
    Properties:
      LayerName: my-service
      ContentUri: ./dependencies
      CompatibleRuntimes:
        - python3.6

SAM plugin updating codeUri path to s3 uri but in actually I cannot see any update on Dependency resource ? How Can I fix that, which points are I'm missing ?

Thanks

Use Jenkins Build Parameters for stack name etc.

Dependencies

Feature Request

I would like to use jenkins build parameters to specify values for "stack name", "s3 Prefix" and "S3 bucket".

In the form of something like ${JENKINS_BUILD_PARAM}.

Thanks

Sion

credentialsId argument not being respected

Hi!

When I use samDeploy() to deploy a service, it always gets deployed with the default credentials from $HOME/.aws/credentials in the jenkins slave machine.

The code looks like this:

awsCredentialsId = 'AWS_LIVE'

// some other irrelevant code...

samDeploy([
	credentialsId: awsCredentialsId,
	region: awsRegion,
	s3Bucket: deploymentName,
	stackName: deploymentName,
	templateFile: './template.yml',
	parameters: cfnParams,
])

If I do credentialsId: 'AWS_LIVE' the issue remains so the variable doesn't get changed somewhere in the part that I left out.

Any ideas?

Thanks!

What about samPackage()?

Hi Jenkins team,

In the usage section, you only mentioned about samDeploy() function which I understand can be used from Jenkinsfile (script) now. But what about samPackage()? Do we still have to use Shell for packaging?

Thanks.

Atif

Can we have documentation if we want to use in jenkins pipelines?

Jenkins Pipelines usage.

Hi;
I am trying to use the plugin in a Jenkins pipeline but failed.
I am getting the following error:
com.amazonaws.jenkins.plugins.sam.DeployBuildStep.settings expects class com.amazonaws.jenkins.plugins.sam.DeploySettings but received class org.jenkinsci.plugins.workflow.cps.CpsClosure2
It would be great if there is a documentation on how to use in pipelines.
Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.