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

Support Manual approval notification #17

Closed
dirk39 opened this issue Apr 16, 2021 · 6 comments
Closed

Support Manual approval notification #17

dirk39 opened this issue Apr 16, 2021 · 6 comments

Comments

@dirk39
Copy link
Contributor

dirk39 commented Apr 16, 2021

Hi! what do you think about the support of codepipeline-pipeline-manual-approval-needed event type? In this way can be notified about approval needed. I'm available to code this part.

Let me know

cheers

@kjagiello
Copy link
Owner

I believe we already support this through the event_type_ids attribute. See the PR introducing this change for exactly this purpose: #9

@dirk39
Copy link
Contributor Author

dirk39 commented Apr 16, 2021

looking at the lambda code and the README I don't see support for this event :(

@kjagiello
Copy link
Owner

kjagiello commented Apr 16, 2021

Something like this should work:

module "codepipeline_notifications" {
  source  = "kjagiello/codepipeline-slack-notifications/aws"
  version = "1.1.3"

  name          = "codepipeline-notifications"
  namespace     = "kjagiello"
  stage         = "sandbox"
  slack_url     = "https://hooks.slack.com/services/(...)"
  slack_channel = "#notifications"
  event_type_ids = [
    "codepipeline-pipeline-pipeline-execution-failed",
    "codepipeline-pipeline-pipeline-execution-canceled",
    "codepipeline-pipeline-pipeline-execution-started",
    "codepipeline-pipeline-pipeline-execution-resumed",
    "codepipeline-pipeline-pipeline-execution-succeeded",
    "codepipeline-pipeline-pipeline-execution-superseded",

    # Manual approvals
    "codepipeline-pipeline-manual-approval-needed",
  ]
  codepipelines = [
    aws_codepipeline.example,
  ]
}

@dirk39
Copy link
Contributor Author

dirk39 commented Apr 16, 2021

The function code should be change because the approval event is a little bit different:

{
    "Records": [
        {
            "EventVersion": "1.0",
            "EventSubscriptionArn": "arn:aws:sns:eu-west-1:11111111:DeveloperNotifications:d3ab24eb-3a37-4b6b-810d-4724ad1a378a",
            "EventSource": "aws:sns",
            "Sns": {
                "Signature": "nsTcPYxyTfqzHhynf7cFLESjxsccT4MeDJKouyZjt9YZFyEp1+j/TiXUx3wLA4z+7r3EuEO5P+hFgUgf6Nx5V7Bv8J1sYswIo2R9f1Zle0HJCByKoBhesCXid4hIswHnq3CeRab/vntlUCSSx/UZXN/1fjEe4kDx5FuLwsgrqhXgrLDOMzrIrAss/2nYk+kRYcUPm6IyTYjmc33/EcR/dZ+Zj5gNXpfcLH6slVT3sQw+1aHTDmoTediB/uxOZi7+7yIs4B6k6O6tkYDKJBnUZit7V6JnNmwEvn6Ed0gOyjKhCSxn1Xx5/SC39mtcA+oVq8B93bqKhSzsxbsYI8iJUg==",
                "MessageId": "6ff02de3-b1de-55b6-8f47-75102439001f",
                "Type": "Notification",
                "TopicArn": "arn:aws:sns:eu-west-1:11111111:DeveloperNotifications",
                "MessageAttributes": {},
                "SignatureVersion": "1",
                "Timestamp": "2021-04-16T13:39:51.88Z",
                "SigningCertUrl": "https://sns.eu-west-1.amazonaws.com/SimpleNotificationService-010a507c1833636cd94bdb98bd93083a.pem",
                "Message": "{\"account\":\"11111111\",\"detailType\":\"CodePipeline Action Execution State Change\",\"region\":\"eu-west-1\",\"source\":\"aws.codepipeline\",\"time\":\"2021-04-16T13:39:46Z\",\"notificationRuleArn\":\"arn:aws:codestar-notifications:eu-west-1:11111111:notificationrule/978d75c8bab46fbc53be39e96592029eedfa4510\",\"detail\":{\"pipeline\":\"DeployDashboard\",\"execution-id\":\"1d86ec1d-b048-470d-a8dc-5a45ac8659f7\",\"stage\":\"DeployApproval\",\"action\":\"Approve\",\"state\":\"STARTED\",\"region\":\"eu-west-1\",\"type\":{\"owner\":\"AWS\",\"provider\":\"Manual\",\"category\":\"Approval\",\"version\":\"1\"},\"version\":4.0},\"resources\":[\"arn:aws:codepipeline:eu-west-1:11111111:DeployDashboard\"],\"additionalAttributes\":{\"externalEntityLink\":\"\",\"customData\":\"\"}}",
                "UnsubscribeUrl": "https://sns.eu-west-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:eu-west-1:11111111:DeveloperNotifications:d3ab24eb-3a37-4b6b-810d-4724ad1a378a",
                "Subject": ""
            }
        }
    ]
}

As you can see the state, used to determine the color, is always STARTED, but the type nested object is different.

@kjagiello
Copy link
Owner

kjagiello commented Apr 16, 2021

Yeah, I agree. Both the color and the message itself might need some more love. Right now it looks just confusing.
image

@kjagiello
Copy link
Owner

kjagiello commented Dec 17, 2023

I know it's been long overdue, but I have finally found some time to improve the state of approval notifications. See #35.

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

No branches or pull requests

2 participants