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

Add github actions for deploying AWS ECS envs #853

Conversation

willscripted
Copy link
Contributor

Create github actions for building and deploying LAMP-dashboard

Manual Actions:

  • Deploy SHA - Allows an authorized user to build and deploy an arbitrary git sha (long format) to staging or other future testing environments (note, cannot be used to deploy to production).
  • Deploy Tag - Allows an authorized user to deploy a docker container to any configured environment (currently only stg and prod. Note that the input for this job is the DOCKER tag, not the git tag. Likely, the docker tags will be in the form of master, sha-somelongformatgitsha, or gittag (eg. 2024.5.9 as is the preferred format in this repository)

Automatic Actions:

  • On Branch Update (master) - Runs when a pull request is merged into master or when someone pushes a commit directly to master. The action will build a docker image, push it to the github registry with the docker tag master, and deploy that image to the staging environment (stg) using the image's checksum digest.
  • On Pull Request Update - Builds the docker image without publishing it to the github container registry. Some notes here:
    • This action checks the validity of a pull request, it does not publish anything to the registry
    • The only check at the moment is that the image builds successfully. It does not check that the image can be booted.
    • The sha that is built is the sha of the invisible merge commit, not the HEAD of the branch. This could be a source of dependencies if it "works on my machine"
    • Because this action listens to the edited webhook type (among others), it will be triggered each time the base branch is updated. If there are lots of open pull requests, this could mean an unhelpful amount of rebuilds when master is updated.
  • On Tag - Runs when a new tag is pushed to the repository. It is the same as the "On Branch Update (master)" job except that the resulting docker tag will be the name of the git tag pushed (eg git tag of 2024.5.9 will create a docker tag of 2024.5.9)

Tasks or Callable Workflows:

These two workflows should not be called directly, but instead called by an "On "-style workflow. No need to do anything here, just wanted to explain all the new files. The "Build" task builds the docker image. The "Deploy" task deploys the docker task to the Digital Psych AWS ECS environment(s).

@MattMatt27 -- should be all set 🥳

Copy link
Contributor

@MattMatt27 MattMatt27 left a comment

Choose a reason for hiding this comment

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

Mostly informative questions for my own education!

.github/workflows/on-pr-update.yml Show resolved Hide resolved
.github/workflows/on-pr-update.yml Show resolved Hide resolved
.github/workflows/callable-build-docker.yml Show resolved Hide resolved
.github/workflows/callable-build-docker.yml Show resolved Hide resolved
.github/workflows/callable-deploy-ecs.yml Show resolved Hide resolved
.github/workflows/manual-deploy-tag.yml Outdated Show resolved Hide resolved
.github/workflows/on-merge-to-master.yml Show resolved Hide resolved
.github/workflows/on-merge-to-master.yml Show resolved Hide resolved
.github/workflows/on-pr-update.yml Show resolved Hide resolved
Dockerfile Show resolved Hide resolved
@willscripted
Copy link
Contributor Author

Mostly informative questions for my own education!

Sounds good -- I'll respond to comments and we discuss and cherry-pick the changes that should be made tomorrow 👍

@willscripted willscripted force-pushed the add-build-and-deploy-actions branch from 123dd8a to d011258 Compare January 29, 2025 18:53
@willscripted willscripted force-pushed the add-build-and-deploy-actions branch from d011258 to 30f9bc8 Compare January 30, 2025 01:04
Copy link
Contributor

@MattMatt27 MattMatt27 left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

@MattMatt27 MattMatt27 merged commit 5891441 into BIDMCDigitalPsychiatry:master Jan 30, 2025
1 check 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.

2 participants