Skip to content

Commit

Permalink
Auto merge pull request #656 from atomist/sdm
Browse files Browse the repository at this point in the history
Make goal launching more pluggable
  • Loading branch information
atomist-bot committed Jan 14, 2019
2 parents f93ec30 + a9ee06e commit ae78c49
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 20 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright © 2018 Atomist, Inc.
* 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.
Expand All @@ -14,16 +14,23 @@
* limitations under the License.
*/

import {
HandlerContext,
HandlerResult,
} from "@atomist/automation-client";
import { ProgressLog } from "../../../spi/log/ProgressLog";
import { SdmGoalEvent } from "../SdmGoalEvent";
import { ExecuteGoalResult } from "../ExecuteGoalResult";
import { GoalInvocation } from "../GoalInvocation";

/**
* Launch a goal in an isolated environment (container or process) for fulfillment.
* Launch a goal in an environment (container or process) for fulfillment.
*/
export type IsolatedGoalLauncher = (goal: SdmGoalEvent,
ctx: HandlerContext,
progressLog: ProgressLog) => Promise<HandlerResult>;
export interface GoalLauncher {

/**
* Does this GoalLauncher support launching provided goals
* @param gi
*/
supports(gi: GoalInvocation): Promise<boolean>;

/**
* Launch the provided goal
* @param gi
*/
launch(gi: GoalInvocation): Promise<ExecuteGoalResult>;
}
10 changes: 3 additions & 7 deletions lib/api/machine/SoftwareDeliveryMachineOptions.ts
@@ -1,5 +1,5 @@
/*
* Copyright © 2018 Atomist, Inc.
* 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.
Expand Down Expand Up @@ -27,13 +27,9 @@ 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 { IsolatedGoalLauncher } from "../goal/support/IsolatedGoalLauncher";
import { GoalLauncher } from "../goal/support/GoalLauncher";
import { RepoTargets } from "./RepoTargets";

/**
* Parameters for targeting transforms or inspections to repos
*/

/**
* Infrastructure options common to all SoftwareDeliveryMachines.
* Can be used to control the behavior of an SDM, and
Expand Down Expand Up @@ -86,7 +82,7 @@ export interface SoftwareDeliveryMachineOptions {
/**
* Strategy for launching goals in different infrastructure
*/
goalLauncher?: IsolatedGoalLauncher;
goalLauncher?: GoalLauncher | GoalLauncher[];

/**
* AddressChannels for communicating with system administrator.
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "@atomist/sdm",
"version": "1.2.1",
"version": "1.3.0",
"description": "Atomist Software Delivery Machine API",
"author": {
"name": "Atomist",
Expand Down

0 comments on commit ae78c49

Please sign in to comment.