Skip to content

Allow user to add manual approval for deploy jobs. #162

@liweiyi88

Description

@liweiyi88

It would be very useful to add an environment attribute in the workflow yml file for deploy jobs. Then it will enable user to config manual approval if needed.

How it works.

We add an environment section in the workflow file like below

jobs:
  cdk_diff:
    runs-on: ubuntu-latest
    steps:
      ...
  deploy_to_dev:
    needs: cdk_diff
    environment:    <--- environment for deploying to development job
        name: development
    runs-on: ubuntu-latest
    steps:
      ...
  deploy_to_staging:
    needs: deploy_to_dev
    environment:          <--- environment for deploying to staging job
        name: staging
    runs-on: ubuntu-latest
    steps:
    ...

At this stage, those extra environment attributes won't introduce any side effects or breaking changes.

Secondly, in github -> settings -> environment page, we create two github.com environments with the same names (development and staging) like below
create-env

After this step, nothing won't happen until we configure the environment like the below screenshot.
require-reviewers
Here, in the staging environment, I ticked the required reviewers and assign my username to it. after saving the change, the workflow will block in the deploy to staging step and ask me to approve it.
Screen Shot 2022-04-15 at 9 57 35 am
Screen Shot 2022-04-15 at 9 57 51 am

Here is the working repository

So in #160, I added the environment attribute based on the stage name for the deploy jobs. Then it will give the user the ability to add manual approval if needed.
Please let me know if you have any further questions.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions