#slack / msteams / email notifications for developer tools: CodeCommit, CodeBuild, CodeDeploy, CodePipeline
Project description
@cloudcomponents/cdk-developer-tools-notifications
#slack / msteams / email notifications for developer tools: CodeCommit, CodeBuild, CodeDeploy, CodePipeline
Install
TypeScript/JavaScript:
npm i @cloudcomponents/cdk-developer-tools-notifications
Python:
pip install cloudcomponents.cdk-developer-tools-notifications
MSTeams
- Navigate to the channel where you want to add the webhook and select (•••) More Options from the top navigation bar.
- Choose Connectors from the drop-down menu and search for Incoming Webhook.
- Select the Configure button, provide a name, and, optionally, upload an image avatar for your webhook.
- The dialog window will present a unique URL that will map to the channel. Make sure that you copy and save the URL—you will need to provide it to the outside service.
- Select the Done button. The webhook will be available in the team channel.
#Slack
Notifications for AWS developer tools
How to use
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
from aws_cdk.core import Construct, Stack, StackProps
from aws_cdk.aws_codecommit import Repository
from aws_cdk.aws_codepipeline import Pipeline, Artifact
from aws_cdk.aws_codepipeline_actions import CodeCommitSourceAction, ManualApprovalAction
from cloudcomponents.cdk_developer_tools_notifications import RepositoryNotificationRule, PipelineNotificationRule, RepositoryEvent, PipelineEvent, SlackChannel, MSTeamsIncomingWebhook
from cloudcomponents.cdk_chatops import SlackChannelConfiguration, MSTeamsIncomingWebhookConfiguration, AccountLabelMode
class NotificationsStack(Stack):
def __init__(self, scope, id, *, description=None, env=None, stackName=None, tags=None, synthesizer=None, terminationProtection=None, analyticsReporting=None):
super().__init__(scope, id, description=description, env=env, stackName=stackName, tags=tags, synthesizer=synthesizer, terminationProtection=terminationProtection, analyticsReporting=analyticsReporting)
repository = Repository(self, "Repository",
repository_name="notifications-repository"
)
slack_channel = SlackChannelConfiguration(self, "SlackChannel",
slack_workspace_id=process.env.SLACK_WORKSPACE_ID,
configuration_name="notifications",
slack_channel_id=process.env.SLACK_CHANNEL_ID
)
webhook = MSTeamsIncomingWebhookConfiguration(self, "MSTeamsWebhook",
url=process.env.INCOMING_WEBHOOK_URL,
account_label_mode=AccountLabelMode.ID_AND_ALIAS,
theme_color="#FF0000"
)
RepositoryNotificationRule(self, "RepoNotifications",
name="notifications-repository",
repository=repository,
events=[RepositoryEvent.COMMENTS_ON_COMMITS, RepositoryEvent.PULL_REQUEST_CREATED, RepositoryEvent.PULL_REQUEST_MERGED
],
targets=[
SlackChannel(slack_channel),
MSTeamsIncomingWebhook(webhook)
]
)
source_artifact = Artifact()
source_action = CodeCommitSourceAction(
action_name="CodeCommit",
repository=repository,
output=source_artifact
)
approval_action = ManualApprovalAction(
action_name="Approval"
)
pipeline = Pipeline(self, "Pipeline",
pipeline_name="notifications-pipeline",
stages=[StageProps(
stage_name="Source",
actions=[source_action]
), StageProps(
stage_name="Approval",
actions=[approval_action]
)
]
)
PipelineNotificationRule(self, "PipelineNotificationRule",
name="pipeline-notification",
pipeline=pipeline,
events=[PipelineEvent.PIPELINE_EXECUTION_STARTED, PipelineEvent.PIPELINE_EXECUTION_FAILED, PipelineEvent.PIPELINE_EXECUTION_SUCCEEDED, PipelineEvent.MANUAL_APPROVAL_NEEDED, PipelineEvent.MANUAL_APPROVAL_SUCCEEDED
],
targets=[
SlackChannel(slack_channel),
MSTeamsIncomingWebhook(webhook)
]
)
API Reference
See API.md.
Example
See more complete examples.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for cloudcomponents.cdk-developer-tools-notifications-1.43.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7dafd09936fe68b5fcca23e7b47a63b0a797847a76dbf58c0e474e162a1d4d6e |
|
MD5 | 5ce24dc5177741ab1b20ef221fdc9750 |
|
BLAKE2b-256 | 68c3557b759ef33acec10092ec4d3756d6bb6ca042aff29d267cad6d0bae042e |
Close
Hashes for cloudcomponents.cdk_developer_tools_notifications-1.43.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3340ac89b1b36ba0d3cc68ce6371ae77045b7a1c2bbe37c090368c3794ee5e4e |
|
MD5 | 112d8671c22ed844a6827e4a587c04de |
|
BLAKE2b-256 | be5aea3322e9a2b80aed773e7303250a8a3dfcaaa38d074c5008edf10d557db2 |