/
SoftwareDeliveryMachineOptions.ts
128 lines (111 loc) · 3.77 KB
/
SoftwareDeliveryMachineOptions.ts
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
* Copyright © 2019 Atomist, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
AnyOptions,
Configuration,
Maker,
ProjectPersister,
RepoFinder,
} from "@atomist/automation-client";
import { ArtifactStore } from "../../spi/artifact/ArtifactStore";
import { CredentialsResolver } from "../../spi/credentials/CredentialsResolver";
import { ProgressLogFactory } from "../../spi/log/ProgressLog";
import { ProjectLoader } from "../../spi/project/ProjectLoader";
import { RepoRefResolver } from "../../spi/repo-ref/RepoRefResolver";
import { AddressChannels } from "../context/addressChannels";
import { ParameterPromptFactory } from "../context/parameterPrompt";
import { PreferenceStoreFactory } from "../context/preferenceStore";
import { EnrichGoal } from "../goal/enrichGoal";
import { GoalScheduler } from "../goal/support/GoalScheduler";
import { RepoTargets } from "./RepoTargets";
import {
GoalSigningConfiguration,
GoalSigningKey,
GoalVerificationKey,
} from "./SigningKeys";
/**
* Infrastructure options common to all SoftwareDeliveryMachines.
* Can be used to control the behavior of an SDM, and
* also to facilitate testing.
*/
export interface SoftwareDeliveryMachineOptions {
/**
* Store for artifacts produced during the build process
*/
artifactStore: ArtifactStore;
/**
* Object used to load projects
*/
projectLoader: ProjectLoader;
/**
* Factory for loggers used to log specific activities
* such as build and deployment.
*/
logFactory: ProgressLogFactory;
/**
* Strategy for resolving Git repository references
*/
repoRefResolver: RepoRefResolver;
/**
* Strategy for finding all repos to act on
*/
repoFinder: RepoFinder;
/**
* Strategy for persisting new projects
*/
projectPersister: ProjectPersister;
/**
* Strategy for resolving credentials from a handler invocation
*/
credentialsResolver: CredentialsResolver;
/**
* Allow customization of editor targeting at per-SDM level.
* If set, can still be overridden by individual editor registrations.
*/
targets?: Maker<RepoTargets>;
/**
* Optional strategy to create a new PreferenceStore implementation
*/
preferenceStoreFactory?: PreferenceStoreFactory;
/**
* Optional strategy to allow prompting for additional parameters
*/
parameterPromptFactory?: ParameterPromptFactory<any>;
/**
* Optional strategy for launching goals in different infrastructure
*/
goalScheduler?: GoalScheduler | GoalScheduler[];
/**
* Optional AddressChannels for communicating with system administrator
* Defaults to logging a warning unless this is set.
*/
adminAddressChannels?: AddressChannels;
/**
* Callback to enrich goal metadata before it gets persisted and planned
*/
enrichGoal?: EnrichGoal;
/**
* Optional set of keys to sign and verify goals that are produced and received
* by this SDM.
*/
goalSigning?: GoalSigningConfiguration;
}
/**
* Configuration that takes SoftwareDeliveryMachineOptions inside the sdm key.
*/
export interface SoftwareDeliveryMachineConfiguration extends Configuration {
sdm: SoftwareDeliveryMachineOptions & AnyOptions;
}