Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev Workflows for Lambda@Edge #2

Merged
merged 4 commits into from
Jan 11, 2024
Merged

Dev Workflows for Lambda@Edge #2

merged 4 commits into from
Jan 11, 2024

Conversation

cabutlermit
Copy link
Contributor

@cabutlermit cabutlermit commented Jan 5, 2024

Purpose and background context

This is part of a Proof-of-Concept for determining how to publish Lambda@Edge functions from application repositories to our Terraform-managed CloudFront distributions. In this round of changes, the caller workflows are cleaned up and use the new shared workflows that have been merged to the main branch of the .github repository.

We need two different dev workflows, one that just redeploys the CloudFront distribution without pushing a zip from GitHub and one that performs the full Lambda function upload and CloudFront redeployment. We also include a stage workflow with the automation temporarily disabled.

How this addresses that need

  • Update Makefile with manual zip deployment commands (create-zip and upload-zip)
  • Add a workflow_dispatch GHA workflow for dev that only redeploys the CloudFront distribution (by triggering a plan/apply in TfC)
  • Add a workflow_dispatch GHA workflow for dev that handles the full zip upload and CloudFront distribution redeploy
  • Add a workflow_dispatch GHA workflow for stage that is ready to automated stage deploys (with the automation currently commented out)
  • Update the README

How can a reviewer manually see the effects of these changes?

With all the changes, it is not possible to test the GHA workflows at this time. Multiple tests have been done and can be found in the Actions history on this repo.

Test the make commands

Checkout this branch locally. Authenticate to Dev1 (as a full admin user) on the command line and then run make create-zip. This should zip up the code for the Lambda function. Run make upload-zip. This should copy the .zip file to the S3 bucket in Dev1. In the AWS Console, you can navigate to the shared-files-xxxx S3 bucket and open the files/ folder and see the that Last Modified date on the cf-lambda-custom-domain.py.zip file has updated.

Includes new or updated dependencies?

YES: This depends on a new shared workflow in our .github repo. See PR#49 for more details about that shared workflow.

Changes expectations for external applications?

NO

What are the relevant tickets?

Developer

  • [n/a] All new ENV is documented in README (this is code for a Lambda@Edge function which cannot have ENV)
  • [n/a] All new ENV has been added to staging and production environments (this is code for a Lambda@Edge function which cannot have ENV)
  • All related Jira tickets are linked in commit message(s)
  • Stakeholder approval has been confirmed (or is not needed)

Code Reviewer(s)

  • The commit message is clear and follows our guidelines (not just this PR message)
  • There are appropriate tests covering any new functionality
  • The provided documentation is sufficient for understanding any new functionality introduced
  • Any manual tests have been performed and verified
  • New dependencies are appropriate or there were no changes

Why these changes are being introduced:
We need to different dev workflows, one that just redeploys the
CloudFront distribution without pushing a zip from GitHub and one that
performs the full Lambda function upload and CloudFront redeployment.

How this addresses that need:
* Update Makefile with manual zip deployment commands
* Add a workflow_dispatch GHA workflow for dev that only redeploys the
CloudFront distribution (by triggering a plan/apply in TfC)
* Add a workflow_dispatch GHA workflow for dev that handles the full
zip upload and CloudFront distribution redeploy

Side effects of this change:
None.

Relevant ticket(s):
* https://mitlibraries.atlassian.net/browse/GDT-97
Copy link

github-actions bot commented Jan 8, 2024

Pull Request Test Coverage Report for Build 7492088323

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 81.818%

Totals Coverage Status
Change from base Build 7424147873: 0.0%
Covered Lines: 18
Relevant Lines: 22

💛 - Coveralls

@cabutlermit cabutlermit marked this pull request as ready for review January 8, 2024 16:34
Why these changes are being introduced:
With the new shared workflows now in the main branch of the .github
repository, the final versions of the caller workflow (generated from
the TfC outputs of the mitlib-tf-workloads-libraries-website repo) can
be put in place here.

How this addresses that need:
* Update Makefile with new `create-zip` and `upload-zip` commands
* Update the caller workflows to match the shared workflows in the
.github repository
* Update the README

Side effects of this change:
None.

Relevant ticket(s):
* https://mitlibraries.atlassian.net/browse/GDT-97
.github/workflows/dev-cf-redeploy-only.yml Show resolved Hide resolved
.github/workflows/stage-cf-deploy-lambda.yml Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Show resolved Hide resolved
Why these changes are being introduced:
Per the conversations in the PR, there were a few tweaks so the in-line
comments in some files.

How this addresses that need:
* Correct the comment at the top of each of the dev GHA workflows
* Update the PR template

Side effects of this change:
None.
@cabutlermit
Copy link
Contributor Author

@JPrevost thanks for the feedback! I just pushed up the requested tweaks.

Copy link
Member

@JPrevost JPrevost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there remain a files in this repo that should we should consider whether they add value or noise, but that is outside the scope of this work.

:shipit:

@cabutlermit cabutlermit merged commit 53a5428 into main Jan 11, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants