1 | ;
|
2 | /*
|
3 | * Copyright © 2018 Atomist, Inc.
|
4 | *
|
5 | * Licensed under the Apache License, Version 2.0 (the "License");
|
6 | * you may not use this file except in compliance with the License.
|
7 | * You may obtain a copy of the License at
|
8 | *
|
9 | * http://www.apache.org/licenses/LICENSE-2.0
|
10 | *
|
11 | * Unless required by applicable law or agreed to in writing, software
|
12 | * distributed under the License is distributed on an "AS IS" BASIS,
|
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 | * See the License for the specific language governing permissions and
|
15 | * limitations under the License.
|
16 | */
|
17 | Object.defineProperty(exports, "__esModule", { value: true });
|
18 | const HandlerBasedSoftwareDeliveryMachine_1 = require("../internal/machine/HandlerBasedSoftwareDeliveryMachine");
|
19 | const exposeInfo_1 = require("../pack/info/exposeInfo");
|
20 | /**
|
21 | * Create a **Software Delivery MachineConfiguration** with default predefined goals.
|
22 | * Combines commands and delivery event handling using _goals_.
|
23 | *
|
24 | * Goals and goal "implementations" can be defined by users.
|
25 | * However, certain well known goals are built into the DefaultSoftwareDeliveryMachine
|
26 | * for convenience, with their own associated listeners.
|
27 | *
|
28 | * Well known goal support is based around a delivery process spanning
|
29 | * common goals of fingerprinting, reacting to fingerprint diffs,
|
30 | * code review, build, deployment, endpoint verification and
|
31 | * promotion to a production environment.
|
32 | *
|
33 | * The most important element of a software delivery machine is setting
|
34 | * zero or more _push rules_ in the constructor.
|
35 | * This is normally done using the internal DSL as follows:
|
36 | *
|
37 | * ```
|
38 | * const sdm = createSoftwareDeliveryMachine(
|
39 | * "MyMachine",
|
40 | * options,
|
41 | * whenPushSatisfies(IsMaven, HasSpringBootApplicationClass, not(MaterialChangeToJavaRepo))
|
42 | * .itMeans("No material change to Java")
|
43 | * .setGoals(NoGoals),
|
44 | * whenPushSatisfies(ToDefaultBranch, IsMaven, HasSpringBootApplicationClass, HasCloudFoundryManifest)
|
45 | * .itMeans("Spring Boot service to deploy")
|
46 | * .setGoals(HttpServiceGoals));
|
47 | * ```
|
48 | *
|
49 | * Uses the builder pattern to allow fluent construction. For example:
|
50 | *
|
51 | * ```
|
52 | * softwareDeliveryMachine
|
53 | * .addPushReaction(async pu => ...)
|
54 | * .addNewIssueListener(async i => ...)
|
55 | * .add...;
|
56 | * ```
|
57 | */
|
58 | function createSoftwareDeliveryMachine(config,
|
59 | // tslint:disable-next-line:max-line-length
|
60 | ...goalSetters) {
|
61 | const machine = new HandlerBasedSoftwareDeliveryMachine_1.HandlerBasedSoftwareDeliveryMachine(config.name, config.configuration, goalSetters);
|
62 | return machine
|
63 | .addExtensionPacks(exposeInfo_1.ExposeInfo);
|
64 | }
|
65 | exports.createSoftwareDeliveryMachine = createSoftwareDeliveryMachine;
|
66 | //# sourceMappingURL=machineFactory.js.map |
\ | No newline at end of file |