66
77 "github.com/joho/godotenv"
88 _ "github.com/joho/godotenv/autoload"
9- "github.com/urfave/cli"
9+ "github.com/urfave/cli/v2 "
1010)
1111
1212// Version set at compile-time
@@ -24,7 +24,7 @@ func main() {
2424 app .Name = "Drone Lambda"
2525 app .Usage = "Deploying Lambda code with drone CI to an existing function"
2626 app .Copyright = "Copyright (c) 2020 Bo-Yi Wu"
27- app .Authors = []cli.Author {
27+ app .Authors = []* cli.Author {
2828 {
2929 Name : "Bo-Yi Wu" ,
3030 Email : "appleboy.tw@gmail.com" ,
@@ -33,146 +33,147 @@ func main() {
3333 app .Action = run
3434 app .Version = Version
3535 app .Flags = []cli.Flag {
36- cli.StringFlag {
37- Name : "region" ,
38- Usage : "AWS Region" ,
39- EnvVar : "PLUGIN_REGION,PLUGIN_AWS_REGION,AWS_REGION,INPUT_AWS_REGION" ,
40- Value : "us-east-1" ,
41- },
42- cli.StringFlag {
43- Name : "access-key" ,
44- Usage : "AWS ACCESS KEY" ,
45- EnvVar : "PLUGIN_ACCESS_KEY,PLUGIN_AWS_ACCESS_KEY_ID,AWS_ACCESS_KEY_ID,INPUT_AWS_ACCESS_KEY_ID" ,
46- },
47- cli.StringFlag {
48- Name : "secret-key" ,
49- Usage : "AWS SECRET KEY" ,
50- EnvVar : "PLUGIN_SECRET_KEY,PLUGIN_AWS_SECRET_ACCESS_KEY,AWS_SECRET_ACCESS_KEY,INPUT_AWS_SECRET_ACCESS_KEY" ,
51- },
52- cli.StringFlag {
53- Name : "session-token" ,
54- Usage : "AWS Session token" ,
55- EnvVar : "PLUGIN_SESSION_TOKEN,PLUGIN_AWS_SESSION_TOKEN,AWS_SESSION_TOKEN,INPUT_AWS_SESSION_TOKEN" ,
56- },
57- cli.StringFlag {
58- Name : "aws-profile" ,
59- Usage : "AWS profile" ,
60- EnvVar : "PLUGIN_PROFILE,PLUGIN_AWS_PROFILE,AWS_PROFILE,INPUT_AWS_PROFILE" ,
61- },
62- cli.StringFlag {
63- Name : "function-name" ,
64- Usage : "AWS lambda function name" ,
65- EnvVar : "PLUGIN_FUNCTION_NAME,FUNCTION_NAME,INPUT_FUNCTION_NAME" ,
66- },
67- cli.StringFlag {
68- Name : "reversion-id" ,
69- Usage : "Only update the function if the revision ID matches the ID that's specified." ,
70- EnvVar : "PLUGIN_REVERSION_ID,REVERSION_ID,INPUT_REVERSION_ID" ,
71- },
72- cli.StringFlag {
73- Name : "s3-bucket" ,
74- Usage : "An Amazon S3 bucket in the same AWS Region as your function. The bucket can be in a different AWS account." ,
75- EnvVar : "PLUGIN_S3_BUCKET,S3_BUCKET,INPUT_S3_BUCKET" ,
76- },
77- cli.StringFlag {
78- Name : "s3-key" ,
79- Usage : "The Amazon S3 key of the deployment package." ,
80- EnvVar : "PLUGIN_S3_KEY,S3_KEY,INPUT_S3_KEY" ,
81- },
82- cli.StringFlag {
83- Name : "s3-object-version" ,
84- Usage : "AWS lambda s3 object version" ,
85- EnvVar : "PLUGIN_S3_OBJECT_VERSION,S3_OBJECT_VERSION,INPUT_S3_OBJECT_VERSION" ,
86- },
87- cli.StringFlag {
88- Name : "zip-file" ,
89- Usage : "AWS lambda zip file" ,
90- EnvVar : "PLUGIN_ZIP_FILE,ZIP_FILE,INPUT_ZIP_FILE" ,
91- },
92- cli.StringSliceFlag {
93- Name : "source" ,
94- Usage : "zip file list" ,
95- EnvVar : "PLUGIN_SOURCE,SOURCE,INPUT_SOURCE" ,
96- },
97- cli.BoolFlag {
98- Name : "dry-run" ,
99- Usage : "Set to true to validate the request parameters and access permissions without modifying the function code." ,
100- EnvVar : "PLUGIN_DRY_RUN,DRY_RUN,INPUT_DRY_RUN" ,
101- },
102- cli.BoolFlag {
103- Name : "debug" ,
104- Usage : "Show debug message after upload the lambda successfully." ,
105- EnvVar : "PLUGIN_DEBUG,DEBUG,INPUT_DEBUG" ,
106- },
107- cli.BoolTFlag {
108- Name : "publish" ,
109- Usage : "Set to true to publish a new version of the function after updating the code." ,
110- EnvVar : "PLUGIN_PUBLISH,PUBLISH,INPUT_PUBLISH" ,
111- },
112- cli.Int64Flag {
113- Name : "memory-size" ,
114- Usage : "The amount of memory that your function has access to. Increasing the function's memory also increases its CPU allocation. The default value is 128 MB. The value must be a multiple of 64 MB." ,
115- EnvVar : "PLUGIN_MEMORY_SIZE,MEMORY_SIZE,INPUT_MEMORY_SIZE" ,
116- },
117- cli.Int64Flag {
118- Name : "timeout" ,
119- Usage : "The amount of time that Lambda allows a function to run before stopping it. The default is 3 seconds. The maximum allowed value is 900 seconds." ,
120- EnvVar : "PLUGIN_TIMEOUT,TIMEOUT,INPUT_TIMEOUT" ,
121- },
122- cli.StringFlag {
123- Name : "handler" ,
124- Usage : "The name of the method within your code that Lambda calls to execute your function." ,
125- EnvVar : "PLUGIN_HANDLER,HANDLER,INPUT_HANDLER" ,
126- },
127- cli.StringFlag {
128- Name : "role" ,
129- Usage : "The Amazon Resource Name (ARN) of the function's execution role." ,
130- EnvVar : "PLUGIN_ROLE,ROLE,INPUT_ROLE" ,
131- },
132- cli.StringFlag {
133- Name : "runtime" ,
134- Usage : "The identifier of the function's runtime." ,
135- EnvVar : "PLUGIN_RUNTIME,RUNTIME,INPUT_RUNTIME" ,
136- },
137- cli.StringSliceFlag {
138- Name : "environment" ,
139- Usage : "Lambda Environment variables" ,
140- EnvVar : "PLUGIN_ENVIRONMENT,ENVIRONMENT,INPUT_ENVIRONMENT" ,
141- },
142- cli.StringSliceFlag {
143- Name : "layers" ,
144- Usage : "A list of function layers" ,
145- EnvVar : "PLUGIN_LAYERS,LAYERS,INPUT_LAYERS" ,
146- },
147- cli.StringFlag {
148- Name : "commit.sha" ,
149- Usage : "git commit sha" ,
150- EnvVar : "DRONE_COMMIT_SHA,GITHUB_SHA" ,
151- },
152- cli.StringFlag {
153- Name : "commit.author" ,
154- Usage : "git author name" ,
155- EnvVar : "DRONE_COMMIT_AUTHOR" ,
156- },
157- cli.StringFlag {
158- Name : "image-uri" ,
159- Usage : "URI of a container image in the Amazon ECR registry." ,
160- EnvVar : "PLUGIN_IMAGE_URI,IMAGE_URI,INPUT_IMAGE_URI" ,
161- },
162- cli.StringSliceFlag {
163- Name : "subnets" ,
164- Usage : "Select the VPC subnets for Lambda to use to set up your VPC configuration." ,
165- EnvVar : "PLUGIN_SUBNETS,SUBNETS,INPUT_SUBNETS" ,
166- },
167- cli.StringSliceFlag {
168- Name : "securitygroups" ,
169- Usage : "Choose the VPC security groups for Lambda to use to set up your VPC configuration." ,
170- EnvVar : "PLUGIN_SECURITY_GROUPS,SECURITY_GROUPS,INPUT_SECURITY_GROUPS" ,
171- },
172- cli.StringFlag {
173- Name : "description" ,
174- Usage : "A description of the function." ,
175- EnvVar : "PLUGIN_DESCRIPTION,DESCRIPTION,INPUT_DESCRIPTION" ,
36+ & cli.StringFlag {
37+ Name : "region" ,
38+ Usage : "AWS Region" ,
39+ EnvVars : []string {"PLUGIN_REGION" , "PLUGIN_AWS_REGION" , "AWS_REGION" , "INPUT_AWS_REGION" },
40+ Value : "us-east-1" ,
41+ },
42+ & cli.StringFlag {
43+ Name : "access-key" ,
44+ Usage : "AWS ACCESS KEY" ,
45+ EnvVars : []string {"PLUGIN_ACCESS_KEY" , "PLUGIN_AWS_ACCESS_KEY_ID" , "AWS_ACCESS_KEY_ID" , "INPUT_AWS_ACCESS_KEY_ID" },
46+ },
47+ & cli.StringFlag {
48+ Name : "secret-key" ,
49+ Usage : "AWS SECRET KEY" ,
50+ EnvVars : []string {"PLUGIN_SECRET_KEY" , "PLUGIN_AWS_SECRET_ACCESS_KEY" , "AWS_SECRET_ACCESS_KEY" , "INPUT_AWS_SECRET_ACCESS_KEY" },
51+ },
52+ & cli.StringFlag {
53+ Name : "session-token" ,
54+ Usage : "AWS Session token" ,
55+ EnvVars : []string {"PLUGIN_SESSION_TOKEN" , "PLUGIN_AWS_SESSION_TOKEN" , "AWS_SESSION_TOKEN" , "INPUT_AWS_SESSION_TOKEN" },
56+ },
57+ & cli.StringFlag {
58+ Name : "aws-profile" ,
59+ Usage : "AWS profile" ,
60+ EnvVars : []string {"PLUGIN_PROFILE" , "PLUGIN_AWS_PROFILE" , "AWS_PROFILE" , "INPUT_AWS_PROFILE" },
61+ },
62+ & cli.StringFlag {
63+ Name : "function-name" ,
64+ Usage : "AWS lambda function name" ,
65+ EnvVars : []string {"PLUGIN_FUNCTION_NAME" , "FUNCTION_NAME" , "INPUT_FUNCTION_NAME" },
66+ },
67+ & cli.StringFlag {
68+ Name : "reversion-id" ,
69+ Usage : "Only update the function if the revision ID matches the ID that's specified." ,
70+ EnvVars : []string {"PLUGIN_REVERSION_ID" , "REVERSION_ID" , "INPUT_REVERSION_ID" },
71+ },
72+ & cli.StringFlag {
73+ Name : "s3-bucket" ,
74+ Usage : "An Amazon S3 bucket in the same AWS Region as your function. The bucket can be in a different AWS account." ,
75+ EnvVars : []string {"PLUGIN_S3_BUCKET" , "S3_BUCKET" , "INPUT_S3_BUCKET" },
76+ },
77+ & cli.StringFlag {
78+ Name : "s3-key" ,
79+ Usage : "The Amazon S3 key of the deployment package." ,
80+ EnvVars : []string {"PLUGIN_S3_KEY" , "S3_KEY" , "INPUT_S3_KEY" },
81+ },
82+ & cli.StringFlag {
83+ Name : "s3-object-version" ,
84+ Usage : "AWS lambda s3 object version" ,
85+ EnvVars : []string {"PLUGIN_S3_OBJECT_VERSION" , "S3_OBJECT_VERSION" , "INPUT_S3_OBJECT_VERSION" },
86+ },
87+ & cli.StringFlag {
88+ Name : "zip-file" ,
89+ Usage : "AWS lambda zip file" ,
90+ EnvVars : []string {"PLUGIN_ZIP_FILE" , "ZIP_FILE" , "INPUT_ZIP_FILE" },
91+ },
92+ & cli.StringSliceFlag {
93+ Name : "source" ,
94+ Usage : "zip file list" ,
95+ EnvVars : []string {"PLUGIN_SOURCE" , "SOURCE" , "INPUT_SOURCE" },
96+ },
97+ & cli.BoolFlag {
98+ Name : "dry-run" ,
99+ Usage : "Set to true to validate the request parameters and access permissions without modifying the function code." ,
100+ EnvVars : []string {"PLUGIN_DRY_RUN" , "DRY_RUN" , "INPUT_DRY_RUN" },
101+ },
102+ & cli.BoolFlag {
103+ Name : "debug" ,
104+ Usage : "Show debug message after upload the lambda successfully." ,
105+ EnvVars : []string {"PLUGIN_DEBUG" , "DEBUG" , "INPUT_DEBUG" },
106+ },
107+ & cli.BoolFlag {
108+ Name : "publish" ,
109+ Usage : "Set to true to publish a new version of the function after updating the code." ,
110+ EnvVars : []string {"PLUGIN_PUBLISH" , "PUBLISH" , "INPUT_PUBLISH" },
111+ Value : true ,
112+ },
113+ & cli.Int64Flag {
114+ Name : "memory-size" ,
115+ Usage : "The amount of memory that your function has access to. Increasing the function's memory also increases its CPU allocation. The default value is 128 MB. The value must be a multiple of 64 MB." ,
116+ EnvVars : []string {"PLUGIN_MEMORY_SIZE" , "MEMORY_SIZE" , "INPUT_MEMORY_SIZE" },
117+ },
118+ & cli.Int64Flag {
119+ Name : "timeout" ,
120+ Usage : "The amount of time that Lambda allows a function to run before stopping it. The default is 3 seconds. The maximum allowed value is 900 seconds." ,
121+ EnvVars : []string {"PLUGIN_TIMEOUT" , "TIMEOUT" , "INPUT_TIMEOUT" },
122+ },
123+ & cli.StringFlag {
124+ Name : "handler" ,
125+ Usage : "The name of the method within your code that Lambda calls to execute your function." ,
126+ EnvVars : []string {"PLUGIN_HANDLER" , "HANDLER" , "INPUT_HANDLER" },
127+ },
128+ & cli.StringFlag {
129+ Name : "role" ,
130+ Usage : "The Amazon Resource Name (ARN) of the function's execution role." ,
131+ EnvVars : []string {"PLUGIN_ROLE" , "ROLE" , "INPUT_ROLE" },
132+ },
133+ & cli.StringFlag {
134+ Name : "runtime" ,
135+ Usage : "The identifier of the function's runtime." ,
136+ EnvVars : []string {"PLUGIN_RUNTIME" , "RUNTIME" , "INPUT_RUNTIME" },
137+ },
138+ & cli.StringSliceFlag {
139+ Name : "environment" ,
140+ Usage : "Lambda Environment variables" ,
141+ EnvVars : []string {"PLUGIN_ENVIRONMENT" , "ENVIRONMENT" , "INPUT_ENVIRONMENT" },
142+ },
143+ & cli.StringSliceFlag {
144+ Name : "layers" ,
145+ Usage : "A list of function layers" ,
146+ EnvVars : []string {"PLUGIN_LAYERS" , "LAYERS" , "INPUT_LAYERS" },
147+ },
148+ & cli.StringFlag {
149+ Name : "commit.sha" ,
150+ Usage : "git commit sha" ,
151+ EnvVars : []string {"DRONE_COMMIT_SHA" , "GITHUB_SHA" },
152+ },
153+ & cli.StringFlag {
154+ Name : "commit.author" ,
155+ Usage : "git author name" ,
156+ EnvVars : []string {"DRONE_COMMIT_AUTHOR" },
157+ },
158+ & cli.StringFlag {
159+ Name : "image-uri" ,
160+ Usage : "URI of a container image in the Amazon ECR registry." ,
161+ EnvVars : []string {"PLUGIN_IMAGE_URI" , "IMAGE_URI" , "INPUT_IMAGE_URI" },
162+ },
163+ & cli.StringSliceFlag {
164+ Name : "subnets" ,
165+ Usage : "Select the VPC subnets for Lambda to use to set up your VPC configuration." ,
166+ EnvVars : []string {"PLUGIN_SUBNETS" , "SUBNETS" , "INPUT_SUBNETS" },
167+ },
168+ & cli.StringSliceFlag {
169+ Name : "securitygroups" ,
170+ Usage : "Choose the VPC security groups for Lambda to use to set up your VPC configuration." ,
171+ EnvVars : []string {"PLUGIN_SECURITY_GROUPS" , "SECURITY_GROUPS" , "INPUT_SECURITY_GROUPS" },
172+ },
173+ & cli.StringFlag {
174+ Name : "description" ,
175+ Usage : "A description of the function." ,
176+ EnvVars : []string {"PLUGIN_DESCRIPTION" , "DESCRIPTION" , "INPUT_DESCRIPTION" },
176177 },
177178 }
178179
0 commit comments