Skip to content

Commit 901acee

Browse files
authored
Add sign-public-ecr-image job to release workflow (#1362)
## 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 3b291db commit 901acee

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
@@ -528,3 +528,53 @@ jobs:
528528
${{ env.ARTIFACT_NAME }}.sha256 \
529529
layer.zip \
530530
layer.zip.sha256
531+
532+
sign-public-ecr-image:
533+
runs-on: ubuntu-latest
534+
needs: publish-sdk
535+
steps:
536+
- name: Configure AWS Credentials for public ECR
537+
uses: aws-actions/configure-aws-credentials@a03048d87541d1d9fcf2ecf528a4a65ba9bd7838 #v5.0.0
538+
with:
539+
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN_RELEASE }}
540+
aws-region: ${{ env.AWS_PUBLIC_ECR_REGION }}
541+
542+
# Install notation CLI with AWS Signer plugin
543+
- name: Install notation CLI with AWS Signer plugin
544+
run: |
545+
curl -Lo aws-signer-notation-cli_amd64.deb https://d2hvyiie56hcat.cloudfront.net/linux/amd64/installer/deb/latest/aws-signer-notation-cli_amd64.deb
546+
sudo dpkg -i aws-signer-notation-cli_amd64.deb
547+
notation version
548+
notation plugin ls
549+
550+
# Query ECR signing profile ARN
551+
- name: Query ECR Signing Profile ARN
552+
id: ecr-signing-profile
553+
run: |
554+
PROFILE_ARN=$(aws signer list-signing-profiles --region ${{ env.AWS_PUBLIC_ECR_REGION }} --query "profiles[?profileName=='ADOTECRSigningProfile'].arn" --output text 2>/dev/null)
555+
if [ -n "$PROFILE_ARN" ]; then
556+
echo "profile_arn=$PROFILE_ARN" >> $GITHUB_OUTPUT
557+
echo "Found ECR signing profile: $PROFILE_ARN"
558+
else
559+
echo "ECR signing profile 'ADOTECRSigningProfile' not found"
560+
exit 0
561+
fi
562+
563+
# Login to Public ECR
564+
- name: Log in to AWS public ECR
565+
if: steps.ecr-signing-profile.outputs.profile_arn != ''
566+
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 #v3.5.0
567+
with:
568+
registry: public.ecr.aws
569+
570+
# Sign Public ECR Image
571+
- name: Sign Public ECR Image
572+
if: steps.ecr-signing-profile.outputs.profile_arn != ''
573+
run: |
574+
# Sign the released public ECR image
575+
notation sign ${{ env.PUBLIC_REPOSITORY }}:v${{ env.VERSION }} \
576+
--plugin com.amazonaws.signer.notation.plugin \
577+
--id ${{ steps.ecr-signing-profile.outputs.profile_arn }}
578+
echo "Successfully signed public ECR image"
579+
echo "Image: ${{ env.PUBLIC_REPOSITORY }}:v${{ env.VERSION }}"
580+
echo "Profile ARN: ${{ steps.ecr-signing-profile.outputs.profile_arn }}"

0 commit comments

Comments
 (0)