@atomist/atomist-sdm
Advanced tools
Comparing version 0.0.1-20180508225830 to 0.0.1-20180509162350
{ | ||
"sha": "539909a69630509b3d0b66d099e3642053991e33", | ||
"branch": "539909a69630509b3d0b66d099e3642053991e33", | ||
"sha": "9bef43d45c7958a26733190fd76e545dec07a39d", | ||
"branch": "9bef43d45c7958a26733190fd76e545dec07a39d", | ||
"repository": "git@github.com:atomist/atomist-sdm.git" | ||
} |
@@ -10,1 +10,3 @@ import { Goal, Goals, GoalWithPrecondition } from "@atomist/sdm"; | ||
export declare const SimplifiedKubernetesDeployGoals: Goals; | ||
export declare const LibraryPublished: Goal; | ||
export declare const LeinDockerGoals: Goals; |
@@ -60,2 +60,10 @@ "use strict"; | ||
exports.SimplifiedKubernetesDeployGoals = new sdm_1.Goals("Simplified Deploy", commonGoals_1.VersionGoal, sdm_1.ReviewGoal, sdm_1.AutofixGoal, sdm_1.BuildGoal, exports.PublishGoal, commonGoals_1.DockerBuildGoal, commonGoals_1.TagGoal, new sdm_1.GoalWithPrecondition(exports.ProductionDeploymentGoal.definition, commonGoals_1.DockerBuildGoal)); | ||
exports.LibraryPublished = new sdm_1.Goal({ | ||
uniqueName: "LibraryPublished", | ||
environment: sdm_1.ProductionEnvironment, | ||
orderedName: "3-prod-library-published", | ||
displayName: "publish library", | ||
completedDescription: "Library Published", | ||
}); | ||
exports.LeinDockerGoals = new sdm_1.Goals("Lein Docker Build", commonGoals_1.VersionGoal, sdm_1.ReviewGoal, sdm_1.AutofixGoal, sdm_1.BuildGoal, commonGoals_1.DockerBuildGoal, commonGoals_1.TagGoal, new sdm_1.GoalWithPrecondition(exports.LibraryPublished.definition, commonGoals_1.TagGoal)); | ||
//# sourceMappingURL=goals.js.map |
import { Configuration } from "@atomist/automation-client"; | ||
import { SoftwareDeliveryMachine, SoftwareDeliveryMachineOptions } from "@atomist/sdm"; | ||
export declare type MachineOptions = SoftwareDeliveryMachineOptions; | ||
export declare function machine(options: SoftwareDeliveryMachineOptions, configuration: Configuration): SoftwareDeliveryMachine; |
@@ -17,23 +17,4 @@ "use strict"; | ||
*/ | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const automation_client_1 = require("@atomist/automation-client"); | ||
const sdm_1 = require("@atomist/sdm"); | ||
const build = require("@atomist/sdm/blueprint/dsl/buildDsl"); | ||
const executeTag_1 = require("@atomist/sdm/common/delivery/build/executeTag"); | ||
const executePublish_1 = require("@atomist/sdm/common/delivery/build/local/npm/executePublish"); | ||
const nodeProjectIdentifier_1 = require("@atomist/sdm/common/delivery/build/local/npm/nodeProjectIdentifier"); | ||
const nodeProjectVersioner_1 = require("@atomist/sdm/common/delivery/build/local/npm/nodeProjectVersioner"); | ||
const npmBuilder_1 = require("@atomist/sdm/common/delivery/build/local/npm/npmBuilder"); | ||
const projectVersioner_1 = require("@atomist/sdm/common/delivery/build/local/projectVersioner"); | ||
const tslint_1 = require("@atomist/sdm/common/delivery/code/autofix/node/tslint"); | ||
const PackageLockFingerprinter_1 = require("@atomist/sdm/common/delivery/code/fingerprint/node/PackageLockFingerprinter"); | ||
const executeDockerBuild_1 = require("@atomist/sdm/common/delivery/docker/executeDockerBuild"); | ||
const commonGoals_1 = require("@atomist/sdm/common/delivery/goals/common/commonGoals"); | ||
@@ -44,13 +25,19 @@ const ciPushTests_1 = require("@atomist/sdm/common/listener/support/pushtest/ci/ciPushTests"); | ||
const nodePushTests_1 = require("@atomist/sdm/common/listener/support/pushtest/node/nodePushTests"); | ||
const tagRepo_1 = require("@atomist/sdm/common/listener/support/tagRepo"); | ||
const SetDeployEnablement_1 = require("@atomist/sdm/handlers/commands/SetDeployEnablement"); | ||
const launchGoalK8_1 = require("@atomist/sdm/handlers/events/delivery/goals/k8s/launchGoalK8"); | ||
const materialChange_1 = require("../support/materialChange"); | ||
const simplifiedDeployment_1 = require("../support/simplifiedDeployment"); | ||
const tagger_1 = require("../support/tagger"); | ||
const materialChangeToClojureRepo_1 = require("../support/materialChangeToClojureRepo"); | ||
const materialChangeToNodeRepo_1 = require("../support/materialChangeToNodeRepo"); | ||
const isSimplifiedDeployment_1 = require("../support/isSimplifiedDeployment"); | ||
const goals_1 = require("./goals"); | ||
const leinSupport_1 = require("./leinSupport"); | ||
const nodeSupport_1 = require("./nodeSupport"); | ||
function machine(options, configuration) { | ||
const sdm = new sdm_1.SoftwareDeliveryMachine("Automation Client Software Delivery Machine", options, sdm_1.whenPushSatisfies(sdm_1.not(materialChange_1.MaterialChange)) | ||
const sdm = new sdm_1.SoftwareDeliveryMachine("Atomist Software Delivery Machine", options, sdm_1.whenPushSatisfies(sdm_1.not(sdm_1.IsLein), isSimplifiedDeployment_1.IsTeam("T095SFFBK")) | ||
.itMeans("Non Clojure repository in Atomist team") | ||
.setGoals(commonGoals_1.NoGoals), sdm_1.whenPushSatisfies(sdm_1.not(nodePushTests_1.IsNode), isSimplifiedDeployment_1.IsTeam("T29E48P34")) | ||
.itMeans("Non Node repository in Community team") | ||
.setGoals(commonGoals_1.NoGoals), | ||
// Node | ||
sdm_1.whenPushSatisfies(nodePushTests_1.IsNode, sdm_1.not(materialChangeToNodeRepo_1.MaterialChangeToNodeRepo)) | ||
.itMeans("No Material Change") | ||
.setGoals(commonGoals_1.NoGoals), sdm_1.whenPushSatisfies(ciPushTests_1.HasTravisFile, nodePushTests_1.IsNode) | ||
.setGoals(commonGoals_1.NoGoals), sdm_1.whenPushSatisfies(nodePushTests_1.IsNode, ciPushTests_1.HasTravisFile) | ||
.itMeans("Just Checking") | ||
@@ -60,3 +47,3 @@ .setGoals(goals_1.CheckGoals), | ||
// testing for these and deploying straight into their respective namespaces | ||
sdm_1.whenPushSatisfies(nodePushTests_1.IsNode, dockerPushTests_1.HasDockerfile, sdm_1.ToDefaultBranch, deployPushTests_1.IsDeployEnabled, sdm_1.IsAtomistAutomationClient, simplifiedDeployment_1.simplifiedDeployment("k8-automation", "automation-client-sdm", "atomist-sdm")) | ||
sdm_1.whenPushSatisfies(nodePushTests_1.IsNode, dockerPushTests_1.HasDockerfile, sdm_1.ToDefaultBranch, deployPushTests_1.IsDeployEnabled, sdm_1.IsAtomistAutomationClient, isSimplifiedDeployment_1.IsSimplifiedDeployment("k8-automation", "automation-client-sdm", "atomist-sdm")) | ||
.itMeans("Simplified Deploy") | ||
@@ -71,78 +58,16 @@ .setGoals(goals_1.SimplifiedKubernetesDeployGoals), sdm_1.whenPushSatisfies(nodePushTests_1.IsNode, dockerPushTests_1.HasDockerfile, sdm_1.ToDefaultBranch, deployPushTests_1.IsDeployEnabled, sdm_1.IsAtomistAutomationClient) | ||
.itMeans("Module Build") | ||
.setGoals(goals_1.BuildGoals)); | ||
sdm.addSupportingCommands(SetDeployEnablement_1.enableDeploy, SetDeployEnablement_1.disableDeploy) | ||
.addNewRepoWithCodeActions(tagRepo_1.tagRepo(tagger_1.AutomationClientTagger)) | ||
.addAutofixes(tslint_1.tslintFix) | ||
.addFingerprinterRegistrations(new PackageLockFingerprinter_1.PackageLockFingerprinter()); | ||
const hasPackageLock = sdm_1.hasFile("package-lock.json"); | ||
sdm.addBuildRules(build.when(hasPackageLock) | ||
.itMeans("npm run build") | ||
.set(sdm_1.nodeBuilder(options.projectLoader, "npm ci", "npm run build")), build.when(sdm_1.not(hasPackageLock)) | ||
.itMeans("npm run build (no package-lock.json)") | ||
.set(sdm_1.nodeBuilder(options.projectLoader, "npm install", "npm run build"))); | ||
sdm.addGoalImplementation("nodeVersioner", commonGoals_1.VersionGoal, projectVersioner_1.executeVersioner(options.projectLoader, nodeProjectVersioner_1.NodeProjectVersioner)) | ||
.addGoalImplementation("nodeDockerBuild", commonGoals_1.DockerBuildGoal, executeDockerBuild_1.executeDockerBuild(options.projectLoader, executeDockerBuild_1.DefaultDockerImageNameCreator, npmBuilder_1.NpmPreparations, Object.assign({}, configuration.sdm.docker, { dockerfileFinder: () => __awaiter(this, void 0, void 0, function* () { return "Dockerfile"; }) }))) | ||
.addGoalImplementation("nodeTag", commonGoals_1.TagGoal, executeTag_1.executeTag(options.projectLoader)) | ||
.addGoalImplementation("nodePublish", goals_1.PublishGoal, executePublish_1.executePublish(options.projectLoader, nodeProjectIdentifier_1.NodeProjectIdentifier, npmBuilder_1.NpmPreparations, Object.assign({}, configuration.sdm.npm))); | ||
sdm.goalFulfillmentMapper | ||
.addSideEffect({ | ||
goal: goals_1.StagingDeploymentGoal, | ||
pushTest: nodePushTests_1.IsNode, | ||
sideEffectName: "@atomist/k8-automation", | ||
}) | ||
.addSideEffect({ | ||
goal: goals_1.ProductionDeploymentGoal, | ||
pushTest: nodePushTests_1.IsNode, | ||
sideEffectName: "@atomist/k8-automation", | ||
}) | ||
.addFullfillmentCallback({ | ||
goal: goals_1.StagingDeploymentGoal, | ||
callback: kubernetesDataCallback(options, configuration), | ||
}) | ||
.addFullfillmentCallback({ | ||
goal: goals_1.ProductionDeploymentGoal, | ||
callback: kubernetesDataCallback(options, configuration), | ||
}); | ||
.setGoals(goals_1.BuildGoals), | ||
// Clojure | ||
sdm_1.whenPushSatisfies(sdm_1.IsLein, sdm_1.not(materialChangeToClojureRepo_1.MaterialChangeToClojureRepo)) | ||
.itMeans("No material change") | ||
.setGoals(commonGoals_1.NoGoals), sdm_1.whenPushSatisfies(sdm_1.IsLein, sdm_1.not(ciPushTests_1.HasTravisFile), sdm_1.ToDefaultBranch, materialChangeToClojureRepo_1.MaterialChangeToClojureRepo) | ||
.itMeans("Build a Clojure Service with Leinigen") | ||
.setGoals(goals_1.LeinDockerGoals)); | ||
sdm.addSupportingCommands(SetDeployEnablement_1.enableDeploy, SetDeployEnablement_1.disableDeploy); | ||
sdm.addGoalImplementation("tag", sdm_1.TagGoal, sdm_1.executeTag(sdm.opts.projectLoader)); | ||
nodeSupport_1.addNodeSupport(sdm, configuration); | ||
leinSupport_1.addLeinSupport(sdm, configuration); | ||
return sdm; | ||
} | ||
exports.machine = machine; | ||
function kubernetesDataCallback(options, configuration) { | ||
return (goal, ctx) => __awaiter(this, void 0, void 0, function* () { | ||
return options.projectLoader.doWithProject({ | ||
credentials: ctx.credentials, id: ctx.id, context: ctx.context, readOnly: true, | ||
}, (p) => __awaiter(this, void 0, void 0, function* () { | ||
return kubernetesDataFromGoal(goal, p, configuration); | ||
})); | ||
}); | ||
} | ||
function kubernetesDataFromGoal(goal, p, configuration) { | ||
const ns = namespaceFromGoal(goal); | ||
return launchGoalK8_1.createKubernetesData(goal, { | ||
name: goal.repo.name, | ||
environment: configuration.environment, | ||
port: 2866, | ||
ns, | ||
imagePullSecret: "atomistjfrog", | ||
replicas: ns === "production" ? 3 : 1, | ||
}, p); | ||
} | ||
function namespaceFromGoal(goal) { | ||
const name = goal.repo.name; | ||
if (/-sdm$/.test(name)) { | ||
return "sdm"; | ||
} | ||
else if (name === "k8-automation") { | ||
return "k8-automation"; | ||
} | ||
else if (goal.environment === sdm_1.StagingEnvironment.replace(/\/$/, "")) { | ||
return "testing"; | ||
} | ||
else if (goal.environment === sdm_1.ProductionEnvironment.replace(/\/$/, "")) { | ||
return "production"; | ||
} | ||
else { | ||
automation_client_1.logger.debug(`Unmatched goal.environment using default namespace: ${goal.environment}`); | ||
return "default"; | ||
} | ||
} | ||
//# sourceMappingURL=machine.js.map |
{ | ||
"name": "@atomist/atomist-sdm", | ||
"version": "0.0.1-20180508225830", | ||
"version": "0.0.1-20180509162350", | ||
"description": "an Atomist SDM to deliver automation client projects", | ||
@@ -24,2 +24,3 @@ "author": "Atomist, Inc.", | ||
"@atomist/slack-messages": "^0.12.1", | ||
"@atomist/clj-editors": "0.0.18", | ||
"lodash": "^4.17.10", | ||
@@ -26,0 +27,0 @@ "logzio-nodejs": "^0.4.10", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
176131
47
2287
8
+ Added@atomist/clj-editors@0.0.18
+ Added@atomist/clj-editors@0.0.18(transitive)
+ Addedacorn@5.5.3(transitive)