Skip to content

Commit

Permalink
Teste beta layer
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrodamascena committed Aug 21, 2024
1 parent 85d5253 commit d716e95
Show file tree
Hide file tree
Showing 3 changed files with 220 additions and 214 deletions.
243 changes: 123 additions & 120 deletions .github/workflows/publish_v3_layer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,56 +170,57 @@ jobs:
source_code_artifact_name: ${{ inputs.source_code_artifact_name }}
source_code_integrity_hash: ${{ inputs.source_code_integrity_hash }}

prod:
needs: beta
# UNCOMMENT prod JOB
#prod:
# needs: beta
# lower privilege propagated from parent workflow (release.yml)
permissions:
id-token: write
contents: read
pages: write # docs will be updated with latest Layer ARNs
pull-requests: write # creation-action will create a PR with Layer ARN updates
uses: ./.github/workflows/reusable_deploy_v3_layer_stack.yml
secrets: inherit
with:
stage: "PROD"
environment: "layer-prod"
source_code_artifact_name: ${{ inputs.source_code_artifact_name }}
source_code_integrity_hash: ${{ inputs.source_code_integrity_hash }}

sar-beta:
needs: beta # canaries run on Layer Beta env
permissions:
# lower privilege propagated from parent workflow (release.yml)
id-token: write
contents: read
pull-requests: none
pages: none
uses: ./.github/workflows/reusable_deploy_v3_sar.yml
secrets: inherit
with:
stage: "BETA"
environment: "layer-beta"
package-version: ${{ inputs.latest_published_version }}
source_code_artifact_name: ${{ inputs.source_code_artifact_name }}
source_code_integrity_hash: ${{ inputs.source_code_integrity_hash }}
# permissions:
# id-token: write
# contents: read
# pages: write # docs will be updated with latest Layer ARNs
# pull-requests: write # creation-action will create a PR with Layer ARN updates
# uses: ./.github/workflows/reusable_deploy_v3_layer_stack.yml
# secrets: inherit
# with:
# stage: "PROD"
# environment: "layer-prod"
# source_code_artifact_name: ${{ inputs.source_code_artifact_name }}
# source_code_integrity_hash: ${{ inputs.source_code_integrity_hash }}

#sar-beta:
# needs: beta # canaries run on Layer Beta env
# permissions:
# # lower privilege propagated from parent workflow (release.yml)
# id-token: write
# contents: read
# pull-requests: none
# pages: none
# uses: ./.github/workflows/reusable_deploy_v3_sar.yml
# secrets: inherit
# with:
# stage: "BETA"
# environment: "layer-beta"
# package-version: ${{ inputs.latest_published_version }}
# source_code_artifact_name: ${{ inputs.source_code_artifact_name }}
# source_code_integrity_hash: ${{ inputs.source_code_integrity_hash }}

sar-prod:
needs: sar-beta
permissions:
# UNCOMMENT sar-prod JOB
#sar-prod:
# needs: sar-beta
# permissions:
# lower privilege propagated from parent workflow (release.yml)
id-token: write
contents: read
pull-requests: none
pages: none
uses: ./.github/workflows/reusable_deploy_v3_sar.yml
secrets: inherit
with:
stage: "PROD"
environment: "layer-prod"
package-version: ${{ inputs.latest_published_version }}
source_code_artifact_name: ${{ inputs.source_code_artifact_name }}
source_code_integrity_hash: ${{ inputs.source_code_integrity_hash }}
# id-token: write
# contents: read
# pull-requests: none
# pages: none
# uses: ./.github/workflows/reusable_deploy_v3_sar.yml
# secrets: inherit
# with:
# stage: "PROD"
# environment: "layer-prod"
# package-version: ${{ inputs.latest_published_version }}
# source_code_artifact_name: ${{ inputs.source_code_artifact_name }}
# source_code_integrity_hash: ${{ inputs.source_code_integrity_hash }}


# Updating the documentation with the latest Layer ARNs is a two-phase process
Expand All @@ -231,84 +232,86 @@ jobs:
# where a new release creates a new doc (2.16.0) while layers are still pointing to 2.15
# because the PR has to be merged while release process is running

update_v3_layer_arn_docs:
needs: prod
outputs:
temp_branch: ${{ steps.create-pr.outputs.temp_branch }}
runs-on: ubuntu-latest
permissions:
# UNCOMMENT update_v3_layer_arn_docs JOB
#update_v3_layer_arn_docs:
# needs: prod
# outputs:
# temp_branch: ${{ steps.create-pr.outputs.temp_branch }}
# runs-on: ubuntu-latest
# permissions:
# lower privilege propagated from parent workflow (release.yml)
contents: write
pull-requests: write
id-token: none
pages: none
steps:
- name: Checkout repository # reusable workflows start clean, so we need to checkout again
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
ref: ${{ env.RELEASE_COMMIT }}
# contents: write
# pull-requests: write
# id-token: none
# pages: none
# steps:
# - name: Checkout repository # reusable workflows start clean, so we need to checkout again
# uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
# with:
# ref: ${{ env.RELEASE_COMMIT }}

- name: Restore sealed source code
uses: ./.github/actions/seal-restore
with:
integrity_hash: ${{ inputs.source_code_integrity_hash }}
artifact_name: ${{ inputs.source_code_artifact_name }}
# - name: Restore sealed source code
# uses: ./.github/actions/seal-restore
# with:
# integrity_hash: ${{ inputs.source_code_integrity_hash }}
# artifact_name: ${{ inputs.source_code_artifact_name }}

- name: Download CDK layer artifacts
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
path: cdk-layer-stack
pattern: cdk-layer-stack-* # merge all Layer artifacts created per region earlier (reusable_deploy_v2_layer_stack.yml; step "Save Layer ARN artifact")
merge-multiple: true
- name: Replace layer versions in documentation
run: |
ls -la cdk-layer-stack/
./layer/scripts/update_layer_arn.sh cdk-layer-stack
# - name: Download CDK layer artifacts
# uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
# with:
# path: cdk-layer-stack
# pattern: cdk-layer-stack-* # merge all Layer artifacts created per region earlier (reusable_deploy_v2_layer_stack.yml; step "Save Layer ARN artifact")
# merge-multiple: true
# - name: Replace layer versions in documentation
# run: |
# ls -la cdk-layer-stack/
# ./layer/scripts/update_layer_arn.sh cdk-layer-stack
# NOTE: It felt unnecessary creating yet another PR to update changelog w/ latest tag
# since this is the only step in the release where we update docs from a temp branch
- name: Update changelog with latest tag
run: make changelog
- name: Create PR
id: create-pr
uses: ./.github/actions/create-pr
with:
files: "docs/index.md examples CHANGELOG.md"
temp_branch_prefix: "ci-layer-docs"
pull_request_title: "chore(ci): layer docs update"
github_token: ${{ secrets.GITHUB_TOKEN }}
# - name: Update changelog with latest tag
# run: make changelog
# - name: Create PR
# id: create-pr
# uses: ./.github/actions/create-pr
# with:
# files: "docs/index.md examples CHANGELOG.md"
# temp_branch_prefix: "ci-layer-docs"
# pull_request_title: "chore(ci): layer docs update"
# github_token: ${{ secrets.GITHUB_TOKEN }}

# UNCOMMENT prepare_docs_alias JOB
#prepare_docs_alias:
# runs-on: ubuntu-latest
# permissions:
# # lower privilege propagated from parent workflow (release.yml)
# contents: read
# pages: none
# id-token: none
# pull-requests: none
# outputs:
# DOCS_ALIAS: ${{ steps.set-alias.outputs.DOCS_ALIAS }}
# steps:
# - name: Set docs alias
# id: set-alias
# run: |
# DOCS_ALIAS=latest
# if [[ "${{ inputs.pre_release }}" == true ]] ; then
# DOCS_ALIAS=alpha
# fi
# echo DOCS_ALIAS="$DOCS_ALIAS" >> "$GITHUB_OUTPUT"

prepare_docs_alias:
runs-on: ubuntu-latest
permissions:
# lower privilege propagated from parent workflow (release.yml)
contents: read
pages: none
id-token: none
pull-requests: none
outputs:
DOCS_ALIAS: ${{ steps.set-alias.outputs.DOCS_ALIAS }}
steps:
- name: Set docs alias
id: set-alias
run: |
DOCS_ALIAS=latest
if [[ "${{ inputs.pre_release }}" == true ]] ; then
DOCS_ALIAS=alpha
fi
echo DOCS_ALIAS="$DOCS_ALIAS" >> "$GITHUB_OUTPUT"
release_docs:
needs: [update_v3_layer_arn_docs, prepare_docs_alias]
permissions:
# lower privilege propagated from parent workflow (release.yml)
contents: write
pages: write
pull-requests: none
id-token: write
secrets: inherit
uses: ./.github/workflows/reusable_publish_docs.yml
with:
version: ${{ inputs.latest_published_version }}
alias: ${{ needs.prepare_docs_alias.outputs.DOCS_ALIAS }}
git_ref: ${{ needs.update_v3_layer_arn_docs.outputs.temp_branch }}
# UNCOMMENT release_docs JOB
#release_docs:
# needs: [update_v3_layer_arn_docs, prepare_docs_alias]
# permissions:
# # lower privilege propagated from parent workflow (release.yml)
# contents: write
# pages: write
# pull-requests: none
# id-token: write
# secrets: inherit
# uses: ./.github/workflows/reusable_publish_docs.yml
# with:
# version: ${{ inputs.latest_published_version }}
# alias: ${{ needs.prepare_docs_alias.outputs.DOCS_ALIAS }}
# git_ref: ${{ needs.update_v3_layer_arn_docs.outputs.temp_branch }}
Loading

0 comments on commit d716e95

Please sign in to comment.