Skip to content

Commit a82c40a

Browse files
authored
Add sign-public-ecr-image job to release workflow (#1363)
## Summary Backports the `sign-public-ecr-image` job from [aws-otel-python-instrumentation release/v0.14.x](https://github.com/aws-observability/aws-otel-python-instrumentation/blob/release/v0.14.x/.github/workflows/release-build.yml) to the Java instrumentation release workflow. ## Changes Added `sign-public-ecr-image` job in `.github/workflows/release-build.yml` that: 1. Configures AWS credentials using `AWS_ASSUME_ROLE_ARN_RELEASE` 2. Installs notation CLI with AWS Signer plugin 3. Queries `ADOTECRSigningProfile` signing profile ARN (gracefully skips if not found) 4. Logs in to public ECR and signs the released image `PUBLIC_REPOSITORY:v$VERSION` The job runs after `publish-sdk` which pushes the multi-arch image to public ECR.
1 parent 75cec07 commit a82c40a

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

.github/workflows/release-build.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,3 +508,53 @@ jobs:
508508
${{ env.ARTIFACT_NAME }}.sha256 \
509509
layer.zip \
510510
layer.zip.sha256
511+
512+
sign-public-ecr-image:
513+
runs-on: ubuntu-latest
514+
needs: publish-sdk
515+
steps:
516+
- name: Configure AWS Credentials for public ECR
517+
uses: aws-actions/configure-aws-credentials@a03048d87541d1d9fcf2ecf528a4a65ba9bd7838 #v5.0.0
518+
with:
519+
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN_RELEASE }}
520+
aws-region: ${{ env.AWS_PUBLIC_ECR_REGION }}
521+
522+
# Install notation CLI with AWS Signer plugin
523+
- name: Install notation CLI with AWS Signer plugin
524+
run: |
525+
curl -Lo aws-signer-notation-cli_amd64.deb https://d2hvyiie56hcat.cloudfront.net/linux/amd64/installer/deb/latest/aws-signer-notation-cli_amd64.deb
526+
sudo dpkg -i aws-signer-notation-cli_amd64.deb
527+
notation version
528+
notation plugin ls
529+
530+
# Query ECR signing profile ARN
531+
- name: Query ECR Signing Profile ARN
532+
id: ecr-signing-profile
533+
run: |
534+
PROFILE_ARN=$(aws signer list-signing-profiles --region ${{ env.AWS_PUBLIC_ECR_REGION }} --query "profiles[?profileName=='ADOTECRSigningProfile'].arn" --output text 2>/dev/null)
535+
if [ -n "$PROFILE_ARN" ]; then
536+
echo "profile_arn=$PROFILE_ARN" >> $GITHUB_OUTPUT
537+
echo "Found ECR signing profile: $PROFILE_ARN"
538+
else
539+
echo "ECR signing profile 'ADOTECRSigningProfile' not found"
540+
exit 0
541+
fi
542+
543+
# Login to Public ECR
544+
- name: Log in to AWS public ECR
545+
if: steps.ecr-signing-profile.outputs.profile_arn != ''
546+
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 #v3.5.0
547+
with:
548+
registry: public.ecr.aws
549+
550+
# Sign Public ECR Image
551+
- name: Sign Public ECR Image
552+
if: steps.ecr-signing-profile.outputs.profile_arn != ''
553+
run: |
554+
# Sign the released public ECR image
555+
notation sign ${{ env.PUBLIC_REPOSITORY }}:v${{ env.VERSION }} \
556+
--plugin com.amazonaws.signer.notation.plugin \
557+
--id ${{ steps.ecr-signing-profile.outputs.profile_arn }}
558+
echo "Successfully signed public ECR image"
559+
echo "Image: ${{ env.PUBLIC_REPOSITORY }}:v${{ env.VERSION }}"
560+
echo "Profile ARN: ${{ steps.ecr-signing-profile.outputs.profile_arn }}"

0 commit comments

Comments
 (0)