Cdk component that provisions a #slack approval workflow and notification messages on codepipeline state changes
Project description
@cloudcomponents/cdk-codepipeline-slack
Cdk component that provisions a #slack approval workflow and notification messages on codepipeline state changes
Install
TypeScript/JavaScript:
npm install --save @cloudcomponents/cdk-codepipeline-slack
Python:
pip install cloudcomponents.cdk-codepipeline-slack
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, CodeBuildAction
from aws_cdk.aws_codebuild import PipelineProject
from cloudcomponents.cdk_codepipeline_slack import SlackApprovalAction, SlackNotifier
class CodePipelineSlackApprovalStack(Stack):
def __init__(self, scope, id, *, description=None, env=None, stackName=None, tags=None, synthesizer=None, terminationProtection=None):
super().__init__(scope, id, description=description, env=env, stackName=stackName, tags=tags, synthesizer=synthesizer, terminationProtection=terminationProtection)
repository = Repository(self, "Repository",
repository_name="MyRepositoryName"
)
source_artifact = Artifact()
source_action = CodeCommitSourceAction(
action_name="CodeCommit",
repository=repository,
output=source_artifact
)
project = PipelineProject(self, "MyProject")
build_action = CodeBuildAction(
action_name="CodeBuild",
project=project,
input=source_artifact
)
slack_bot_token = process.env.SLACK_BOT_TOKEN
slack_signing_secret = process.env.SLACK_SIGNING_SECRET
slack_channel = process.env.SLACK_CHANNEL_NAME
approval_action = SlackApprovalAction(
action_name="SlackApproval",
slack_bot_token=slack_bot_token,
slack_signing_secret=slack_signing_secret,
slack_channel=slack_channel,
external_entity_link="http://cloudcomponents.org",
additional_information="Would you like to promote the build to production?"
)
pipeline = Pipeline(self, "MyPipeline",
pipeline_name="MyPipeline",
stages=[StageProps(
stage_name="Source",
actions=[source_action]
), StageProps(
stage_name="Build",
actions=[build_action]
), StageProps(
stage_name="Approval",
actions=[approval_action]
)
]
)
SlackNotifier(self, "SlackNotifier",
pipeline=pipeline,
slack_bot_token=slack_bot_token,
slack_signing_secret=slack_signing_secret,
slack_channel=slack_channel
)
Slack App Settings
Create an app that’s just for your workspace
OAuth & Permissions
Grant the channels::history
-Scope to the Bot in your app and Add the Bot to the configured Slack-Channel
Select Permission Scopes:
Interactive Components
Enter the url of your api from the AWS Api Gateway and append /slack/actions
:
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-codepipeline-slack-1.0.84.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | dfeb161ab28674f9844c00bac62390c65cb0a2bc53c8d7f4dfa16041218db021 |
|
MD5 | 0a212ab81f896ceb0a30c21ac47b04ec |
|
BLAKE2b-256 | 2b7678ac502e2febbc7cf3d6b70c6b0d372a406d8dd7aabdf866ccbe85a8070a |
Close
Hashes for cloudcomponents.cdk_codepipeline_slack-1.0.84-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb0192dab4915e13efe47e062b9c81bcf000906ea32eb899aa2208fba4a9d534 |
|
MD5 | 450b32b5cd2ec4bd91ec66a29b57bc9f |
|
BLAKE2b-256 | d7932f3a23984f7f27806b3d2710cc111e8789a14cd3d5b4f52d431c84110901 |