-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPipeline.py
55 lines (47 loc) · 2.36 KB
/
Pipeline.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from aws_cdk import (
aws_s3,
aws_codecommit,
Stack,
App,
Stage
)
from aws_cdk.pipelines import (
CodePipeline,
ShellStep,
CodePipelineSource
)
from PelotonNotifier import PelotonNotifier
import os
class PipelineS(Stack):
def __init__(self, app: App, id: str, **kwargs) -> None:
super().__init__(app, id)
# bucket = aws_s3.Bucket(self, 'Bucket', versioned=True)
repo = aws_codecommit.Repository(self, 'Repo', repository_name='pipeline-mirror')
# env = core.Environment(account=os.environ['CDK_DEFAULT_ACCOUNT'], region=os.environ['CDK_DEFAULT_REGION'])
pipeline = CodePipeline(self, "Pipeline",
synth=ShellStep("Synth",
# Use a connection created using the AWS console to authenticate to GitHub
# Other sources are available.
# input=CodePipelineSource.s3(bucket=bucket, object_key="repo.zip",
# action_name="GitZip"
# ),
input=CodePipelineSource.code_commit(repository=repo, branch="dev",
),
commands=["npm ci", "npm run build", "npx cdk synth"
]
)
)
# 'MyApplication' is defined below. Call `addStage` as many times as
# necessary with any account and region (may be different from the
# pipeline's).
pipeline.add_stage(MyApplication(self, "Prod",
# env=Environment(
# account="12345",
# region="us-east-1"
# )
))
class MyApplication(Stage):
def __init__(self, scope, id, *, env=None, outdir=None):
super().__init__(scope, id, env=env, outdir=outdir)
app = App()
MainStack = PelotonNotifier(self, "PelotonNotify2")