Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Accessing context objects for project details

Focus mode
Accessing context objects for project details - Amazon CodeCatalyst

As a blueprint author, you can access context from the blueprint’s project during synthesis to get information like space and project names, or existing files in a project’s source repository. You can also get details like the phase of resynthesis that the blueprint is generating. For example, you can access context to know if you’re resynthesizing to generate an ancestor bundle or proposed bundle. Existing code context can then be used to transform your code in your repository. For example, you can write your own resynthesis strategy to set specific code standards. The strategy can be added to the blueprint.ts file for small blueprints, or you can create a separate file for strategies.

The following example shows how you can find files in a project's context, set a workflow builder, and set a blueprint-vended resynthesis strategy for a particular file:

const contextFiles = this.context.project.src.findAll({ fileGlobs: ['**/package.json'], }); // const workflows = this.context.project.src.findAll({ // fileGlobs: ['**/.codecatalyst/**.yaml'], // }); const security = new WorkflowBuilder(this, { Name: 'security-workflow', }); new Workflow(this, repo, security.getDefinition()); repo.setResynthStrategies([ { identifier: 'force-security', globs: ['**/.codecatalyst/security-workflow.yaml'], strategy: MergeStrategies.alwaysUpdate, }, ]); for (const contextFile of contextFiles) { const packageObject = JSON.parse(contextFile.buffer.toString()); new SourceFile(internalRepo, contextFile.path, JSON.stringify({ ...packageObject, }, null, 2)); } }
PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.