-
Notifications
You must be signed in to change notification settings - Fork 37
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
Allow user to add manual approval for deploy jobs. #162
Comments
Hi @liweiyi88! I'm not actually worried about side effects or breaking changes -- but I want to focus on the user experience and unlock as many use cases as possible from this feature. The detail you've provided is invaluable to me. Thank you for that. This is absolutely something this module should support, the question is what is the best way to do that. Especially because manual approval is something that exists in the AWS CodePipeline counterpart in My concern with your solution is that you have to know what you're doing in order to achieve this functionality. The discoverability of this feature will suffer, and less people will stumble across it and utilize it as a result. My second concern is, what if a user does not want their environment to be the stack name? Again, I'm not overly familiar with the use case because I've never used environments before, but I feel like this could be the case. Also, I don't think it's feasible to simply hard code the environment for every deploy and expect that users are okay with the value being ignored if they are not using it -- in my mind, everything in To assuage these concerns, I suggest:
// user might write this
const fnStack = new Stack(this, 'FunctionStack');
fnStack.tags.setTag('github-env', 'production'); // in pipeline.ts
environment: {
name: stack.tags['github-env'] ? stack.tags['github-env'] : stack.stackName,
}, Lastly, in an ideal world we could some how incorporate the @liweiyi88, I think this is a great idea but the execution is a one-way door (even though this module is experimental :)). We should be very deliberate in determining the best path forward here. Let me know what you think! |
@kaizen3031593 Thanks for the feedback. I would like to add some comments in regard to the points.
So users will have their own control over the name passed to the environment section. However, I couldn't find a better way to get the stage name from the
It would be better if you could shed some light on a better way to get the stage name? |
I think we could combine the 2-steps into one by only considering if the stack has a tag |
Also, based on the above discussion I have updated #160 |
@liweiyi88, thanks for being proactive on this! Give me a couple days to think about this and talk to some people. I can't think of a better idea (yet) but I'm not fully certain that this is a reasonable use case for tags. |
@kaizen3031593 , having an extra field in |
I agree :). But I want to touch base with @rix0rrr just to be sure. Expect an update early next week with the go-ahead or with some new ideas! Appreciate the patience. |
Hi @liweiyi88. Had a chat this morning about this and wanted to update you on the direction we're looking to take. First, we're going to move away from the tagging solution. It's just not that elegant and we don't want to rely on tagging for every github-specific property we want to add. second, if we think about the environment variable, it's something that should exist at the What does that mean? I've created a new api for a Since it's very different than what we were talking about and I had to scope it out, I ended up doing it myself. I hope you understand! I added a link to this discussion in the README as well as one of your screenshots (hopefully reviewers will let that one fly, but I'll try) |
@kaizencc , I totally understand and appreciate your time and effort on this feature. I am looking forward to using the new API in our existing projects to enable manual approval. |
) Fixes #162. Introduces a new API as follows: ```ts import { App } from 'aws-cdk-lib'; import { ShellStep } from 'aws-cdk-lib/pipelines'; import { GitHubWorkflow } from 'cdk-pipelines-github'; const app = new App(); const pipeline = new GitHubWorkflow(app, 'Pipeline', { synth: new ShellStep('Build', { commands: [ 'yarn install', 'yarn build', ], }), gitHubActionRoleArn: 'arn:aws:iam::<account-id>:role/GitHubActionRole', }); pipeline.addStageWithGitHubOptions(new MyStage(this, 'Beta', { env: BETA_ENV, gitHubEnvironment: 'beta', })); pipeline.addStageWithGitHubOptions(new MyStage(this, 'Prod', { env: PROD_ENV, gitHubEnvironment: 'prod', })); app.synth(); ``` Unlocks GitHub Environments at a stage-level, as well as a blueprint for any future stage-level github-specific properties we want to add.
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
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
After this step, nothing won't happen until we configure the environment like the below screenshot.
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.
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.
The text was updated successfully, but these errors were encountered: