Skip to content

Commit cea2d4d

Browse files
committed
fix snapStart config issue
1 parent d50a812 commit cea2d4d

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

.github/workflows/buildAndDeployLambda.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
type: choice
88
description: 'What runtime to use?'
99
required: true
10-
default: 'graalvm'
10+
default: 'custom native-package'
1111
options:
1212
- 'custom native-package'
1313
- 'custom assembly'
@@ -24,6 +24,7 @@ on:
2424

2525
env:
2626
AWS_CLIENT_DEBUG_MODE: ON
27+
default-runtime: 'custom native-package'
2728

2829
permissions:
2930
id-token: write # This is required for requesting the JWT
@@ -52,19 +53,19 @@ jobs:
5253
- name: Show changelog
5354
run: echo "CHANGELOG=$(git log --pretty='%h %al %B' ${{ github.event.before }}..${{ github.sha }})" | tr -d "\n\r\'" | cut -c -256 >> "$GITHUB_ENV"
5455
- name: Run the script (custom runtime with native-package)
55-
if: ${{ github.event_name == 'push' || inputs.runtime == 'custom native-package' }}
56+
if: ${{ (github.event_name == 'push' && env.default-runtime == 'custom native-package') || inputs.runtime == 'custom native-package' }}
5657
run: ./scripts/buildAndDeployLambdaNativePackage.sh 64m '${{ env.CHANGELOG }}'
5758
shell: bash
5859
- name: Run the script (custom runtime with assembly.jar)
59-
if: ${{ inputs.runtime == 'custom assembly' }}
60+
if: ${{ (github.event_name == 'push' && env.default-runtime == 'custom assembly') || inputs.runtime == 'custom assembly' }}
6061
run: ./scripts/buildAndDeployLambdaAssembly.sh '${{ env.CHANGELOG }}' 'assembly'
6162
shell: bash
6263
- name: Run the script (java21 runtime without snapstart)
63-
if: ${{ inputs.runtime == 'java21 pure' }}
64+
if: ${{ (github.event_name == 'push' && env.default-runtime == 'java21 pure') || inputs.runtime == 'java21 pure' }}
6465
run: ./scripts/buildAndDeployLambdaAssembly.sh '${{ env.CHANGELOG }}' 'pure'
6566
shell: bash
6667
- name: Run the script (java21 runtime with snapstart)
67-
if: ${{ inputs.runtime == 'java21 snapstart' }}
68+
if: ${{ (github.event_name == 'push' && env.default-runtime == 'java21 snapstart') || inputs.runtime == 'java21 snapstart' }}
6869
run: ./scripts/buildAndDeployLambdaAssembly.sh '${{ env.CHANGELOG }}' 'snapstart'
6970
shell: bash
7071

scripts/deployLambda.sc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,16 @@ val memorySize: Option[Int] =
5757
val timeout: Option[Int] =
5858
optionalScriptParameter('t', "timeout")(args).flatMap(_.toIntOption)
5959

60-
val snapStart: Option[SnapStart] =
60+
val snapStart: SnapStart =
6161
optionalScriptParameter('j', "javastart")(args)
6262
.flatMap {
6363
case "snapstart" => Some(SnapStart.builder().applyOn(SnapStartApplyOn.PUBLISHED_VERSIONS).build())
6464
case "pure" => Some(SnapStart.builder().applyOn(SnapStartApplyOn.NONE).build())
6565
case _ => None
6666
}
67+
.getOrElse(
68+
SnapStart.builder().applyOn(SnapStartApplyOn.NONE).build()
69+
)
6770

6871
if (!os.exists(lambdaDeploymentConfigPath)) {
6972
println(
@@ -143,7 +146,7 @@ if (function.codeSha256() == checksumSHA256) then {
143146
|| handler.orElse(config.handler).exists(_ != function.handler())
144147
|| memorySize.orElse(config.memorySize).map(Integer.valueOf).exists(_ != function.memorySize())
145148
|| timeout.orElse(config.timeout).map(Integer.valueOf).exists(_ != function.timeout())
146-
|| snapStart != function.snapStart()
149+
|| snapStart.applyOn() != function.snapStart().applyOn()
147150
)
148151
then
149152
AwsLambdaApi.updateFunctionConfiguration(

0 commit comments

Comments
 (0)