UNPKG

@atomist/atomist-sdm

Version:

Atomist SDM to deliver our own projects

207 lines 10.9 kB
"use strict"; /* * 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. * 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. */ Object.defineProperty(exports, "__esModule", { value: true }); // GOAL Definition const sdm_1 = require("@atomist/sdm"); const sdm_core_1 = require("@atomist/sdm-core"); const sdm_pack_build_1 = require("@atomist/sdm-pack-build"); const Changelog_1 = require("@atomist/sdm-pack-changelog/lib/goal/Changelog"); const sdm_pack_docker_1 = require("@atomist/sdm-pack-docker"); const sdm_pack_k8s_1 = require("@atomist/sdm-pack-k8s"); exports.autoCodeInspection = new sdm_1.AutoCodeInspection({ isolate: true }); exports.pushImpact = new sdm_1.PushImpact(); exports.version = new sdm_core_1.Version(); exports.autofix = new sdm_1.Autofix({ setAuthor: true }); exports.build = new sdm_pack_build_1.Build(); exports.tag = new sdm_core_1.Tag(); exports.tagWithApproval = new sdm_core_1.Tag({ approval: true }); exports.dockerBuild = new sdm_pack_docker_1.DockerBuild(); exports.stagingDeploy = new sdm_pack_k8s_1.KubernetesDeploy({ environment: "testing", approval: true }); exports.productionDeploy = new sdm_pack_k8s_1.KubernetesDeploy({ environment: "production" }); exports.productionDeployWithApproval = new sdm_pack_k8s_1.KubernetesDeploy({ environment: "production", approval: true }); exports.globalStagingDeploy = new sdm_pack_k8s_1.KubernetesDeploy({ environment: "testing", approval: true }); exports.globalProductionDeploy = new sdm_pack_k8s_1.KubernetesDeploy({ environment: "production" }); exports.demoProductionDeploy = new sdm_pack_k8s_1.KubernetesDeploy({ environment: "production" }); exports.releaseChangelog = new Changelog_1.Changelog(); exports.publish = new sdm_1.GoalWithFulfillment({ uniqueName: "publish", environment: sdm_1.IndependentOfEnvironment, displayName: "publish", workingDescription: "Publishing", completedDescription: "Published", failedDescription: "Publish failed", isolated: true, }, exports.build, exports.dockerBuild); exports.publishWithApproval = new sdm_1.GoalWithFulfillment({ uniqueName: "publish-approval", environment: sdm_1.IndependentOfEnvironment, displayName: "publish", workingDescription: "Publishing", completedDescription: "Published", failedDescription: "Publish failed", isolated: true, approvalRequired: true, }, exports.build, exports.dockerBuild); exports.release = new sdm_1.GoalWithFulfillment({ uniqueName: "release", environment: sdm_1.ProductionEnvironment, displayName: "release", workingDescription: "Releasing", completedDescription: "Released", failedDescription: "Release failed", isolated: true, }); exports.releaseDocker = new sdm_1.GoalWithFulfillment({ uniqueName: "release-docker", environment: sdm_1.ProductionEnvironment, displayName: "release Docker image", workingDescription: "Releasing Docker image", completedDescription: "Released Docker image", failedDescription: "Release Docker image failure", isolated: true, }); exports.releaseTag = new sdm_1.GoalWithFulfillment({ uniqueName: "release-tag", environment: sdm_1.ProductionEnvironment, displayName: "create release tag", workingDescription: "Creating release tag", completedDescription: "Created release tag", failedDescription: "Creating release tag failure", }); exports.releaseDocs = new sdm_1.GoalWithFulfillment({ uniqueName: "release-docs", environment: sdm_1.ProductionEnvironment, displayName: "publish docs", workingDescription: "Publishing docs", completedDescription: "Published docs", failedDescription: "Publishing docs failure", isolated: true, }); exports.releaseHomebrew = new sdm_1.GoalWithFulfillment({ uniqueName: "release-homebrew", environment: sdm_1.ProductionEnvironment, displayName: "release Homebrew formula", workingDescription: "Releasing Homebrew formula", completedDescription: "Released Homebrew formula", failedDescription: "Release Homebrew formula failure", isolated: true, }); exports.releaseVersion = new sdm_1.GoalWithFulfillment({ uniqueName: "release-version", environment: sdm_1.ProductionEnvironment, displayName: "increment version", workingDescription: "Incrementing version", completedDescription: "Incremented version", failedDescription: "Incrementing version failure", }, exports.releaseChangelog); // GOALSET Definition // Just autofix exports.FixGoals = sdm_1.goals("Fix") .plan(exports.autofix); // Just running review and autofix exports.CheckGoals = sdm_1.goals("Check") .plan(exports.autofix, exports.autoCodeInspection, exports.pushImpact); // Goals for running in local mode exports.LocalGoals = sdm_1.goals("Local Build") .plan(exports.autofix, exports.pushImpact) .plan(exports.version).after(exports.autofix) .plan(exports.build).after(exports.autofix, exports.version) .plan(exports.autoCodeInspection).after(exports.build); // Just running the build and publish exports.BuildGoals = sdm_1.goals("Build") .plan(exports.LocalGoals) .plan(exports.tag, exports.publish).after(exports.build); // Just running the build and publish exports.BuildReleaseGoals = sdm_1.goals("Build with Release") .plan(exports.LocalGoals) .plan(exports.tag).after(exports.build) .plan(exports.publishWithApproval).after(exports.build) .plan(exports.release, exports.releaseDocs, exports.releaseVersion).after(exports.publishWithApproval, exports.autoCodeInspection) .plan(exports.releaseChangelog).after(exports.releaseVersion) .plan(exports.releaseTag).after(exports.release); // Build including docker build exports.DockerGoals = sdm_1.goals("Docker Build") .plan(exports.BuildGoals) .plan(exports.dockerBuild).after(exports.build); exports.MavenBuildGoals = sdm_1.goals("Build") .plan(exports.LocalGoals) .plan(exports.tag).after(exports.build); // Build including docker build exports.MavenDockerReleaseGoals = sdm_1.goals("Docker Build with Release") .plan(exports.LocalGoals) .plan(exports.dockerBuild).after(exports.build) .plan(exports.tag).after(exports.dockerBuild) .plan(exports.stagingDeploy).after(exports.dockerBuild) .plan(exports.productionDeploy).after(exports.stagingDeploy, exports.autoCodeInspection) .plan(exports.releaseDocker).after(exports.productionDeploy) .plan(exports.releaseTag).after(exports.releaseDocker); // Build including docker build exports.DockerReleaseGoals = sdm_1.goals("Docker Build with Release") .plan(exports.LocalGoals) .plan(exports.dockerBuild).after(exports.build) .plan(exports.tag).after(exports.dockerBuild) .plan(exports.publishWithApproval).after(exports.build, exports.dockerBuild) .plan(exports.release, exports.releaseDocker, exports.releaseDocs, exports.releaseVersion).after(exports.publishWithApproval, exports.autoCodeInspection) .plan(exports.releaseChangelog).after(exports.releaseVersion) .plan(exports.releaseTag).after(exports.release, exports.releaseDocker); exports.DockerReleaseAndHomebrewGoals = sdm_1.goals("Docker and Homebrew with Release") .plan(exports.DockerReleaseGoals) .plan(exports.releaseHomebrew).after(exports.release); exports.SimpleDockerReleaseGoals = sdm_1.goals("Simple Docker Build with Release") .plan(exports.version) .plan(exports.dockerBuild).after(exports.version) .plan(exports.tagWithApproval).after(exports.dockerBuild) .plan(exports.releaseDocker, exports.releaseVersion).after(exports.tagWithApproval) .plan(exports.releaseChangelog).after(exports.releaseVersion) .plan(exports.releaseTag).after(exports.releaseDocker); // Docker build and testing and production kubernetes deploy exports.KubernetesDeployGoals = sdm_1.goals("Deploy") .plan(exports.DockerGoals) .plan(exports.stagingDeploy).after(exports.dockerBuild) .plan(exports.productionDeploy).after(exports.stagingDeploy, exports.autoCodeInspection) .plan(exports.release, exports.releaseDocker, exports.releaseDocs, exports.releaseVersion).after(exports.productionDeploy) .plan(exports.releaseChangelog).after(exports.releaseVersion) .plan(exports.releaseTag).after(exports.release, exports.releaseDocker); // Docker build and testing and production kubernetes deploy exports.SimplifiedKubernetesDeployGoals = sdm_1.goals("Simplified Deploy") .plan(exports.DockerGoals) .plan(exports.productionDeployWithApproval).after(exports.dockerBuild, exports.autoCodeInspection) .plan(exports.release, exports.releaseDocker, exports.releaseDocs, exports.releaseVersion).after(exports.productionDeployWithApproval) .plan(exports.releaseChangelog).after(exports.releaseVersion) .plan(exports.releaseTag).after(exports.release, exports.releaseDocker); // Docker build and testing and demo kubernetes deploy, no release exports.DemoKubernetesDeployGoals = sdm_1.goals("Demo Deploy") .plan(exports.DockerGoals) .plan(exports.demoProductionDeploy).after(exports.dockerBuild, exports.autoCodeInspection); // Docker build and testing and production kubernetes deploy to global cluster exports.GlobalKubernetesDeployGoals = sdm_1.goals("Global Deploy") .plan(exports.DockerGoals) .plan(exports.globalStagingDeploy).after(exports.dockerBuild) .plan(exports.globalProductionDeploy).after(exports.globalStagingDeploy, exports.autoCodeInspection) .plan(exports.releaseDocker, exports.releaseDocs, exports.releaseVersion).after(exports.globalProductionDeploy) .plan(exports.releaseChangelog).after(exports.releaseVersion) .plan(exports.releaseTag).after(exports.releaseDocker); // Docker build and testing and multiple production kubernetes deploys exports.MultiKubernetesDeployGoals = sdm_1.goals("Multiple Deploy") .plan(exports.DockerGoals) .plan(exports.productionDeployWithApproval, exports.globalProductionDeploy).after(exports.dockerBuild, exports.autoCodeInspection) .plan(exports.demoProductionDeploy).after(exports.productionDeployWithApproval) .plan(exports.release, exports.releaseDocker, exports.releaseDocs, exports.releaseVersion).after(exports.productionDeployWithApproval) .plan(exports.releaseChangelog).after(exports.releaseVersion) .plan(exports.releaseTag).after(exports.release, exports.releaseDocker); exports.noOpGoalExecutor = () => Promise.resolve({ code: 0, message: "Nothing to do" }); //# sourceMappingURL=goals.js.map