0.3.111 • Published 6 days ago

@amazon-codecatalyst/blueprint-component.workflows v0.3.111

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
6 days ago
import {...} from '@amazon-codecatalyst/blueprint-component.workflows'

The workflow component can be found here.

What is a workflow component?

A workflow is used by CodeCatalyst projects to execute some actions based off triggers. The blueprints team exposes some helpful workflows components that are meant to help in building and putting together workflow yaml files. See public workflows documentation for general use.

import { WorkflowBuilder, Workflow } from '@amazon-codecatalyst/blueprint-component.workflows'

Example 1: WorkflowBuilder component

This is a class that helps build a workflow definition. This can then be given over to a workflow component for rendering in a repository.

import { WorkflowBuilder } from '@amazon-codecatalyst/blueprint-component.workflows'

const workflowBuilder = new WorkflowBuilder({} as Blueprint, {
  Name: 'my_workflow',
});

// trigger the workflow on pushes to branch 'main'
workflowBuilder.addBranchTrigger(['main']);

// add a build action
workflowBuilder.addBuildAction({
  // give the action a name
  actionName: 'build_and_do_some_other_stuff',

  // the action pulls from source code
  input: {
    Sources: ['WorkflowSource'],
  },

  // the output attempts to autodiscover test reports, but not in the node modules
  output: {
    AutoDiscoverReports: {
      Enabled: true,
      ReportNamePrefix: AutoDiscovered,
      IncludePaths: ['**/*'],
      ExcludePaths: ['*/node_modules/**/*'],
    },
  },
  // execute some arbitrary steps
  steps: [
    'npm install',
    'npm run myscript',
    'echo hello-world',
  ],
  // add an account connection to the workflow
  environment: convertToWorkflowEnvironment(myEnv),
});

Example 2: Workflow projen component

This is a projen component that writes a workflow yaml to a repository.

import { Workflow } from '@amazon-codecatalyst/blueprint-component.workflows'

...

const repo = new SourceRepository
const blueprint = this;
const workflowDef = workflowBuilder.getDefinition()

// creates a workflow.yaml at .aws/workflows/${workflowDef.name}.yaml
new Workflow(blueprint, repo, workflowDef);

// can also pass in any object and have it rendered as a yaml. This is unsafe and may not produce a valid workflow
new Workflow(blueprint, repo, {... some object ...});

Connecting to an environment

Many workflows need to run in an AWS account connection. Workflows deal with this by allowing actions to connect to environments, with account and role name specifications.

import { convertToWorkflowEnvironment } from '@amazon-codecatalyst/blueprint-component.workflows'


const myEnv = new Environment(...);

// can be passed into a workflow constructor
const workflowEnvironment = convertToWorkflowEnvironment(myEnv);


// add a build action
workflowBuilder.addBuildAction({
  ...
  // add an account connection to the workflow
  environment: convertToWorkflowEnvironment(myEnv),
});
0.3.111

6 days ago

0.3.110

11 days ago

0.3.109

14 days ago

0.3.108

14 days ago

0.3.107

17 days ago

0.3.105

19 days ago

0.3.106

19 days ago

0.3.103

20 days ago

0.3.104

20 days ago

0.3.101

21 days ago

0.3.102

21 days ago

0.3.100

24 days ago

0.3.99

24 days ago

0.3.98

25 days ago

0.3.97

26 days ago

0.3.96

27 days ago

0.3.95

28 days ago

0.3.94

1 month ago

0.3.93

1 month ago

0.3.92

1 month ago

0.3.91

1 month ago

0.3.90

1 month ago

0.3.89

1 month ago

0.3.88

1 month ago

0.3.87

1 month ago

0.3.86

1 month ago

0.3.85

2 months ago

0.3.84

2 months ago

0.3.82

2 months ago

0.3.81

2 months ago

0.3.79

2 months ago

0.3.80

2 months ago

0.3.78

2 months ago

0.3.77

2 months ago

0.3.76

2 months ago

0.3.75

2 months ago

0.3.74

2 months ago

0.3.73

2 months ago

0.3.72

2 months ago

0.3.71

2 months ago

0.3.70

2 months ago

0.3.69

2 months ago

0.3.68

2 months ago

0.3.67

2 months ago

0.3.66

2 months ago

0.3.65

2 months ago

0.3.64

2 months ago

0.3.63

2 months ago

0.3.62

2 months ago

0.3.61

2 months ago

0.3.60

3 months ago

0.3.59

3 months ago

0.3.58

3 months ago

0.3.57

3 months ago

0.3.53

3 months ago

0.3.52

3 months ago

0.3.55

3 months ago

0.3.54

3 months ago

0.3.51

3 months ago

0.3.50

3 months ago

0.3.49

4 months ago

0.3.48

4 months ago

0.3.47

4 months ago

0.3.46

4 months ago

0.3.42

4 months ago

0.3.41

4 months ago

0.3.45

4 months ago

0.3.44

4 months ago

0.3.43

4 months ago

0.3.40

4 months ago

0.3.39

4 months ago

0.3.38

4 months ago

0.3.37

4 months ago

0.3.36

4 months ago

0.3.35

5 months ago

0.3.34

5 months ago

0.3.33

5 months ago

0.3.31

5 months ago

0.3.32

5 months ago

0.3.30

5 months ago

0.3.29

5 months ago

0.3.28

6 months ago

0.3.27

6 months ago

0.3.26

6 months ago

0.3.25

6 months ago

0.3.24

6 months ago

0.3.23

6 months ago

0.3.22

6 months ago

0.3.21

7 months ago

0.3.20

7 months ago

0.3.19

7 months ago

0.3.18

7 months ago

0.3.17

7 months ago

0.3.16

7 months ago

0.3.15

7 months ago

0.3.14

7 months ago

0.3.13

7 months ago

0.3.12

7 months ago

0.3.11

7 months ago

0.3.10

7 months ago

0.3.9

7 months ago

0.3.8

7 months ago

0.3.7

7 months ago

0.3.6

7 months ago

0.3.5

7 months ago

0.3.4

7 months ago

0.3.3

7 months ago

0.3.2

7 months ago

0.3.1

7 months ago

0.3.0

7 months ago

0.0.0

7 months ago