Skip to content

Commit

Permalink
Added provided.al2023 as a bootstrap runtime (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderwink authored Jan 2, 2024
1 parent 486816c commit f931994
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const ConfigDefaults = {
};

// amazonProvidedRuntimes contains Amazon Linux runtimes. Update this array after each new version release.
const amazonProvidedRuntimes = ["provided.al2"];
const amazonProvidedRuntimes = ["provided.al2", "provided.al2023"];

module.exports = class Plugin {
constructor(serverless, options) {
Expand Down
25 changes: 23 additions & 2 deletions index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ describe("Go Plugin", () => {
service: {
custom: {
go: {
supportedRuntimes: ["go1.x", "provided.al2"],
supportedRuntimes: ["go1.x", "provided.al2", "provided.al2023"],
},
},
functions: {
Expand All @@ -108,6 +108,11 @@ describe("Go Plugin", () => {
runtime: "go1.x",
handler: "functions/func2/main.go",
},
testFunc3: {
name: "testFunc3",
runtime: "provided.al2023",
handler: "functions/func3/main.go",
},
},
},
},
Expand All @@ -131,6 +136,12 @@ describe("Go Plugin", () => {
expect(execStub).to.have.been.calledWith(
`go build -ldflags="-s -w" -o .bin/testFunc1 functions/func1/main.go`
);
expect(config.service.functions.testFunc3.handler).to.equal(
`.bin/testFunc3`
);
expect(execStub).to.have.been.calledWith(
`go build -ldflags="-s -w" -o .bin/testFunc3 functions/func3/main.go`
);
});

it("compiles Go function w/ custom command", async () => {
Expand Down Expand Up @@ -398,7 +409,7 @@ describe("Go Plugin", () => {
service: {
custom: {
go: {
supportedRuntimes: ["go1.x", "provided.al2"],
supportedRuntimes: ["go1.x", "provided.al2", "provided.al2023"],
buildProvidedRuntimeAsBootstrap: true,
},
},
Expand All @@ -413,6 +424,11 @@ describe("Go Plugin", () => {
runtime: "go1.x",
handler: "functions/func1/main.go",
},
testFunc3: {
name: "testFunc3",
runtime: "provided.al2023",
handler: "functions/func1",
},
},
},
},
Expand All @@ -434,6 +450,11 @@ describe("Go Plugin", () => {
exclude: ["./**"],
include: [".bin/testFunc2"],
});

expect(config.service.functions.testFunc3.package).to.deep.equal({
individually: true,
artifact: ".bin/testFunc3.zip",
});
});
});

Expand Down

0 comments on commit f931994

Please sign in to comment.