// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`PDK Pipeline Py Unit Tests Custom AppEntrypoint 1`] = ` { ".gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.py and run "npx projen". /.gitattributes linguist-generated /.gitignore linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated /.projen/tasks.json linguist-generated /cdk.json linguist-generated /requirements-dev.txt linguist-generated /requirements.txt linguist-generated", ".gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.py and run "npx projen". node_modules/ !/.gitattributes !/.projen/tasks.json !/.projen/deps.json !/.projen/files.json /.env !/requirements.txt !/requirements-dev.txt __pycache__/ *.py[cod] *$py.class *.so .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST *.manifest *.spec pip-log.txt pip-delete-this-directory.txt htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ cover/ *.mo *.pot *.log local_settings.py db.sqlite3 db.sqlite3-journal instance/ .webassets-cache .scrapy docs/_build/ .pybuilder/ target/ .ipynb_checkpoints profile_default/ ipython_config.py __pypackages__/ celerybeat-schedule celerybeat.pid *.sage.py .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ .spyderproject .spyproject .ropeproject /site .mypy_cache/ .dmypy.json dmypy.json .pyre/ .pytype/ cython_debug/ !/cdk.json /cdk.out/ .cdk.staging/ ", ".projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.py and run "npx projen".", "dependencies": [ { "name": "projen", "type": "devenv", "version": "99.99.99", }, { "name": "pytest", "type": "devenv", }, { "name": "aws-cdk-lib", "type": "runtime", "version": "^2.0.0", }, { "name": "aws-prototyping-sdk.pdk-nag", "type": "runtime", }, { "name": "aws-prototyping-sdk.pipeline", "type": "runtime", }, { "name": "cdk-nag", "type": "runtime", }, { "name": "constructs", "type": "runtime", "version": "^10.0.5", }, { "name": "pyhumps", "type": "runtime", }, { "name": "pytest", "type": "test", "version": "6.2.1", }, ], }, ".projen/files.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.py and run "npx projen".", "files": [ ".gitattributes", ".gitignore", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", "cdk.json", "requirements-dev.txt", "requirements.txt", ], }, ".projen/tasks.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.py and run "npx projen".", "env": { "PATH": "$(echo $PWD/.env/bin:$PATH)", "VIRTUAL_ENV": "$(echo $PWD/.env)", }, "tasks": { "build": { "description": "Full release build", "name": "build", "steps": [ { "spawn": "default", }, { "spawn": "pre-compile", }, { "spawn": "compile", }, { "spawn": "post-compile", }, { "spawn": "test", }, { "spawn": "package", }, ], }, "clobber": { "condition": "git diff --exit-code > /dev/null", "description": "hard resets to HEAD of origin and cleans the local repo", "env": { "BRANCH": "$(git branch --show-current)", }, "name": "clobber", "steps": [ { "exec": "git checkout -b scratch", "name": "save current HEAD in "scratch" branch", }, { "exec": "git checkout $BRANCH", }, { "exec": "git fetch origin", "name": "fetch latest changes from origin", }, { "exec": "git reset --hard origin/$BRANCH", "name": "hard reset to origin commit", }, { "exec": "git clean -fdx", "name": "clean all untracked files", }, { "say": "ready to rock! (unpushed commits are under the "scratch" branch)", }, ], }, "compile": { "description": "Only compile", "name": "compile", }, "default": { "description": "Synthesize project files", "name": "default", "steps": [ { "exec": "python .projenrc.py", }, ], }, "deploy": { "description": "Deploys your CDK app to the AWS cloud", "name": "deploy", "steps": [ { "exec": "cdk deploy", "receiveArgs": true, }, ], }, "destroy": { "description": "Destroys your cdk app in the AWS cloud", "name": "destroy", "steps": [ { "exec": "cdk destroy", "receiveArgs": true, }, ], }, "diff": { "description": "Diffs the currently deployed app against your code", "name": "diff", "steps": [ { "exec": "cdk diff", }, ], }, "eject": { "description": "Remove projen from the project", "env": { "PROJEN_EJECTING": "true", }, "name": "eject", "steps": [ { "spawn": "default", }, ], }, "install": { "description": "Install and upgrade dependencies", "name": "install", "steps": [ { "exec": "pip install --upgrade pip", }, { "exec": "pip install -r requirements.txt", }, { "exec": "pip install -r requirements-dev.txt", }, ], }, "package": { "description": "Creates the distribution package", "name": "package", }, "post-compile": { "description": "Runs after successful compilation", "name": "post-compile", "steps": [ { "spawn": "synth:silent", }, ], }, "pre-compile": { "description": "Prepare the project for compilation", "name": "pre-compile", }, "synth": { "description": "Synthesizes your cdk app into cdk.out", "name": "synth", "steps": [ { "exec": "cdk synth", }, ], }, "synth:silent": { "description": "Synthesizes your cdk app into cdk.out and suppresses the template in stdout (part of "yarn build")", "name": "synth:silent", "steps": [ { "exec": "cdk synth -q", }, ], }, "test": { "description": "Run tests", "name": "test", "steps": [ { "exec": "pytest", }, ], }, "watch": { "description": "Watches changes in your source code and rebuilds and deploys to the current account", "name": "watch", "steps": [ { "exec": "cdk deploy --hotswap", }, { "exec": "cdk watch", }, ], }, }, }, "README.md": "# replace this", "cdk.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.py and run "npx projen".", "app": "python updated.py", "output": "cdk.out", "watch": { "exclude": [ "README.md", "cdk*.json", "requirements*.txt", "source.bat", "**/__init__.py", "python/__pycache__", "tests", ], "include": [ "**", ], }, }, "custom_app_entrypoint/application_stack.py": "from aws_cdk import Stack class ApplicationStack(Stack): def __init__(self, scope, id, **kwargs): super().__init__(scope, id, **kwargs) # TODO: Add resources ", "custom_app_entrypoint/application_stage.py": "from aws_cdk import Stage from application_stack import ApplicationStack class ApplicationStage(Stage): def __init__(self, scope, id, **kwargs): super().__init__(scope, id, **kwargs) ApplicationStack(self, 'MyApplication') ", "custom_app_entrypoint/pipeline.py": "import os from aws_cdk import App, Environment from pipeline_stack import PipelineStack from application_stage import ApplicationStage from aws_prototyping_sdk.pdk_nag import PDKNag from aws_prototyping_sdk.pipeline import PDKPipeline app = PDKNag.app() branch_prefix = PDKPipeline.get_branch_prefix(node=app.node) pipelineStack = PipelineStack(app, branch_prefix + "PipelineStack", env=Environment( account=os.environ["CDK_DEFAULT_ACCOUNT"], region=os.environ["CDK_DEFAULT_REGION"] )) devStage = ApplicationStage(app, branch_prefix + "Dev", env=Environment( account=os.environ["CDK_DEFAULT_ACCOUNT"], region=os.environ["CDK_DEFAULT_REGION"] )) pipelineStack.pipeline.add_stage(devStage) # Add additional stages here i.e. Prod # if PDKPipeline.is_default_branch(node=app.node): ... pipelineStack.pipeline.build_pipeline() # Needed for CDK Nag app.synth() ", "custom_app_entrypoint/pipeline_stack.py": "from aws_prototyping_sdk.pipeline import PDKPipeline, SonarCodeScannerConfig from aws_cdk import Stack, pipelines import json import humps class PipelineStack(Stack): def __init__(self, scope, id, **kwargs): super().__init__(scope, id, **kwargs) context = self.node.try_get_context("sonarqubeScannerConfig") repo_name = self.node.try_get_context("repositoryName") default_branch_name = self.node.try_get_context("defaultBranchName") sonar_config = None if repo_name is None: repo_name = "monorepo" if default_branch_name is None: default_branch_name = PDKPipeline.DEFAULT_BRANCH_NAME if context is not None: sonar_config = SonarCodeScannerConfig(**json.loads(json.dumps(humps.decamelize(context)))) self.pipeline = PDKPipeline(self, "Pipeline", primary_synth_directory="packages/infra/cdk.out", repository_name=repo_name, default_branch_name=default_branch_name, publish_assets_in_parallel=False, cross_account_keys=True, sonar_code_scanner_config=sonar_config, synth=pipelines.ShellStep("Unused", commands=[])) ", "requirements-dev.txt": "# ~~ Generated by projen. To modify, edit .projenrc.py and run "npx projen". projen==99.99.99 pytest ", "requirements.txt": "# ~~ Generated by projen. To modify, edit .projenrc.py and run "npx projen". aws-cdk-lib>=2.0.0, <3.0.0 aws-prototyping-sdk.pdk-nag aws-prototyping-sdk.pipeline cdk-nag constructs>=10.0.5, <11.0.0 pyhumps ", "tests/__init__.py": "", "tests/test_pipeline.py": "import pytest from aws_cdk import App from aws_cdk.assertions import Template from custom_app_entrypoint.pipeline_stack import PipelineStack @pytest.fixture(scope='module') def template(): app = App() stack = PipelineStack(app, "pipeline-stack-test") template = Template.from_stack(stack) yield template def test_pipeline_found(template): template.resource_count_is("AWS::CodePipeline::Pipeline", 1) ", } `; exports[`PDK Pipeline Py Unit Tests Defaults 1`] = ` { ".gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.py and run "npx projen". /.gitattributes linguist-generated /.gitignore linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated /.projen/tasks.json linguist-generated /cdk.json linguist-generated /requirements-dev.txt linguist-generated /requirements.txt linguist-generated", ".gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.py and run "npx projen". node_modules/ !/.gitattributes !/.projen/tasks.json !/.projen/deps.json !/.projen/files.json /.env !/requirements.txt !/requirements-dev.txt __pycache__/ *.py[cod] *$py.class *.so .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST *.manifest *.spec pip-log.txt pip-delete-this-directory.txt htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ cover/ *.mo *.pot *.log local_settings.py db.sqlite3 db.sqlite3-journal instance/ .webassets-cache .scrapy docs/_build/ .pybuilder/ target/ .ipynb_checkpoints profile_default/ ipython_config.py __pypackages__/ celerybeat-schedule celerybeat.pid *.sage.py .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ .spyderproject .spyproject .ropeproject /site .mypy_cache/ .dmypy.json dmypy.json .pyre/ .pytype/ cython_debug/ !/cdk.json /cdk.out/ .cdk.staging/ ", ".projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.py and run "npx projen".", "dependencies": [ { "name": "projen", "type": "devenv", "version": "99.99.99", }, { "name": "pytest", "type": "devenv", }, { "name": "aws-cdk-lib", "type": "runtime", "version": "^2.0.0", }, { "name": "aws-prototyping-sdk.pdk-nag", "type": "runtime", }, { "name": "aws-prototyping-sdk.pipeline", "type": "runtime", }, { "name": "cdk-nag", "type": "runtime", }, { "name": "constructs", "type": "runtime", "version": "^10.0.5", }, { "name": "pyhumps", "type": "runtime", }, { "name": "pytest", "type": "test", "version": "6.2.1", }, ], }, ".projen/files.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.py and run "npx projen".", "files": [ ".gitattributes", ".gitignore", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", "cdk.json", "requirements-dev.txt", "requirements.txt", ], }, ".projen/tasks.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.py and run "npx projen".", "env": { "PATH": "$(echo $PWD/.env/bin:$PATH)", "VIRTUAL_ENV": "$(echo $PWD/.env)", }, "tasks": { "build": { "description": "Full release build", "name": "build", "steps": [ { "spawn": "default", }, { "spawn": "pre-compile", }, { "spawn": "compile", }, { "spawn": "post-compile", }, { "spawn": "test", }, { "spawn": "package", }, ], }, "clobber": { "condition": "git diff --exit-code > /dev/null", "description": "hard resets to HEAD of origin and cleans the local repo", "env": { "BRANCH": "$(git branch --show-current)", }, "name": "clobber", "steps": [ { "exec": "git checkout -b scratch", "name": "save current HEAD in "scratch" branch", }, { "exec": "git checkout $BRANCH", }, { "exec": "git fetch origin", "name": "fetch latest changes from origin", }, { "exec": "git reset --hard origin/$BRANCH", "name": "hard reset to origin commit", }, { "exec": "git clean -fdx", "name": "clean all untracked files", }, { "say": "ready to rock! (unpushed commits are under the "scratch" branch)", }, ], }, "compile": { "description": "Only compile", "name": "compile", }, "default": { "description": "Synthesize project files", "name": "default", "steps": [ { "exec": "python .projenrc.py", }, ], }, "deploy": { "description": "Deploys your CDK app to the AWS cloud", "name": "deploy", "steps": [ { "exec": "cdk deploy", "receiveArgs": true, }, ], }, "destroy": { "description": "Destroys your cdk app in the AWS cloud", "name": "destroy", "steps": [ { "exec": "cdk destroy", "receiveArgs": true, }, ], }, "diff": { "description": "Diffs the currently deployed app against your code", "name": "diff", "steps": [ { "exec": "cdk diff", }, ], }, "eject": { "description": "Remove projen from the project", "env": { "PROJEN_EJECTING": "true", }, "name": "eject", "steps": [ { "spawn": "default", }, ], }, "install": { "description": "Install and upgrade dependencies", "name": "install", "steps": [ { "exec": "pip install --upgrade pip", }, { "exec": "pip install -r requirements.txt", }, { "exec": "pip install -r requirements-dev.txt", }, ], }, "package": { "description": "Creates the distribution package", "name": "package", }, "post-compile": { "description": "Runs after successful compilation", "name": "post-compile", "steps": [ { "spawn": "synth:silent", }, ], }, "pre-compile": { "description": "Prepare the project for compilation", "name": "pre-compile", }, "synth": { "description": "Synthesizes your cdk app into cdk.out", "name": "synth", "steps": [ { "exec": "cdk synth", }, ], }, "synth:silent": { "description": "Synthesizes your cdk app into cdk.out and suppresses the template in stdout (part of "yarn build")", "name": "synth:silent", "steps": [ { "exec": "cdk synth -q", }, ], }, "test": { "description": "Run tests", "name": "test", "steps": [ { "exec": "pytest", }, ], }, "watch": { "description": "Watches changes in your source code and rebuilds and deploys to the current account", "name": "watch", "steps": [ { "exec": "cdk deploy --hotswap", }, { "exec": "cdk watch", }, ], }, }, }, "README.md": "# replace this", "cdk.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.py and run "npx projen".", "app": "python defaults/pipeline.py", "output": "cdk.out", "watch": { "exclude": [ "README.md", "cdk*.json", "requirements*.txt", "source.bat", "**/__init__.py", "python/__pycache__", "tests", ], "include": [ "**", ], }, }, "defaults/application_stack.py": "from aws_cdk import Stack class ApplicationStack(Stack): def __init__(self, scope, id, **kwargs): super().__init__(scope, id, **kwargs) # TODO: Add resources ", "defaults/application_stage.py": "from aws_cdk import Stage from application_stack import ApplicationStack class ApplicationStage(Stage): def __init__(self, scope, id, **kwargs): super().__init__(scope, id, **kwargs) ApplicationStack(self, 'MyApplication') ", "defaults/pipeline.py": "import os from aws_cdk import App, Environment from pipeline_stack import PipelineStack from application_stage import ApplicationStage from aws_prototyping_sdk.pdk_nag import PDKNag from aws_prototyping_sdk.pipeline import PDKPipeline app = PDKNag.app() branch_prefix = PDKPipeline.get_branch_prefix(node=app.node) pipelineStack = PipelineStack(app, branch_prefix + "PipelineStack", env=Environment( account=os.environ["CDK_DEFAULT_ACCOUNT"], region=os.environ["CDK_DEFAULT_REGION"] )) devStage = ApplicationStage(app, branch_prefix + "Dev", env=Environment( account=os.environ["CDK_DEFAULT_ACCOUNT"], region=os.environ["CDK_DEFAULT_REGION"] )) pipelineStack.pipeline.add_stage(devStage) # Add additional stages here i.e. Prod # if PDKPipeline.is_default_branch(node=app.node): ... pipelineStack.pipeline.build_pipeline() # Needed for CDK Nag app.synth() ", "defaults/pipeline_stack.py": "from aws_prototyping_sdk.pipeline import PDKPipeline, SonarCodeScannerConfig from aws_cdk import Stack, pipelines import json import humps class PipelineStack(Stack): def __init__(self, scope, id, **kwargs): super().__init__(scope, id, **kwargs) context = self.node.try_get_context("sonarqubeScannerConfig") repo_name = self.node.try_get_context("repositoryName") default_branch_name = self.node.try_get_context("defaultBranchName") sonar_config = None if repo_name is None: repo_name = "monorepo" if default_branch_name is None: default_branch_name = PDKPipeline.DEFAULT_BRANCH_NAME if context is not None: sonar_config = SonarCodeScannerConfig(**json.loads(json.dumps(humps.decamelize(context)))) self.pipeline = PDKPipeline(self, "Pipeline", primary_synth_directory="packages/infra/cdk.out", repository_name=repo_name, default_branch_name=default_branch_name, publish_assets_in_parallel=False, cross_account_keys=True, sonar_code_scanner_config=sonar_config, synth=pipelines.ShellStep("Unused", commands=[])) ", "requirements-dev.txt": "# ~~ Generated by projen. To modify, edit .projenrc.py and run "npx projen". projen==99.99.99 pytest ", "requirements.txt": "# ~~ Generated by projen. To modify, edit .projenrc.py and run "npx projen". aws-cdk-lib>=2.0.0, <3.0.0 aws-prototyping-sdk.pdk-nag aws-prototyping-sdk.pipeline cdk-nag constructs>=10.0.5, <11.0.0 pyhumps ", "tests/__init__.py": "", "tests/test_pipeline.py": "import pytest from aws_cdk import App from aws_cdk.assertions import Template from defaults.pipeline_stack import PipelineStack @pytest.fixture(scope='module') def template(): app = App() stack = PipelineStack(app, "pipeline-stack-test") template = Template.from_stack(stack) yield template def test_pipeline_found(template): template.resource_count_is("AWS::CodePipeline::Pipeline", 1) ", } `; exports[`PDK Pipeline Py Unit Tests With Context 1`] = ` { ".gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.py and run "npx projen". /.gitattributes linguist-generated /.gitignore linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated /.projen/tasks.json linguist-generated /cdk.json linguist-generated /requirements-dev.txt linguist-generated /requirements.txt linguist-generated", ".gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.py and run "npx projen". node_modules/ !/.gitattributes !/.projen/tasks.json !/.projen/deps.json !/.projen/files.json /.env !/requirements.txt !/requirements-dev.txt __pycache__/ *.py[cod] *$py.class *.so .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST *.manifest *.spec pip-log.txt pip-delete-this-directory.txt htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ cover/ *.mo *.pot *.log local_settings.py db.sqlite3 db.sqlite3-journal instance/ .webassets-cache .scrapy docs/_build/ .pybuilder/ target/ .ipynb_checkpoints profile_default/ ipython_config.py __pypackages__/ celerybeat-schedule celerybeat.pid *.sage.py .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ .spyderproject .spyproject .ropeproject /site .mypy_cache/ .dmypy.json dmypy.json .pyre/ .pytype/ cython_debug/ !/cdk.json /cdk.out/ .cdk.staging/ ", ".projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.py and run "npx projen".", "dependencies": [ { "name": "projen", "type": "devenv", "version": "99.99.99", }, { "name": "pytest", "type": "devenv", }, { "name": "aws-cdk-lib", "type": "runtime", "version": "^2.0.0", }, { "name": "aws-prototyping-sdk.pdk-nag", "type": "runtime", }, { "name": "aws-prototyping-sdk.pipeline", "type": "runtime", }, { "name": "cdk-nag", "type": "runtime", }, { "name": "constructs", "type": "runtime", "version": "^10.0.5", }, { "name": "pyhumps", "type": "runtime", }, { "name": "pytest", "type": "test", "version": "6.2.1", }, ], }, ".projen/files.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.py and run "npx projen".", "files": [ ".gitattributes", ".gitignore", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", "cdk.json", "requirements-dev.txt", "requirements.txt", ], }, ".projen/tasks.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.py and run "npx projen".", "env": { "PATH": "$(echo $PWD/.env/bin:$PATH)", "VIRTUAL_ENV": "$(echo $PWD/.env)", }, "tasks": { "build": { "description": "Full release build", "name": "build", "steps": [ { "spawn": "default", }, { "spawn": "pre-compile", }, { "spawn": "compile", }, { "spawn": "post-compile", }, { "spawn": "test", }, { "spawn": "package", }, ], }, "clobber": { "condition": "git diff --exit-code > /dev/null", "description": "hard resets to HEAD of origin and cleans the local repo", "env": { "BRANCH": "$(git branch --show-current)", }, "name": "clobber", "steps": [ { "exec": "git checkout -b scratch", "name": "save current HEAD in "scratch" branch", }, { "exec": "git checkout $BRANCH", }, { "exec": "git fetch origin", "name": "fetch latest changes from origin", }, { "exec": "git reset --hard origin/$BRANCH", "name": "hard reset to origin commit", }, { "exec": "git clean -fdx", "name": "clean all untracked files", }, { "say": "ready to rock! (unpushed commits are under the "scratch" branch)", }, ], }, "compile": { "description": "Only compile", "name": "compile", }, "default": { "description": "Synthesize project files", "name": "default", "steps": [ { "exec": "python .projenrc.py", }, ], }, "deploy": { "description": "Deploys your CDK app to the AWS cloud", "name": "deploy", "steps": [ { "exec": "cdk deploy", "receiveArgs": true, }, ], }, "destroy": { "description": "Destroys your cdk app in the AWS cloud", "name": "destroy", "steps": [ { "exec": "cdk destroy", "receiveArgs": true, }, ], }, "diff": { "description": "Diffs the currently deployed app against your code", "name": "diff", "steps": [ { "exec": "cdk diff", }, ], }, "eject": { "description": "Remove projen from the project", "env": { "PROJEN_EJECTING": "true", }, "name": "eject", "steps": [ { "spawn": "default", }, ], }, "install": { "description": "Install and upgrade dependencies", "name": "install", "steps": [ { "exec": "pip install --upgrade pip", }, { "exec": "pip install -r requirements.txt", }, { "exec": "pip install -r requirements-dev.txt", }, ], }, "package": { "description": "Creates the distribution package", "name": "package", }, "post-compile": { "description": "Runs after successful compilation", "name": "post-compile", "steps": [ { "spawn": "synth:silent", }, ], }, "pre-compile": { "description": "Prepare the project for compilation", "name": "pre-compile", }, "synth": { "description": "Synthesizes your cdk app into cdk.out", "name": "synth", "steps": [ { "exec": "cdk synth", }, ], }, "synth:silent": { "description": "Synthesizes your cdk app into cdk.out and suppresses the template in stdout (part of "yarn build")", "name": "synth:silent", "steps": [ { "exec": "cdk synth -q", }, ], }, "test": { "description": "Run tests", "name": "test", "steps": [ { "exec": "pytest", }, ], }, "watch": { "description": "Watches changes in your source code and rebuilds and deploys to the current account", "name": "watch", "steps": [ { "exec": "cdk deploy --hotswap", }, { "exec": "cdk watch", }, ], }, }, }, "README.md": "# replace this", "cdk.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.py and run "npx projen".", "app": "python with_context/pipeline.py", "context": { "sonarqubeScannerConfig": { "preArchiveCommands": [ "echo here", ], "sonarqubeAuthorizedGroup": "group", "sonarqubeDefaultProfileOrGateName": "default", "sonarqubeEndpoint": "https://my.endpoint", "sonarqubeProjectName": "WithContext", "sonarqubeSpecificProfileOrGateName": "specific", "sonarqubeTags": [ "sample", ], }, }, "output": "cdk.out", "watch": { "exclude": [ "README.md", "cdk*.json", "requirements*.txt", "source.bat", "**/__init__.py", "python/__pycache__", "tests", ], "include": [ "**", ], }, }, "requirements-dev.txt": "# ~~ Generated by projen. To modify, edit .projenrc.py and run "npx projen". projen==99.99.99 pytest ", "requirements.txt": "# ~~ Generated by projen. To modify, edit .projenrc.py and run "npx projen". aws-cdk-lib>=2.0.0, <3.0.0 aws-prototyping-sdk.pdk-nag aws-prototyping-sdk.pipeline cdk-nag constructs>=10.0.5, <11.0.0 pyhumps ", "tests/__init__.py": "", "tests/test_pipeline.py": "import pytest from aws_cdk import App from aws_cdk.assertions import Template from with_context.pipeline_stack import PipelineStack @pytest.fixture(scope='module') def template(): app = App() stack = PipelineStack(app, "pipeline-stack-test") template = Template.from_stack(stack) yield template def test_pipeline_found(template): template.resource_count_is("AWS::CodePipeline::Pipeline", 1) ", "with_context/application_stack.py": "from aws_cdk import Stack class ApplicationStack(Stack): def __init__(self, scope, id, **kwargs): super().__init__(scope, id, **kwargs) # TODO: Add resources ", "with_context/application_stage.py": "from aws_cdk import Stage from application_stack import ApplicationStack class ApplicationStage(Stage): def __init__(self, scope, id, **kwargs): super().__init__(scope, id, **kwargs) ApplicationStack(self, 'MyApplication') ", "with_context/pipeline.py": "import os from aws_cdk import App, Environment from pipeline_stack import PipelineStack from application_stage import ApplicationStage from aws_prototyping_sdk.pdk_nag import PDKNag from aws_prototyping_sdk.pipeline import PDKPipeline app = PDKNag.app() branch_prefix = PDKPipeline.get_branch_prefix(node=app.node) pipelineStack = PipelineStack(app, branch_prefix + "PipelineStack", env=Environment( account=os.environ["CDK_DEFAULT_ACCOUNT"], region=os.environ["CDK_DEFAULT_REGION"] )) devStage = ApplicationStage(app, branch_prefix + "Dev", env=Environment( account=os.environ["CDK_DEFAULT_ACCOUNT"], region=os.environ["CDK_DEFAULT_REGION"] )) pipelineStack.pipeline.add_stage(devStage) # Add additional stages here i.e. Prod # if PDKPipeline.is_default_branch(node=app.node): ... pipelineStack.pipeline.build_pipeline() # Needed for CDK Nag app.synth() ", "with_context/pipeline_stack.py": "from aws_prototyping_sdk.pipeline import PDKPipeline, SonarCodeScannerConfig from aws_cdk import Stack, pipelines import json import humps class PipelineStack(Stack): def __init__(self, scope, id, **kwargs): super().__init__(scope, id, **kwargs) context = self.node.try_get_context("sonarqubeScannerConfig") repo_name = self.node.try_get_context("repositoryName") default_branch_name = self.node.try_get_context("defaultBranchName") sonar_config = None if repo_name is None: repo_name = "monorepo" if default_branch_name is None: default_branch_name = PDKPipeline.DEFAULT_BRANCH_NAME if context is not None: sonar_config = SonarCodeScannerConfig(**json.loads(json.dumps(humps.decamelize(context)))) self.pipeline = PDKPipeline(self, "Pipeline", primary_synth_directory="packages/infra/cdk.out", repository_name=repo_name, default_branch_name=default_branch_name, publish_assets_in_parallel=False, cross_account_keys=True, sonar_code_scanner_config=sonar_config, synth=pipelines.ShellStep("Unused", commands=[])) ", } `; exports[`PDK Pipeline Py Unit Tests projenrc synth correctly 1`] = ` "from aws_prototyping_sdk.pipeline import PDKPipelinePyProject project = PDKPipelinePyProject( author_email="test@test.com", author_name="test", module_name="defaults", version="0.0.0", cdk_version="2.0.0", name="ProjenRc", ) project.synth()" `;