From 63b3d7c982f786eb293d57ee2ac55a8f8e2f76be Mon Sep 17 00:00:00 2001 From: Rod Johnson Date: Sat, 29 Sep 2018 15:36:01 -0500 Subject: [PATCH] Remove well known goals --- .../well-known-goals/addWellKnownGoals.ts | 63 ---------- lib/pack/well-known-goals/commonGoals.ts | 108 ------------------ lib/pack/well-known-goals/httpServiceGoals.ts | 79 ------------- lib/pack/well-known-goals/libraryGoals.ts | 31 ----- 4 files changed, 281 deletions(-) delete mode 100644 lib/pack/well-known-goals/addWellKnownGoals.ts delete mode 100644 lib/pack/well-known-goals/commonGoals.ts delete mode 100644 lib/pack/well-known-goals/httpServiceGoals.ts delete mode 100644 lib/pack/well-known-goals/libraryGoals.ts diff --git a/lib/pack/well-known-goals/addWellKnownGoals.ts b/lib/pack/well-known-goals/addWellKnownGoals.ts deleted file mode 100644 index c9da1703b..000000000 --- a/lib/pack/well-known-goals/addWellKnownGoals.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright © 2018 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 { executeImmaterial } from "../../api-helper/goal/chooseAndSetGoals"; -import { executeAutofixes } from "../../api-helper/listener/executeAutofixes"; -import { executeAutoInspects } from "../../api-helper/listener/executeAutoInspects"; -import { executeFingerprinting } from "../../api-helper/listener/executeFingerprinting"; -import { executePushReactions } from "../../api-helper/listener/executePushReactions"; -import { LogSuppressor } from "../../api-helper/log/logInterpreters"; -import { metadata } from "../../api-helper/misc/extensionPack"; -import { ExtensionPack } from "../../api/machine/ExtensionPack"; -import { SoftwareDeliveryMachine } from "../../api/machine/SoftwareDeliveryMachine"; -import { - ArtifactGoal, - AutofixGoal, - CodeInspectionGoal, - FingerprintGoal, - NoGoal, - PushReactionGoal, -} from "../../api/machine/wellKnownGoals"; -import { AnyPush } from "../../api/mapping/support/commonPushTests"; - -/** - * Add well known goals to the given SDM - * @param {SoftwareDeliveryMachine} sdm - */ -export const WellKnownGoals: ExtensionPack = { - ...metadata("well-known-goals"), - configure, -}; - -function configure(sdm: SoftwareDeliveryMachine) { - sdm.addGoalImplementation("Autofix", AutofixGoal, - executeAutofixes(sdm.autofixRegistrations), - { - // Autofix errors should not be reported to the user - logInterpreter: LogSuppressor, - }) - .addGoalImplementation("DoNothing", NoGoal, executeImmaterial) - .addGoalImplementation("FingerprinterRegistration", FingerprintGoal, - executeFingerprinting( - sdm.fingerprinterRegistrations, - sdm.fingerprintListeners)) - .addGoalImplementation("CodeReactions", PushReactionGoal, - executePushReactions(sdm.pushImpactListenerRegistrations)) - .addGoalImplementation("CodeInspections", CodeInspectionGoal, - executeAutoInspects(sdm.autoInspectRegistrations, sdm.reviewListenerRegistrations)) - .addVerifyImplementation(); - sdm.addGoalSideEffect(ArtifactGoal, sdm.configuration.name, AnyPush); -} diff --git a/lib/pack/well-known-goals/commonGoals.ts b/lib/pack/well-known-goals/commonGoals.ts deleted file mode 100644 index d0624c201..000000000 --- a/lib/pack/well-known-goals/commonGoals.ts +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright © 2018 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 { - Goal, - GoalWithPrecondition, -} from "../../api/goal/Goal"; -import { Goals } from "../../api/goal/Goals"; -import { - IndependentOfEnvironment, - ProjectDisposalEnvironment, -} from "../../api/goal/support/environment"; -import { - BuildGoal, - LocalDeploymentGoal, - NoGoal, -} from "../../api/machine/wellKnownGoals"; - -/** - * @ModuleExport - */ -export const VersionGoal = new Goal({ - uniqueName: "version", - displayName: "version", - environment: IndependentOfEnvironment, - workingDescription: "Calculating project version", - completedDescription: "Versioned", -}); - -/** - * @ModuleExport - */ -export const DockerBuildGoal = new GoalWithPrecondition({ - uniqueName: "docker-build", - displayName: "docker build", - environment: IndependentOfEnvironment, - workingDescription: "Running docker build", - completedDescription: "Docker build successful", - failedDescription: "Docker build failed", - isolated: true, -}, BuildGoal); - -/** - * @ModuleExport - */ -export const TagGoal = new GoalWithPrecondition({ - uniqueName: "tag", - displayName: "tag", - environment: IndependentOfEnvironment, - workingDescription: "Tagging", - completedDescription: "Tagged", - failedDescription: "Failed to create Tag", -}, DockerBuildGoal, BuildGoal); - -/** - * @ModuleExport - */ -export const StagingUndeploymentGoal = new Goal({ - uniqueName: "undeploy-from-test", - displayName: "undeploy from test", - environment: ProjectDisposalEnvironment, - completedDescription: "not deployed in test", -}); - -/** - * @ModuleExport - */ -export const LocalUndeploymentGoal = new Goal({ - uniqueName: "undeploy-locally", - displayName: "undeploy locally test", - environment: ProjectDisposalEnvironment, - failedDescription: "Failed at local undeploy", - completedDescription: "not deployed locally", -}); - -/** - * @ModuleExport - */ -// not an enforced precondition, but it's real enough to graph -export const LocalEndpointGoal = new GoalWithPrecondition({ - uniqueName: "find-local-endpoint", - displayName: "locate local service endpoint", - environment: IndependentOfEnvironment, - completedDescription: "Here is the local service endpoint", -}, LocalDeploymentGoal); - -/** - * Special Goals object to be returned if changes are immaterial. - * The identity of this object is important. - * @type {Goals} - * @ModuleExport - */ -export const NoGoals = new Goals( - "No action needed", - NoGoal); diff --git a/lib/pack/well-known-goals/httpServiceGoals.ts b/lib/pack/well-known-goals/httpServiceGoals.ts deleted file mode 100644 index 1d6151d04..000000000 --- a/lib/pack/well-known-goals/httpServiceGoals.ts +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright © 2018 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 { Goals } from "../../api/goal/Goals"; -import { - ArtifactGoal, - AutofixGoal, - BuildGoal, - CodeInspectionGoal, - DeleteAfterUndeploysGoal, - DeleteRepositoryGoal, - FingerprintGoal, - LocalDeploymentGoal, - ProductionDeploymentGoal, - ProductionEndpointGoal, - ProductionUndeploymentGoal, - PushReactionGoal, - StagingDeploymentGoal, - StagingEndpointGoal, - StagingVerifiedGoal, -} from "../../api/machine/wellKnownGoals"; -import { - LocalEndpointGoal, - LocalUndeploymentGoal, - StagingUndeploymentGoal, -} from "./commonGoals"; - -/** - * Goals for an Http service, mirroring a typical flow through - * staging to production. - * Goal sets are normally user defined, so this is largely - * an illustration. - * @type {Goals} - */ -export const HttpServiceGoals = new Goals( - "HTTP Service", - FingerprintGoal, - AutofixGoal, - CodeInspectionGoal, - PushReactionGoal, - BuildGoal, - ArtifactGoal, - StagingDeploymentGoal, - StagingEndpointGoal, - StagingVerifiedGoal, - ProductionDeploymentGoal, - ProductionEndpointGoal); - -export const LocalDeploymentGoals = new Goals( - "Local Deployment", - PushReactionGoal, - LocalDeploymentGoal, - LocalEndpointGoal); - -export const UndeployEverywhereGoals = new Goals( - "Undeploy all environments", - LocalUndeploymentGoal, - StagingUndeploymentGoal, - ProductionUndeploymentGoal, - DeleteAfterUndeploysGoal, -); - -export const RepositoryDeletionGoals = new Goals( - "Offer to delete repository", - DeleteRepositoryGoal, -); diff --git a/lib/pack/well-known-goals/libraryGoals.ts b/lib/pack/well-known-goals/libraryGoals.ts deleted file mode 100644 index 25d2a939d..000000000 --- a/lib/pack/well-known-goals/libraryGoals.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright © 2018 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 { Goals } from "../../api/goal/Goals"; -import { - CodeInspectionGoal, - JustBuildGoal, -} from "../../api/machine/wellKnownGoals"; - -/** - * Flow to build a library - * @type {Goals} - */ -export const LibraryGoals = new Goals( - "Library", - CodeInspectionGoal, - JustBuildGoal, -);