xt-i / aws-lambda-jenkins-plugin Goto Github PK
View Code? Open in Web Editor NEWJenkins plugin for AWS Lambda deployment
License: MIT License
Jenkins plugin for AWS Lambda deployment
License: MIT License
Hi! Great plugin, however it does not support the ability to support authentication through IAM roles. It requires the secret key and access key instead.
Is there any way to add description if I wish to create a new version while deploying the lambda because once its deployed there is no way yet to update anything.
Hi,
I have job a that has 2 build steps:
When launching the job, the second step fails with the following error:
java.io.NotSerializableException: com.xti.jenkins.plugin.awslambda.publish.PublishConfig
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
at hudson.remoting.UserRequest._serialize(UserRequest.java:190)
at hudson.remoting.UserRequest.serialize(UserRequest.java:199)
Caused: java.io.IOException: Unable to serialize com.xti.jenkins.plugin.awslambda.callable.PublishCallable@15383af4
at hudson.remoting.UserRequest.serialize(UserRequest.java:201)
at hudson.remoting.UserRequest.<init>(UserRequest.java:64)
at hudson.remoting.Channel.call(Channel.java:828)
at com.xti.jenkins.plugin.awslambda.publish.LambdaPublishBuildStep.perform(LambdaPublishBuildStep.java:57)
Caused: java.lang.RuntimeException
at com.xti.jenkins.plugin.awslambda.publish.LambdaPublishBuildStep.perform(LambdaPublishBuildStep.java:65)
at com.xti.jenkins.plugin.awslambda.publish.LambdaPublishBuildStep.perform(LambdaPublishBuildStep.java:45)
It seems that the POJO com.xti.jenkins.plugin.awslambda.publish.PublishConfig
does not implements Serializable
.
I'm using the version 0.5.8 of the plugin (with Jenkins 2.47)
/Julien
It would be a nice feature if we could add multiple aliases to a version. It could be added by allowing a comma separated list to the input box of the aliases.
I mentioned it in #31 as well but I guess this might be easier to start with.
The reason I'm asking this is because I add multiple tags to my released versions. The production
alias is always pointing to the latests versioned release. I also add a v0
(or v1
, v2
, ...) depending on the semver of my code. This way, when calling a lambda function from another function, I know for sure that the v1
alias doesn't introduce breaking changes. It allows me to keep upgrading lambda A without the need to upgrade lambda B (which calls lambda A at v1
) at the same time because lambda A introduced a breaking change.
So ideally, the input box allows multiple aliases with the option to pass in environment variables
production, ${MAJOR}
where ${MAJOR} points to v1
or something.
Any thoughts on this?
Leaving this here to point out that in the near future you will be able to use the aws-credential plugin for IAM access key and secret key storage.
This means that the core dependency will be increased to 1.596.1
I am getting below error while deploying lambda function using AWS lambda plugin. I am specifying artifacts location inside as jenkins "target" directory instead of S3 location.
Stacktrace:
15:29:46 {FunctionName: my_lambda,Runtime: java8,Role: LambdaExecutionRole,Handler: com.mycompany.MyHandler::starter,Code: {ZipFile: java.nio.HeapByteBuffer[pos=0 lim=40959835 cap=40959835],},Description: Deployed with AWS lambda Plugin :7,Timeout: 40,MemorySize: 384,Publish: false,}
15:29:46
15:29:46 com.amazonaws.AmazonClientException: Unable to marshall request to JSON: Java heap space
15:29:46 at com.amazonaws.services.lambda.model.transform.CreateFunctionRequestMarshaller.marshall(CreateFunctionRequestMarshaller.java:191)
15:29:46 at com.amazonaws.services.lambda.AWSLambdaClient.createFunction(AWSLambdaClient.java:703)
15:29:46 at com.xti.jenkins.plugin.awslambda.service.LambdaDeployService.createLambdaFunction(LambdaDeployService.java:171)
15:29:46 at com.xti.jenkins.plugin.awslambda.service.LambdaDeployService.deployLambda(LambdaDeployService.java:83)
15:29:46 at com.xti.jenkins.plugin.awslambda.upload.LambdaUploader.upload(LambdaUploader.java:51)
15:29:46 at com.xti.jenkins.plugin.awslambda.callable.DeployCallable.call(DeployCallable.java:46)
15:29:46 at com.xti.jenkins.plugin.awslambda.callable.DeployCallable.call(DeployCallable.java:23)
15:29:46 at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
15:29:46 at com.xti.jenkins.plugin.awslambda.upload.LambdaUploadPublisher.perform(LambdaUploadPublisher.java:93)
15:29:46 at com.xti.jenkins.plugin.awslambda.upload.LambdaUploadPublisher.perform(LambdaUploadPublisher.java:69)
15:29:46 at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
15:29:46 at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
15:29:46 at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
15:29:46 at hudson.model.Build$BuildExecution.post2(Build.java:185)
15:29:46 at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:665)
15:29:46 at hudson.model.Run.execute(Run.java:1766)
15:29:46 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
15:29:46 at hudson.model.ResourceController.execute(ResourceController.java:98)
15:29:46 at hudson.model.Executor.run(Executor.java:410)
15:29:46 Caused by: java.lang.OutOfMemoryError: Java heap space
15:29:46 at javax.xml.bind.DatatypeConverterImpl._printBase64Binary(Unknown Source)
15:29:46 at javax.xml.bind.DatatypeConverterImpl._printBase64Binary(Unknown Source)
15:29:46 at javax.xml.bind.DatatypeConverterImpl.printBase64Binary(Unknown Source)
15:29:46 at javax.xml.bind.DatatypeConverter.printBase64Binary(Unknown Source)
15:29:46 at com.amazonaws.util.Base64.encodeAsString(Base64.java:39)
15:29:46 at com.amazonaws.util.BinaryUtils.toBase64(BinaryUtils.java:59)
15:29:46 at com.amazonaws.util.json.JSONWriter.value(JSONWriter.java:347)
15:29:46 at com.amazonaws.services.lambda.model.transform.CreateFunctionRequestMarshaller.marshall(CreateFunctionRequestMarshaller.java:122)
15:29:46 ... 18 more
Hi,
When running on a slave the http://javadoc.jenkins-ci.org/jenkins/model/Jenkins.html#getInstance() will return null
and therefore the com.xti.jenkins.plugin.awslambda.util.LambdaClientConfig#getClientConfiguration()
will not honor the proxy setting found on the master.
I would expect the general ProxyConfiguration
to be transmitted to the slaves.
Hi there,
I'm trying to upload a lambda function with VPC access through Jenkins.
I saw that you updated this awesome plugin in order to select subnets and security group but I have a question: which should be the input of the two fields?
I tried with the format subnet-XXXXXXX
or only XXXXXXX
but don't seem to work.
Cheers
Mirko
Currently we need to give 'AWS Access key ID' and 'AWS Secret Access Key' in the jenkins.
I want to use temporary credentials only. For that
I could not find a way to enter 'AWS session Token' in the plugin.
Please add support for that or let me know if there is some existing way to enter temporary credentials.
How I can encrypt specific environment variable through KMS using this plugin ??
Thanks for your attention. I’m looking forward to your reply.
It's look like plugin use old version of AWS SDK that not support London region.
Started by timer Building in workspace /var/lib/jenkins/workspace/lambda_create_ami ERROR: Build step failed with exception java.lang.IllegalArgumentException: Cannot create enum from eu-west-2 value! at com.amazonaws.regions.Regions.fromName(Regions.java:76) at com.xti.jenkins.plugin.awslambda.util.LambdaClientConfig.getClient(LambdaClientConfig.java:35) at com.xti.jenkins.plugin.awslambda.callable.InvokeCallable.call(InvokeCallable.java:41) at com.xti.jenkins.plugin.awslambda.callable.InvokeCallable.call(InvokeCallable.java:25) at hudson.remoting.LocalChannel.call(LocalChannel.java:45) at com.xti.jenkins.plugin.awslambda.invoke.LambdaInvokeBuildStep.perform(LambdaInvokeBuildStep.java:77) Caused: java.lang.RuntimeException at com.xti.jenkins.plugin.awslambda.invoke.LambdaInvokeBuildStep.perform(LambdaInvokeBuildStep.java:87) at com.xti.jenkins.plugin.awslambda.invoke.LambdaInvokeBuildStep.perform(LambdaInvokeBuildStep.java:65) at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:81) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744) at hudson.model.Build$BuildExecution.build(Build.java:206) at hudson.model.Build$BuildExecution.doRun(Build.java:163) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504) at hudson.model.Run.execute(Run.java:1727) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:429) Build step 'AWS Lambda invocation' marked build as failure Finished: FAILURE
Plugin version: 0.5.10
It seems that after the zip file is upload, there's no need to keep the temp file around and we could delete it, or provide an option to delete it.
Some jenkins installations use a temp folder that is actually not cleaned up automatically. Usually this is not an issue, but the temp file generated by this plugin can easily be dozens of MBs in size.
Re-raising JIRA issue here since it is not clear from plugin description which issue tracker is the main one.
https://issues.jenkins-ci.org/browse/JENKINS-43627
I have a Jenkins job, that deploys 16 lambdas. When you add the 17th, you no longer can select Update mode. In the chrome console you see the below error.
Uncaught TypeError: vg.rowVisibilityGroup.makeInnerVisisble is not a function
at updateAwsLambdaOptionalBlock (https://jci1.knowland.com:8080/plugin/aws-lambda/js/awslambda.js:14:27)
at https://jci1.knowland.com:8080/plugin/aws-lambda/js/awslambda.js:49:9
at Array.forEach (native)
at https://jci1.knowland.com:8080/static/5a40f66c/scripts/behavior.js:111:30
at Array.forEach (native)
at https://jci1.knowland.com:8080/static/5a40f66c/scripts/behavior.js:107:27
at Array.forEach (native)
at Object.applySubtree (https://jci1.knowland.com:8080/static/5a40f66c/scripts/behavior.js:93:17)
at Object.apply (https://jci1.knowland.com:8080/static/5a40f66c/scripts/behavior.js:76:14)
at https://jci1.knowland.com:8080/static/5a40f66c/scripts/behavior.js:71:14
The only work around it to create a second job that only deploys the 17th and above lambdas.
We have a lambda that we'd like to deploy to multiple lambda instances. This seems to work for the most part, but when configuring the second instance, the values in the "Update Mode" dropdown are missing. We only want to (and only have permissions to) update the code, but are unable to select that option.
Can you confirm if this is an issue or if we are doing something incorrectly?
Hello,
I am currently getting "Cannot create enum from eu-west-2 value!" error.
In December 2016 AWS region eu-west-2 got introduced.
Would it be possible to get the AWS Version (pom.xml) updated.
It looks like the earliest version this got introduced as 1.11.67 (https://github.com/aws/aws-sdk-java/blob/1.11.67/aws-java-sdk-core/src/main/java/com/amazonaws/regions/Regions.java), with the latest being 1.11.160 (https://github.com/aws/aws-sdk-java/blob/1.11.160/aws-java-sdk-core/src/main/java/com/amazonaws/regions/Regions.java).
Regards,
Lewis Freeman
With the new nodejs4.3
runtime I looked into updating all the runtimes to 4.3. I just changed my jenkins configuration and deployed my code again. It seems that the runtime isn't updated.
Lambda update configuration request:
{FunctionName: fnName,Role: arn:aws:iam::123456789012:role/lambda_role,Handler: index.handler,Description: test,Timeout: 10,MemorySize: 128,}
It seems these lines are the reason why it doesn't work. It does net set the runtime.
Will do a PR.
Using 0.5.10 version of this plugin. When invoking publish new version and update alias procedure, I get the following error.
java.lang.RuntimeException: java.io.IOException: Unable to serialize com.xti.jenkins.plugin.awslambda.publish.LambdaPublishServiceResponse@35fc939e
at com.xti.jenkins.plugin.awslambda.publish.LambdaPublishBuildStep.perform(LambdaPublishBuildStep.java:66)
at com.xti.jenkins.plugin.awslambda.publish.LambdaPublishBuildStep.perform(LambdaPublishBuildStep.java:46)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:78)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:65)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:49)
at hudson.security.ACL.impersonate(ACL.java:260)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:46)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: Unable to serialize com.xti.jenkins.plugin.awslambda.publish.LambdaPublishServiceResponse@35fc939e
at hudson.remoting.UserRequest.serialize(UserRequest.java:201)
at hudson.remoting.UserRequest.perform(UserRequest.java:161)
at hudson.remoting.UserRequest.perform(UserRequest.java:50)
at hudson.remoting.Request$2.run(Request.java:336)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at ......remote call to Enterprise Linux Slave 3(Native Method)
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1545)
at hudson.remoting.UserResponse.retrieve(UserRequest.java:253)
at hudson.remoting.Channel.call(Channel.java:830)
at com.xti.jenkins.plugin.awslambda.publish.LambdaPublishBuildStep.perform(LambdaPublishBuildStep.java:58)
... 11 more
Caused by: java.io.NotSerializableException: com.xti.jenkins.plugin.awslambda.publish.LambdaPublishServiceResponse
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
at hudson.remoting.UserRequest._serialize(UserRequest.java:190)
at hudson.remoting.UserRequest.serialize(UserRequest.java:199)
at hudson.remoting.UserRequest.perform(UserRequest.java:161)
at hudson.remoting.UserRequest.perform(UserRequest.java:50)
at hudson.remoting.Request$2.run(Request.java:336)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
... 4 more
Hi there,
Recently trying to implement this awesome plugin into my Jenkins but an error occurred as such:
EnvironmentVariablesFeature is not supported in cn-north-1 region
After some digging I found that this plugin try to send an empty environment variable object rather than ignore it, shown in log: Environment: {Variables: {}}
As located in Beijing and also urge to use this plugin rather than just writing aws cli commands, is it possible not to send the empty object if nothing set ?
Thanks.
i would like the build to fail when the lambda function fails. right now my build succeeds even when the lambda functions returns a stack-trace.
And the request message I saw from console is only like this:
Lambda update code request:
{FunctionName: Tracker,ZipFile: java.nio.HeapByteBuffer[pos=0 lim=3450022 cap=3450022],Publish: false}
There's no environment variables in the request. Should be
{FunctionName: Tracker,ZipFile: java.nio.HeapByteBuffer[pos=0 lim=3450022 cap=3450022],Publish: false,Environment: {Variables: {REDSHIFT_CONNECTION_STRING=blabla, GA_CONTAINER_ID=blablabla, REDSHIFT_DATABASE_SCHEMA=blabla}, }, }
Shall I set Update Mode
to Code and configuration
? Or how can I fix it?
The plugin outputs as if my build was successfully, although when I run the lambda function my handler class is not found.
16:28:51 Lambda update code request: 16:28:51 {FunctionName: sc-assoc-units-worker,ZipFile: java.nio.HeapByteBuffer[pos=0 lim=15350954 cap=15350954],Publish: false}
This was working a couple days ago just fine and now, with no changes to the job it suddenly stopped working. Still wondering if that is a plugin issue or an AWS change in the service.
Let me know if everything is still working fine for you please.
Thank you
Hi,
Great plugin for AWS Lambda but can you please add the two new runtimes that are now supported on Lambda: Python and Java?
Thanks!
I believe this just requires updating the AWS dependencies.
Since about 30 minutes I started receiving these errors when Jenkins tries to deploy my build.
com.amazonaws.services.lambda.model.InvalidParameterValueException: SubnetIds and SecurityIds must coexist or be both empty list. (Service: AWSLambda; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: b17cab79-d3f3-11e6-9bee-e7fb56d0a4ae)
I checked the documentation and I believe this has something to do with the VpcConfig parameter inside createFunction. I used the JavaScript docs to check that because the Java docs doesn't work for me :p. They aren't marked as required
yet but probably they changed that which is odd IMO.
As mentioned in #14
Does this plugin support pipelines/workflows via Jenkinsfile?
Using an AWS Lambda build action with any JSON Parameters for parsing or capturing the response causes the following failure.
ERROR: Build step failed with exception java.lang.RuntimeException: java.io.IOException: Unable to serialize com.xti.jenkins.plugin.awslambda.callable.InvokeCallable@3357275a at com.xti.jenkins.plugin.awslambda.invoke.LambdaInvokePublisher.perform(LambdaInvokePublisher.java:112) at com.xti.jenkins.plugin.awslambda.invoke.LambdaInvokePublisher.perform(LambdaInvokePublisher.java:75) at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723) at hudson.model.Build$BuildExecution.post2(Build.java:185) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668) at hudson.model.Run.execute(Run.java:1763) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410) Caused by: java.io.IOException: Unable to serialize com.xti.jenkins.plugin.awslambda.callable.InvokeCallable@3357275a at hudson.remoting.UserRequest.serialize(UserRequest.java:168) at hudson.remoting.UserRequest.<init>(UserRequest.java:62) at hudson.remoting.Channel.call(Channel.java:779) at com.xti.jenkins.plugin.awslambda.invoke.LambdaInvokePublisher.perform(LambdaInvokePublisher.java:99) ... 10 more Caused by: java.io.NotSerializableException: com.xti.jenkins.plugin.awslambda.invoke.JsonParameter at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1183) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347) at java.util.ArrayList.writeObject(ArrayList.java:742) at sun.reflect.GeneratedMethodAccessor184.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1028) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1495) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347) at hudson.remoting.UserRequest._serialize(UserRequest.java:157) at hudson.remoting.UserRequest.serialize(UserRequest.java:166) ... 13 more Build step 'AWS Lambda invocation' marked build as failure Finished: FAILURE
This occurs when the step is a build step, as well as a post-build action. Removing the JSON Paramenters allows the step to complete successfully. This also happens with or without a JSON payload being sent with the original request.
Had the same issue with version 0.4.3 as well as 0.5.0
Hi,
I'm trying to use this plugin to update my Lambda function.
2 Questions:
Code is retreived from git,
and when running the build script i get
Could not find zipfile or folder.
What should i input in the file location to make it work?
How can i run pip install before and add some libs to my zip prior to upload?
Thanks!
I noticed that the version and alias are created before the configuration is updated. Is this expected behaviour?
We have a really messy lambda repository in bitbucket, wich is fine since I can set a env variable using
LAMBDA_LOCATION=$(find pwd
-name $LAMBDA_NAME) to point the location of my lambda zip. But the plugin can't use it. If I Inject the variable and pass it to the plugin (on the "Artifact Location (zip, directory, s3)" section) as $LAMBDA_LOCATION I keep getting the "Could not find zipfile or folder" error
Am I doing something wrong or it is a limitation?
I tried setting the java opts proxyHost and proxyPort using https and http, but neither worked. Perhaps the jenkins proxy needs to be loaded like this:
jenkinsci/stashnotifier-plugin@5db2af4
Thanks.
You can't currently invoke an aliased lambda.
Right now you can either use the instance profile, or an access/secret key combination.
Our usecase is: jenkins runs in AWS account A and needs to deploy lambda functions in account B.
The codedeploy plugin of jenkins allows for specifying an iamRole to assume in the aws sdk.
Would be great if this plugin supports this as well.
Example of the codedeploy plugin:
iamRoleArn: 'arn:aws:iam::XXXX:role/some-role'
I am writing a Jenkins job to encrypt plain text passswords and I am able to use the secure strings password variable in Jenkins but the log for the Invoke Lambda function is displaying the payload in plain text.
When using the Lambda plugin, I'm getting an error executing the function in Lambda:
EACCES, permission denied '/var/task/index.js
{
"errorMessage": "EACCES, permission denied '/var/task/index.js'",
"errorType": "Error",
"stackTrace": [
"Object.fs.openSync (fs.js:439:18)",
"Object.fs.readFileSync (fs.js:290:15)",
"Object.Module._extensions..js (module.js:473:44)",
"Module.load (module.js:356:32)",
"Function.Module._load (module.js:312:12)",
"Module.require (module.js:364:17)",
"require (module.js:380:17)"
]
}
On further investigation, it seems to be a permissions issue with Jenkins. I'm not entirely sure if this is directly related to the plugin (so feel free to mark as invalid), but when I added a manual step that "chmod -R" with more open permissions before the Lambda function executed, it worked.
I also filed a bug with AWS for this, so perhaps it is Lambda's issue, but it seems that the permissions on the files are lost pre-zipping.
AWS lambda supports versioning now.
Please make it available so we could publish a new version for each build.
It works well with below folder structure, and set Artifact Location to ./folderA
repoFolder
└───folderA
├───file1
└───file2
Error happens with below folder structure, and Artifact Location to ./
repoFolder
├───file1
├───file2
└───...
When using the the 'AWS Lambda publish new version and update alias' post-build action, it does not seem like the 'Use instance credentials' option is being respected. If I check this option and leave the AWS Access Key Id and AWS Secret Key blank, I am getting the following exception:
ERROR: Build step failed with exception com.amazonaws.services.lambda.model.AWSLambdaException: The security token included in the request is invalid. (Service: AWSLambda; Status Code: 403; Error Code: UnrecognizedClientException;) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1545) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1183) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:964) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:676) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:650) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:633) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$300(AmazonHttpClient.java:601) at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:583) at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:447) at com.amazonaws.services.lambda.AWSLambdaClient.doInvoke(AWSLambdaClient.java:1955) at com.amazonaws.services.lambda.AWSLambdaClient.invoke(AWSLambdaClient.java:1931) at com.amazonaws.services.lambda.AWSLambdaClient.getAlias(AWSLambdaClient.java:858) at com.xti.jenkins.plugin.awslambda.service.LambdaPublishService.publishLambda(LambdaPublishService.java:29) at com.xti.jenkins.plugin.awslambda.publish.LambdaPublisher.publish(LambdaPublisher.java:25) at com.xti.jenkins.plugin.awslambda.callable.PublishCallable.call(PublishCallable.java:39) at com.xti.jenkins.plugin.awslambda.callable.PublishCallable.call(PublishCallable.java:19) at hudson.remoting.LocalChannel.call(LocalChannel.java:45) at com.xti.jenkins.plugin.awslambda.publish.LambdaPublishPublisher.perform(LambdaPublishPublisher.java:63) Caused: java.lang.RuntimeException at com.xti.jenkins.plugin.awslambda.publish.LambdaPublishPublisher.perform(LambdaPublishPublisher.java:72) at com.xti.jenkins.plugin.awslambda.publish.LambdaPublishPublisher.perform(LambdaPublishPublisher.java:47) at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720) at hudson.model.Build$BuildExecution.post2(Build.java:186) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:665) at hudson.model.Run.execute(Run.java:1753) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:405) Build step 'AWS Lambda publish new version and update alias' marked build as failure
Also, when going back to configure the Jenkins project, the 'Use instance credentials' option is not saved.
First of all, thanks for the plugin! Works very well.
I am hosting my Jenkins server on an ec2 instance, like probably most of the people that will use this plugin. I think it would be great to leverage the IAM role assigned to the Jenkins EC2 instance to allow the plugin to deploy AWS Lambda functions.
The S3 Plugin for example, allows u to use IAM Roles. It's just a simple checkbox which will hide the Access Key and Secret Key input boxes.
Why the plugin does not invoke the lambda on failure?
Thanks.
Hi,
i'm trying to deploy lambda function using Use instance credentials option.
I have exported the AWS credentials as env variable (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY_), but i'm getting the following error during the deploy.
com.amazonaws.SdkClientException: Unable to load AWS credentials from any provider in the chain
I'm able to deploy the lambda function only by passing AWS Access Key Id and Secret explicitly or using default credentials located at ~/.aws
Any one have the same problem?
I'm using jenkins 2.73.2 with version 0.5.10 of lambda-jenkins-plugin.
Thanks.
Mattia
Is there any way, how to provide task environment into the lambda scirpt sended payload?
Something like
{"environment":"${ENVIRONMENT}"}
Hi @cast
I was wondering if it would be possible to use environment variables for the Memory and Timeout field. I guess this isn't currently possible because they are numeric?
Sam
I was thinking that it would be nice to have a separate step for creating a version and alias. I think it offers more flexibility.
It would make conditionally applying versions and aliases a lot more easier.
How could this be integraded UI-wise? Leave it open to you but this is my suggestion.
Publish version
and on for Assign Alias
. Both can be checked or unchecked independently. If Assign Alias
is checked, an input box popups up for creating the alias(es).If Publish version
and Assign Alias
are both checked, a new version is created which will be aliased by all the aliases provided in the input box (comma separated).
If only Assign Alias
is checked, the aliases will be applied to the $LATEST version.
Feedback is more then welcome :).
Seems like the plugin overrides to the default (No VPC, nor Subnets nor Security Group) when it updates code/config, so I have to manually config again these setting after each Jenkins triggered deployment.
Plugin Version: 0.5.10
Jenkins Version: 2.110
I have no idea if this is possible, but I will explain my use case.
I have two git branches (development
/production
). The development branch is the $LATEST
version as it is used for testing etc. When I push to production, it should create a new version and tag it as production
. If pushed to development
, it should just update the $LATEST
but don't create a version or tag the release.
So actually what I need is an optional "create version + tag" depending on an environment variable that I can set depending on the branch pushed to. Any idea if this would be possible to do?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.