Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make goal launching more pluggable #656

Merged
merged 2 commits into from
Jan 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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