Skip to content

Commit 5a3689b

Browse files
authored
add more debug log in lambda layer signing step (#601)
*Issue #, if available:* In previous releasing, the lambda layer is not signed successfully. ``` Completed 37.4 MiB/38.4 MiB (36.9 MiB/s) with 1 file(s) remaining Completed 38.4 MiB/38.4 MiB (37.8 MiB/s) with 1 file(s) remaining upload: ./aws-opentelemetry-java-layer.zip to s3://java-lambda-layer-21528163844-us-east-1/aws-opentelemetry-java-layer.zip Checking for signing profile... Starting signing job... ``` *Description of changes:* Adding more debug log for github release workflow, logging the error of layer signing step. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent 2bd457d commit 5a3689b

1 file changed

Lines changed: 39 additions & 12 deletions

File tree

.github/workflows/release-build.yml

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ env:
2323
# Legacy list of commercial regions to deploy to. New regions should NOT be added here, and instead should be added to the `aws_region` default input to the workflow.
2424
LEGACY_COMMERCIAL_REGIONS: us-east-1, us-east-2, us-west-1, us-west-2, ap-south-1, ap-northeast-3, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-northeast-1, ca-central-1, eu-central-1, eu-west-1, eu-west-2, eu-west-3, eu-north-1, sa-east-1
2525
LAYER_NAME: AWSOpenTelemetryDistroPython
26+
LAYER_ARTIFACT_NAME: aws-opentelemetry-python-layer.zip
2627
VERSION: ${{ github.event.inputs.version }}
2728

2829
permissions:
@@ -116,7 +117,7 @@ jobs:
116117
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2
117118
with:
118119
name: layer.zip
119-
path: lambda-layer/src/build/aws-opentelemetry-python-layer.zip
120+
path: lambda-layer/src/build/${{ env.LAYER_ARTIFACT_NAME }}
120121

121122
publish-sdk:
122123
needs: [build-sdk, build-layer]
@@ -247,31 +248,57 @@ jobs:
247248
continue-on-error: true
248249
run: |
249250
aws s3 mb s3://${{ env.BUCKET_NAME }}
250-
aws s3 cp aws-opentelemetry-python-layer.zip s3://${{ env.BUCKET_NAME }}
251+
aws s3 cp ${{ env.LAYER_ARTIFACT_NAME }} s3://${{ env.BUCKET_NAME }}
251252
252253
# Sign the layer
253254
echo "Checking for signing profile..."
254255
PROFILE=$(aws signer list-signing-profiles --query "profiles[?profileName=='ADOTLambdaLayerSigningProfile'].arn" --output text 2>/dev/null)
255256
[ -z "$PROFILE" ] && echo "No signing profile found, skipping" && exit 0
256-
257+
258+
echo "PROFILE is: $PROFILE"
259+
257260
echo "Starting signing job..."
258-
JOB_ID=$(aws signer start-signing-job \
259-
--source "s3={bucketName=${{ env.BUCKET_NAME }},key=aws-opentelemetry-python-layer.zip,version=null}" \
261+
# Capture both stdout and stderr to properly handle errors
262+
SIGNING_OUTPUT=$(aws signer start-signing-job \
263+
--source "s3={bucketName=${{ env.BUCKET_NAME }},key=${{ env.LAYER_ARTIFACT_NAME }},version=null}" \
260264
--destination "s3={bucketName=${{ env.BUCKET_NAME }},prefix=signed-}" \
261265
--profile-name ADOTLambdaLayerSigningProfile \
262-
--query 'jobId' --output text 2>/dev/null) || exit 0
266+
--query 'jobId' --output text 2>&1)
267+
SIGNING_EXIT_CODE=$?
268+
269+
if [ $SIGNING_EXIT_CODE -ne 0 ]; then
270+
echo "Signing job failed with exit code $SIGNING_EXIT_CODE"
271+
echo "Error output: $SIGNING_OUTPUT"
272+
exit 0 # Continue workflow but log the failure
273+
fi
274+
275+
JOB_ID="$SIGNING_OUTPUT"
263276
[ -z "$JOB_ID" ] && echo "No job ID returned" && exit 0
264277
echo "Job ID: $JOB_ID"
265-
278+
266279
echo "Waiting for signing job to complete..."
267-
aws signer wait successful-signing-job --job-id "$JOB_ID" || exit 0
280+
if ! aws signer wait successful-signing-job --job-id "$JOB_ID" 2>&1; then
281+
echo "Warning: Signing job wait failed or timed out"
282+
exit 0
283+
fi
268284
echo "Signing completed"
269285
270286
echo "Moving signed layer..."
271-
SIGNED=$(aws signer describe-signing-job --job-id "$JOB_ID" --query 'signedObject.s3.key' --output text 2>/dev/null)
287+
SIGNED=$(aws signer describe-signing-job --job-id "$JOB_ID" --query 'signedObject.s3.key' --output text 2>&1)
288+
DESCRIBE_EXIT_CODE=$?
289+
290+
if [ $DESCRIBE_EXIT_CODE -ne 0 ]; then
291+
echo "Warning: Failed to describe signing job"
292+
echo "Error: $SIGNED"
293+
exit 0
294+
fi
295+
272296
echo "SIGNED value: '$SIGNED'"
273297
if [ -n "$SIGNED" ]; then
274-
aws s3 mv "s3://${{ env.BUCKET_NAME }}/$SIGNED" "s3://${{ env.BUCKET_NAME }}/aws-opentelemetry-python-layer.zip --clobber"
298+
# Delete the original unsigned file first
299+
aws s3 rm "s3://${{ env.BUCKET_NAME }}/${{ env.LAYER_ARTIFACT_NAME }}"
300+
# Move the signed file to replace it
301+
aws s3 mv "s3://${{ env.BUCKET_NAME }}/$SIGNED" "s3://${{ env.BUCKET_NAME }}/${{ env.LAYER_ARTIFACT_NAME }}"
275302
echo "Signed layer moved successfully"
276303
else
277304
echo "No SIGNED value returned, skipping move"
@@ -282,7 +309,7 @@ jobs:
282309
layerARN=$(
283310
aws lambda publish-layer-version \
284311
--layer-name ${{ env.LAYER_NAME }} \
285-
--content S3Bucket=${{ env.BUCKET_NAME }},S3Key=aws-opentelemetry-python-layer.zip \
312+
--content S3Bucket=${{ env.BUCKET_NAME }},S3Key=${{ env.LAYER_ARTIFACT_NAME }} \
286313
--compatible-runtimes python3.10 python3.11 python3.12 python3.13 \
287314
--compatible-architectures "arm64" "x86_64" \
288315
--license-info "Apache-2.0" \
@@ -409,7 +436,7 @@ jobs:
409436

410437
- name: Rename layer file
411438
run: |
412-
cp aws-opentelemetry-python-layer.zip layer.zip
439+
cp ${{ env.LAYER_ARTIFACT_NAME }} layer.zip
413440
414441
# Publish to GitHub releases
415442
- name: Create GH release

0 commit comments

Comments
 (0)