|
10 | 10 | description: 'Deploy to aws regions' |
11 | 11 | required: true |
12 | 12 | default: '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, af-south-1, ap-east-1, ap-south-2, ap-southeast-3, ap-southeast-4, eu-central-2, eu-south-1, eu-south-2, il-central-1, me-central-1, me-south-1, ap-southeast-5, ap-southeast-7, mx-central-1, ca-west-1, cn-north-1, cn-northwest-1' |
| 13 | + push: |
| 14 | + branches: |
| 15 | + zhaez/patch-1 |
13 | 16 |
|
14 | 17 | env: |
15 | 18 | # 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. |
@@ -57,92 +60,92 @@ jobs: |
57 | 60 | with: |
58 | 61 | name: layer.zip |
59 | 62 | path: lambda-layer/src/build/aws-opentelemetry-python-layer.zip |
60 | | - publish-prod: |
61 | | - runs-on: ubuntu-latest |
62 | | - needs: build-layer |
63 | | - strategy: |
64 | | - matrix: |
65 | | - aws_region: ${{ fromJson(needs.build-layer.outputs.aws_regions_json) }} |
66 | | - steps: |
67 | | - - name: role arn |
68 | | - env: |
69 | | - LEGACY_COMMERCIAL_REGIONS: ${{ env.LEGACY_COMMERCIAL_REGIONS }} |
70 | | - run: | |
71 | | - LEGACY_COMMERCIAL_REGIONS_ARRAY=(${LEGACY_COMMERCIAL_REGIONS//,/ }) |
72 | | - FOUND=false |
73 | | - for REGION in "${LEGACY_COMMERCIAL_REGIONS_ARRAY[@]}"; do |
74 | | - if [[ "$REGION" == "${{ matrix.aws_region }}" ]]; then |
75 | | - FOUND=true |
76 | | - break |
77 | | - fi |
78 | | - done |
79 | | - if [ "$FOUND" = true ]; then |
80 | | - echo "Found ${{ matrix.aws_region }} in LEGACY_COMMERCIAL_REGIONS" |
81 | | - SECRET_KEY="LAMBDA_LAYER_RELEASE" |
82 | | - else |
83 | | - echo "Not found ${{ matrix.aws_region }} in LEGACY_COMMERCIAL_REGIONS" |
84 | | - SECRET_KEY="${{ matrix.aws_region }}_LAMBDA_LAYER_RELEASE" |
85 | | - fi |
86 | | - SECRET_KEY=${SECRET_KEY//-/_} |
87 | | - echo "SECRET_KEY=${SECRET_KEY}" >> $GITHUB_ENV |
88 | | - - uses: aws-actions/configure-aws-credentials@v4.0.2 |
89 | | - with: |
90 | | - role-to-assume: ${{ secrets[env.SECRET_KEY] }} |
91 | | - role-duration-seconds: 1200 |
92 | | - aws-region: ${{ matrix.aws_region }} |
93 | | - - name: Get s3 bucket name for release |
94 | | - run: | |
95 | | - echo BUCKET_NAME=python-lambda-layer-${{ github.run_id }}-${{ matrix.aws_region }} | tee --append $GITHUB_ENV |
96 | | - - name: download layer.zip |
97 | | - uses: actions/download-artifact@v4 |
98 | | - with: |
99 | | - name: layer.zip |
100 | | - - name: publish |
101 | | - run: | |
102 | | - aws s3 mb s3://${{ env.BUCKET_NAME }} |
103 | | - aws s3 cp aws-opentelemetry-python-layer.zip s3://${{ env.BUCKET_NAME }} |
104 | | - layerARN=$( |
105 | | - aws lambda publish-layer-version \ |
106 | | - --layer-name ${{ env.LAYER_NAME }} \ |
107 | | - --content S3Bucket=${{ env.BUCKET_NAME }},S3Key=aws-opentelemetry-python-layer.zip \ |
108 | | - --compatible-runtimes python3.10 python3.11 python3.12 python3.13 \ |
109 | | - --compatible-architectures "arm64" "x86_64" \ |
110 | | - --license-info "Apache-2.0" \ |
111 | | - --description "AWS Distro of OpenTelemetry Lambda Layer for Python Runtime" \ |
112 | | - --query 'LayerVersionArn' \ |
113 | | - --output text |
114 | | - ) |
115 | | - echo $layerARN |
116 | | - echo "LAYER_ARN=${layerARN}" >> $GITHUB_ENV |
117 | | - mkdir ${{ env.LAYER_NAME }} |
118 | | - echo $layerARN > ${{ env.LAYER_NAME }}/${{ matrix.aws_region }} |
119 | | - cat ${{ env.LAYER_NAME }}/${{ matrix.aws_region }} |
120 | | - - name: public layer |
121 | | - run: | |
122 | | - layerVersion=$( |
123 | | - aws lambda list-layer-versions \ |
124 | | - --layer-name ${{ env.LAYER_NAME }} \ |
125 | | - --query 'max_by(LayerVersions, &Version).Version' |
126 | | - ) |
127 | | - aws lambda add-layer-version-permission \ |
128 | | - --layer-name ${{ env.LAYER_NAME }} \ |
129 | | - --version-number $layerVersion \ |
130 | | - --principal "*" \ |
131 | | - --statement-id publish \ |
132 | | - --action lambda:GetLayerVersion |
133 | | - - name: upload layer arn artifact |
134 | | - if: ${{ success() }} |
135 | | - uses: actions/upload-artifact@v4 |
136 | | - with: |
137 | | - name: ${{ env.LAYER_NAME }}-${{ matrix.aws_region }} |
138 | | - path: ${{ env.LAYER_NAME }}/${{ matrix.aws_region }} |
139 | | - - name: clean s3 |
140 | | - if: always() |
141 | | - run: | |
142 | | - aws s3 rb --force s3://${{ env.BUCKET_NAME }} |
| 63 | + # publish-prod: |
| 64 | + # runs-on: ubuntu-latest |
| 65 | + # needs: build-layer |
| 66 | + # strategy: |
| 67 | + # matrix: |
| 68 | + # aws_region: ${{ fromJson(needs.build-layer.outputs.aws_regions_json) }} |
| 69 | + # steps: |
| 70 | + # - name: role arn |
| 71 | + # env: |
| 72 | + # LEGACY_COMMERCIAL_REGIONS: ${{ env.LEGACY_COMMERCIAL_REGIONS }} |
| 73 | + # run: | |
| 74 | + # LEGACY_COMMERCIAL_REGIONS_ARRAY=(${LEGACY_COMMERCIAL_REGIONS//,/ }) |
| 75 | + # FOUND=false |
| 76 | + # for REGION in "${LEGACY_COMMERCIAL_REGIONS_ARRAY[@]}"; do |
| 77 | + # if [[ "$REGION" == "${{ matrix.aws_region }}" ]]; then |
| 78 | + # FOUND=true |
| 79 | + # break |
| 80 | + # fi |
| 81 | + # done |
| 82 | + # if [ "$FOUND" = true ]; then |
| 83 | + # echo "Found ${{ matrix.aws_region }} in LEGACY_COMMERCIAL_REGIONS" |
| 84 | + # SECRET_KEY="LAMBDA_LAYER_RELEASE" |
| 85 | + # else |
| 86 | + # echo "Not found ${{ matrix.aws_region }} in LEGACY_COMMERCIAL_REGIONS" |
| 87 | + # SECRET_KEY="${{ matrix.aws_region }}_LAMBDA_LAYER_RELEASE" |
| 88 | + # fi |
| 89 | + # SECRET_KEY=${SECRET_KEY//-/_} |
| 90 | + # echo "SECRET_KEY=${SECRET_KEY}" >> $GITHUB_ENV |
| 91 | + # - uses: aws-actions/configure-aws-credentials@v4.0.2 |
| 92 | + # with: |
| 93 | + # role-to-assume: ${{ secrets[env.SECRET_KEY] }} |
| 94 | + # role-duration-seconds: 1200 |
| 95 | + # aws-region: ${{ matrix.aws_region }} |
| 96 | + # - name: Get s3 bucket name for release |
| 97 | + # run: | |
| 98 | + # echo BUCKET_NAME=python-lambda-layer-${{ github.run_id }}-${{ matrix.aws_region }} | tee --append $GITHUB_ENV |
| 99 | + # - name: download layer.zip |
| 100 | + # uses: actions/download-artifact@v4 |
| 101 | + # with: |
| 102 | + # name: layer.zip |
| 103 | + # - name: publish |
| 104 | + # run: | |
| 105 | + # aws s3 mb s3://${{ env.BUCKET_NAME }} |
| 106 | + # aws s3 cp aws-opentelemetry-python-layer.zip s3://${{ env.BUCKET_NAME }} |
| 107 | + # layerARN=$( |
| 108 | + # aws lambda publish-layer-version \ |
| 109 | + # --layer-name ${{ env.LAYER_NAME }} \ |
| 110 | + # --content S3Bucket=${{ env.BUCKET_NAME }},S3Key=aws-opentelemetry-python-layer.zip \ |
| 111 | + # --compatible-runtimes python3.10 python3.11 python3.12 python3.13 \ |
| 112 | + # --compatible-architectures "arm64" "x86_64" \ |
| 113 | + # --license-info "Apache-2.0" \ |
| 114 | + # --description "AWS Distro of OpenTelemetry Lambda Layer for Python Runtime" \ |
| 115 | + # --query 'LayerVersionArn' \ |
| 116 | + # --output text |
| 117 | + # ) |
| 118 | + # echo $layerARN |
| 119 | + # echo "LAYER_ARN=${layerARN}" >> $GITHUB_ENV |
| 120 | + # mkdir ${{ env.LAYER_NAME }} |
| 121 | + # echo $layerARN > ${{ env.LAYER_NAME }}/${{ matrix.aws_region }} |
| 122 | + # cat ${{ env.LAYER_NAME }}/${{ matrix.aws_region }} |
| 123 | + # - name: public layer |
| 124 | + # run: | |
| 125 | + # layerVersion=$( |
| 126 | + # aws lambda list-layer-versions \ |
| 127 | + # --layer-name ${{ env.LAYER_NAME }} \ |
| 128 | + # --query 'max_by(LayerVersions, &Version).Version' |
| 129 | + # ) |
| 130 | + # aws lambda add-layer-version-permission \ |
| 131 | + # --layer-name ${{ env.LAYER_NAME }} \ |
| 132 | + # --version-number $layerVersion \ |
| 133 | + # --principal "*" \ |
| 134 | + # --statement-id publish \ |
| 135 | + # --action lambda:GetLayerVersion |
| 136 | + # - name: upload layer arn artifact |
| 137 | + # if: ${{ success() }} |
| 138 | + # uses: actions/upload-artifact@v4 |
| 139 | + # with: |
| 140 | + # name: ${{ env.LAYER_NAME }}-${{ matrix.aws_region }} |
| 141 | + # path: ${{ env.LAYER_NAME }}/${{ matrix.aws_region }} |
| 142 | + # - name: clean s3 |
| 143 | + # if: always() |
| 144 | + # run: | |
| 145 | + # aws s3 rb --force s3://${{ env.BUCKET_NAME }} |
143 | 146 | generate-release-note: |
144 | 147 | runs-on: ubuntu-latest |
145 | | - needs: publish-prod |
| 148 | + needs: build-layer |
146 | 149 | steps: |
147 | 150 | - name: Checkout Repo @ SHA - ${{ github.sha }} |
148 | 151 | uses: actions/checkout@v4 |
|
0 commit comments