forked from bcgov/supreme-court-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/JASPER-157
- Loading branch information
Showing
99 changed files
with
7,576 additions
and
734 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Build Lambda | ||
description: Builds all Lambda functions | ||
|
||
inputs: | ||
working_directory: | ||
description: The working directory where the code will be built. | ||
required: true | ||
node_version: | ||
description: The node version that will be used. | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ env.node_version }} | ||
|
||
- run: npm ci | ||
shell: bash | ||
working-directory: ${{ inputs.working_directory }} | ||
|
||
- run: npm run lint | ||
shell: bash | ||
working-directory: ${{ inputs.working_directory }} | ||
continue-on-error: false | ||
|
||
- run: npm run build | ||
shell: bash | ||
working-directory: ${{ inputs.working_directory }} | ||
|
||
- run: npm run test --if-present | ||
shell: bash | ||
working-directory: ${{ inputs.working_directory }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
name: Deploy Lambda | ||
description: Deploy image to a Lambda function to AWS | ||
|
||
inputs: | ||
environment: | ||
description: The environment to which the image will be deployed. | ||
required: true | ||
aws_account: | ||
description: The AWS Account ID. | ||
required: true | ||
region: | ||
description: The AWS Region of the AWS Account. | ||
required: true | ||
app_name: | ||
description: The application name. | ||
required: true | ||
lambda_name: | ||
description: The lambda function name name. | ||
required: true | ||
aws_role_arn: | ||
description: The AWS Role ARN to assume. | ||
required: true | ||
ghcr_token: | ||
description: The token to use to login to the GHCR. | ||
required: true | ||
github_image_repo: | ||
description: The GCHR repo where images are stored. | ||
required: true | ||
image_name: | ||
description: The name of the image to be deployed. | ||
required: true | ||
short_sha: | ||
description: The short SHA used to tag image in GCHR. | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- name: Set reusable variables | ||
id: vars | ||
shell: bash | ||
run: | | ||
echo "full_ecr_repo_url=${{ inputs.aws_account }}.dkr.ecr.${{ inputs.region }}.amazonaws.com/${{ inputs.app_name }}-lambda-repo-${{ inputs.environment }}" >> $GITHUB_OUTPUT | ||
echo "container_name=${{ inputs.app_name }}-${{ inputs.tier_name }}-container-${{ inputs.environment }}" >> $GITHUB_OUTPUT | ||
- name: Log in to the GHCR | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ inputs.ghcr_token }} | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-skip-session-tagging: true | ||
aws-region: ${{ inputs.region }} | ||
role-to-assume: ${{ inputs.aws_role_arn }} | ||
role-duration-seconds: 1800 | ||
role-session-name: ci-deployment | ||
|
||
- name: Login to Amazon ECR | ||
uses: aws-actions/amazon-ecr-login@v2 | ||
|
||
- name: Check ECR Image exists | ||
id: ecr-check | ||
shell: bash | ||
run: | | ||
IMAGE_TAG=${{ inputs.image_name }}-${{ inputs.short_sha }} | ||
REPOSITORY_NAME=${{ inputs.app_name }}-lambda-repo-${{ inputs.environment }} | ||
IMAGE_EXISTS=$(aws ecr describe-images --repository-name $REPOSITORY_NAME --query "imageDetails[?contains(imageTags, '$IMAGE_TAG')]" --output text) | ||
if [ -z "$IMAGE_EXISTS" ]; then | ||
echo "Image with tag $IMAGE_TAG does not exist." | ||
echo "exists=false" >> $GITHUB_OUTPUT | ||
else | ||
echo "Image with tag $IMAGE_TAG already exists." | ||
echo "exists=true" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Push if Docker image does not exist | ||
if: steps.ecr-check.outputs.exists == 'false' | ||
shell: bash | ||
run: | | ||
docker pull ${{ inputs.github_image_repo }}/${{ inputs.image_name }}:${{ inputs.short_sha}} | ||
docker tag ${{ inputs.github_image_repo }}/${{ inputs.image_name }}:${{ inputs.short_sha}} ${{ steps.vars.outputs.full_ecr_repo_url }}:${{ inputs.image_name }}-${{ inputs.short_sha }} | ||
docker push ${{ steps.vars.outputs.full_ecr_repo_url }}:${{ inputs.image_name }}-${{ inputs.short_sha }} | ||
- name: Update Lambda Function | ||
shell: bash | ||
run: | | ||
aws lambda update-function-code \ | ||
--function-name ${{ inputs.app_name }}-${{ inputs.lambda_name }}-lambda-${{ inputs.environment }} \ | ||
--image-uri ${{ steps.vars.outputs.full_ecr_repo_url }}:${{ inputs.image_name }}-${{ inputs.short_sha }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Build and Test Lambdas | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
paths: | ||
- "aws/**" | ||
|
||
workflow_dispatch: | ||
|
||
env: | ||
WORKING_DIRECTORY: ./aws | ||
NODE_VERSION: 20 | ||
|
||
jobs: | ||
build-and-test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Building Lambdas codebase | ||
uses: ./.github/workflows/actions/build-lambdas | ||
with: | ||
working_directory: ${{ env.WORKING_DIRECTORY }} | ||
node_version: ${{ env.NODE_VERSION }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.