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

Feature/cd #78

Merged
merged 32 commits into from
Nov 7, 2024
Merged

Feature/cd #78

merged 32 commits into from
Nov 7, 2024

Conversation

zacdezgeo
Copy link
Collaborator

@zacdezgeo zacdezgeo commented Oct 11, 2024

Add Staging Environment Variable and Setup Continuous Deployment for Staging and Production

What I Changed:

  • Added STAGE Environment Variable:

    • Introduced a new STAGE environment variable to differentiate between deployment environments (staging and prod).
    • The environment variable loads environment-specific configurations, allowing flexible deployments across multiple environments.
    • In the CDK deployment, the STAGE variable is dynamically used to deploy the correct infrastructure based on the target environment.
  • Set Up Separate Continuous Deployment Workflows:

    • Created two separate GitHub Actions workflows:
      • Production Deployment:
        • The existing CD.yml workflow now deploys to the production environment only when a commit is pushed to the main branch.
      • Staging Deployment:
        • A new workflow (CD-staging.yml) was created to automatically deploy changes to the staging environment on pull requests targeting the main branch.

How to Test It:

  1. Testing the Staging Environment:

    • Create or update a pull request to the main branch.
    • Verify that the staging deployment workflow (CD-staging.yml) is triggered.
    • Check the GitHub Actions logs to confirm that the staging deployment is successful and the API is accessible at the staging domain (staging.space2stats.ds.io).
  2. Testing the Production Environment:

    • Wait until merged... @alukach any better ideas?
    • Verify that the production deployment workflow (CD.yml) is triggered.
    • Check the GitHub Actions logs to confirm that the production deployment is successful and the API is accessible at the production domain (space2stats.ds.io).

@zacdezgeo zacdezgeo added the enhancement New feature or request label Oct 11, 2024
@zacdezgeo zacdezgeo requested a review from alukach October 11, 2024 20:09
@zacdezgeo zacdezgeo self-assigned this Oct 11, 2024
@zacdezgeo zacdezgeo temporarily deployed to Space2Stats API Dev October 11, 2024 21:34 — with GitHub Actions Inactive
@zacdezgeo zacdezgeo temporarily deployed to Space2Stats API Dev October 11, 2024 21:55 — with GitHub Actions Inactive
* Migrate to reusable workflow

* Add tooling for PR preview URL

* Add runs-on

* Pre-commit

* Refactor triggers

* Bump version

* Add permissions

* Fix working dir

* Fix URL output

* Fix comment find

* Add tooling to tear down PR preview

* Fix commenting

* Fix

* Run tests on all pushes

* Refactor

* Fix

* Expand events
@alukach alukach closed this Nov 5, 2024
@alukach alukach reopened this Nov 5, 2024
@alukach alukach temporarily deployed to Space2Stats API Dev November 7, 2024 16:33 — with GitHub Actions Inactive
@alukach alukach closed this Nov 7, 2024
@alukach alukach temporarily deployed to Space2Stats API Dev November 7, 2024 16:39 — with GitHub Actions Inactive
@alukach alukach reopened this Nov 7, 2024
@alukach alukach temporarily deployed to Space2Stats API Dev November 7, 2024 16:42 — with GitHub Actions Inactive
@alukach alukach temporarily deployed to Space2Stats API Dev November 7, 2024 16:55 — with GitHub Actions Inactive
@alukach alukach temporarily deployed to Space2Stats API Dev November 7, 2024 16:59 — with GitHub Actions Inactive
@alukach
Copy link
Collaborator

alukach commented Nov 7, 2024

I am going to call this 'complete'. My goal had been:

  • have tests run on every push
  • have preview deployments run on all PRs, after tests had completed

By having tests run on every push but also having preview deployments run after tests, tests would run twice (once for the push, once for the PR sync event).

Instead, I have made it so that tests only run on pushes to main or pushes to branches with PRs.

@alukach alukach merged commit a1df6f3 into main Nov 7, 2024
3 checks passed
@alukach alukach temporarily deployed to Space2Stats API Dev November 7, 2024 17:25 — with GitHub Actions Inactive
@zacdezgeo zacdezgeo deleted the feature/cd branch November 7, 2024 17:26
@alukach alukach temporarily deployed to Space2Stats API Dev November 7, 2024 17:26 — with GitHub Actions Inactive
Gabe-Levin pushed a commit that referenced this pull request Nov 11, 2024
* Update adding staging mechanism

* Add CD pipeline

* Solve f-string matching

* Update event to push on main

* Add dev CD

* Remove npm and node specific jobs

* Update variables

* Update environment

* Update role

* Remove cdk bootstrap

* Add working directory for cdk deployment

* Add cdk requirements

* Update cdk requirements

* Update deployment variables

* Refactor deployment tooling (#85)

* Migrate to reusable workflow

* Add tooling for PR preview URL

* Add runs-on

* Pre-commit

* Refactor triggers

* Bump version

* Add permissions

* Fix working dir

* Fix URL output

* Fix comment find

* Add tooling to tear down PR preview

* Fix commenting

* Fix

* Run tests on all pushes

* Refactor

* Fix

* Expand events

* Fix destroy

* Prevent unnecessary deployments

* Pass in PR number

* Prevent testing on closed PRs

* Refactor

* Mv to workflows

* Fix destroy

* Rework trigger

* Refine

* Rm old needs

* Rework trigger

* Try fix if condition

* Mv deployment trigger back to ci.yml

* Rework triggers

* Rename jobs

* Set concurrency to stage

* Only trigger on pushes to main

---------

Co-authored-by: Anthony Lukach <anthonylukach@gmail.com>
Gabe-Levin pushed a commit that referenced this pull request Nov 20, 2024
* Update adding staging mechanism

* Add CD pipeline

* Solve f-string matching

* Update event to push on main

* Add dev CD

* Remove npm and node specific jobs

* Update variables

* Update environment

* Update role

* Remove cdk bootstrap

* Add working directory for cdk deployment

* Add cdk requirements

* Update cdk requirements

* Update deployment variables

* Refactor deployment tooling (#85)

* Migrate to reusable workflow

* Add tooling for PR preview URL

* Add runs-on

* Pre-commit

* Refactor triggers

* Bump version

* Add permissions

* Fix working dir

* Fix URL output

* Fix comment find

* Add tooling to tear down PR preview

* Fix commenting

* Fix

* Run tests on all pushes

* Refactor

* Fix

* Expand events

* Fix destroy

* Prevent unnecessary deployments

* Pass in PR number

* Prevent testing on closed PRs

* Refactor

* Mv to workflows

* Fix destroy

* Rework trigger

* Refine

* Rm old needs

* Rework trigger

* Try fix if condition

* Mv deployment trigger back to ci.yml

* Rework triggers

* Rename jobs

* Set concurrency to stage

* Only trigger on pushes to main

---------

Co-authored-by: Anthony Lukach <anthonylukach@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants