Skip to content

Commit eb70588

Browse files
committed
chore: support update layers
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
1 parent ca2cf5a commit eb70588

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

‎main.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ func main() {
139139
Usage: "Lambda Environment variables",
140140
EnvVar: "PLUGIN_ENVIRONMENT,ENVIRONMENT,INPUT_ENVIRONMENT",
141141
},
142+
cli.StringSliceFlag{
143+
Name: "layers",
144+
Usage: "A list of function layers",
145+
EnvVar: "PLUGIN_LAYERS,LAYERS,INPUT_LAYERS",
146+
},
142147
cli.StringFlag{
143148
Name: "commit.sha",
144149
Usage: "git commit sha",
@@ -199,6 +204,7 @@ func run(c *cli.Context) error {
199204
Role: c.String("role"),
200205
Runtime: c.String("runtime"),
201206
Environment: c.StringSlice("environment"),
207+
Layers: c.StringSlice("layers"),
202208
ImageURI: c.String("image-uri"),
203209
Subnets: c.StringSlice("subnets"),
204210
SecurityGroups: c.StringSlice("securitygroups"),

‎plugin.go‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ type (
4343
Subnets []string
4444
SecurityGroups []string
4545
Description string
46+
Layers []string
4647
}
4748

4849
// Commit information.
@@ -191,6 +192,14 @@ func (p Plugin) Exec() error {
191192
isUpdateConfig = true
192193
cfg.SetDescription(p.Config.Description)
193194
}
195+
if len(p.Config.Layers) > 0 {
196+
isUpdateConfig = true
197+
var layers []*string
198+
for _, v := range p.Config.Layers {
199+
layers = append(layers, aws.String(v))
200+
}
201+
cfg.SetLayers(layers)
202+
}
194203

195204
envs := trimValues(p.Config.Environment)
196205
if len(envs) > 0 {

0 commit comments

Comments
 (0)
⌂ 换网址