Skip to content

S3 upload for function upload, LAMBDA_TASK_ROOT for lambda_invoke task #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,31 @@ grunt.initConfig({
You could then run `grunt lambda_package lambda_deploy` and it'll automatically create the package and deploy it without
having to specify a package name.

##### options.deploy_mode
Type: `String`
Default value: `zip`

Can be `zip` or `s3`. Determines how the code will be uploaded to lambda - via direct upload or via S3. For larger archives,
S3 may be more suitable.

##### options.S3bucketName
Type: `String`
Default value: `null`

Mandatory if `options.deploy_mode='s3'`. S3 bucket to upload code archive to.

##### options.S3Prefix
Type: `String`
Default value: ``

Used only for `options.deploy_mode='s3'`. S3 bucket prefix to be used when uploading code archive.

##### options.S3MultiUploadPartSize
Type: `String`
Default value `5mb`

For larger archives, determines chunk size for s3 multi-upload. Minimum value is '5mb'.

##### options.profile
Type: `String`
Default value: `null`
Expand Down
107 changes: 54 additions & 53 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,55 +1,56 @@
{
"name": "grunt-aws-lambda",
"description": "A grunt plugin to help develop AWS Lambda functions.",
"version": "0.13.0",
"homepage": "https://github.com/Tim-B/grunt-aws-lambda",
"author": {
"name": "Tim-B",
"email": "[email protected]"
},
"repository": {
"type": "git",
"url": "git://github.com/Tim-B/grunt-aws-lambda.git"
},
"bugs": {
"url": "https://github.com/Tim-B/grunt-aws-lambda/issues"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/Tim-B/grunt-aws-lambda/blob/master/LICENSE-MIT"
}
],
"engines": {
"node": ">= 0.8.0"
},
"scripts": {
"test": "grunt"
},
"dependencies": {
"temporary": "~0.0.8",
"archiver": "~0.14.4",
"mkdirp": "~0.5.0",
"rimraf": "~2.2.8",
"glob": "~4.3.0",
"aws-sdk": "~2.2.32",
"proxy-agent": "latest",
"npm": "^2.10.0",
"q": "^1.4.1"
},
"devDependencies": {
"grunt-contrib-jshint": "^0.9.2",
"grunt-contrib-clean": "^0.5.0",
"grunt-contrib-nodeunit": "^0.3.3",
"mockery": "^1.4.0",
"grunt": "~0.4.5",
"adm-zip": "~0.4.4",
"sinon": "^1.17.3"
},
"peerDependencies": {
"grunt": ">=0.4.0"
},
"keywords": [
"gruntplugin"
]
"name": "grunt-aws-lambda",
"description": "A grunt plugin to help develop AWS Lambda functions.",
"version": "0.13.0",
"homepage": "https://github.com/Tim-B/grunt-aws-lambda",
"author": {
"name": "Tim-B",
"email": "[email protected]"
},
"repository": {
"type": "git",
"url": "git://github.com/Tim-B/grunt-aws-lambda.git"
},
"bugs": {
"url": "https://github.com/Tim-B/grunt-aws-lambda/issues"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/Tim-B/grunt-aws-lambda/blob/master/LICENSE-MIT"
}
],
"engines": {
"node": ">= 0.8.0"
},
"scripts": {
"test": "grunt"
},
"dependencies": {
"archiver": "~0.14.4",
"aws-sdk": "~2.2.32",
"bytes": "^2.4.0",
"glob": "~4.3.0",
"mkdirp": "~0.5.0",
"npm": "^2.10.0",
"proxy-agent": "latest",
"q": "^1.4.1",
"rimraf": "~2.2.8",
"temporary": "~0.0.8"
},
"devDependencies": {
"grunt-contrib-jshint": "^0.9.2",
"grunt-contrib-clean": "^0.5.0",
"grunt-contrib-nodeunit": "^0.3.3",
"mockery": "^1.4.0",
"grunt": "~0.4.5",
"adm-zip": "~0.4.4",
"sinon": "^1.17.3"
},
"peerDependencies": {
"grunt": ">=0.4.0"
},
"keywords": [
"gruntplugin"
]
}
16 changes: 13 additions & 3 deletions test/unit/deploy_task_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ var deployTaskTest = {};

var awsSDKMock,
lambdaAPIMock,
s3APIMock,
defaultGruntConfig,
proxyAgentMock;

Expand Down Expand Up @@ -70,6 +71,14 @@ deployTaskTest.setUp = function(done) {
updateAlias: sinon.stub().callsArgWithAsync(1, null, {})
};

s3APIMock = {
ManagedUpload : function(params){
return {
send : sinon.stub(),
};
}
};

awsSDKMock = {
SharedIniFileCredentials: sinon.stub(),
EC2MetadataCredentials: sinon.stub(),
Expand All @@ -80,9 +89,10 @@ deployTaskTest.setUp = function(done) {
},
Lambda: function(params) {
return lambdaAPIMock;
}
},
S3: s3APIMock
};

proxyAgentMock = sinon.spy();

fsMock.reset();
Expand All @@ -91,7 +101,7 @@ deployTaskTest.setUp = function(done) {
fsMock.setFileContent('some-package.zip', 'abc123');

mockery.registerMock('aws-sdk', awsSDKMock);

mockery.registerMock('proxy-agent', proxyAgentMock);

var dateFacadeMock = {
Expand Down
Loading