@pulumi/harness
Version:
A Pulumi package for creating and managing Harness resources.
232 lines • 9.8 kB
JavaScript
"use strict";
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Pipeline = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Resource for creating a Harness pipeline.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as harness from "@pulumi/harness";
*
* const example = new harness.platform.Pipeline("example", {
* identifier: "identifier",
* orgId: "orgIdentifier",
* projectId: "projectIdentifier",
* name: "name",
* gitDetails: {
* branchName: "branchName",
* commitMessage: "commitMessage",
* filePath: "filePath",
* connectorRef: "connectorRef",
* storeType: "REMOTE",
* repoName: "repoName",
* },
* tags: {},
* yaml: `pipeline:
* name: name
* identifier: identifier
* allowStageExecutions: false
* projectIdentifier: projectIdentifier
* orgIdentifier: orgIdentifier
* tags: {}
* stages:
* - stage:
* name: dep
* identifier: dep
* description: ""
* type: Deployment
* spec:
* serviceConfig:
* serviceRef: service
* serviceDefinition:
* type: Kubernetes
* spec:
* variables: []
* infrastructure:
* environmentRef: testenv
* infrastructureDefinition:
* type: KubernetesDirect
* spec:
* connectorRef: testconf
* namespace: test
* releaseName: release-<+INFRA_KEY>
* allowSimultaneousDeployments: false
* execution:
* steps:
* - stepGroup:
* name: Canary Deployment
* identifier: canaryDepoyment
* steps:
* - step:
* name: Canary Deployment
* identifier: canaryDeployment
* type: K8sCanaryDeploy
* timeout: 10m
* spec:
* instanceSelection:
* type: Count
* spec:
* count: 1
* skipDryRun: false
* - step:
* name: Canary Delete
* identifier: canaryDelete
* type: K8sCanaryDelete
* timeout: 10m
* spec: {}
* rollbackSteps:
* - step:
* name: Canary Delete
* identifier: rollbackCanaryDelete
* type: K8sCanaryDelete
* timeout: 10m
* spec: {}
* - stepGroup:
* name: Primary Deployment
* identifier: primaryDepoyment
* steps:
* - step:
* name: Rolling Deployment
* identifier: rollingDeployment
* type: K8sRollingDeploy
* timeout: 10m
* spec:
* skipDryRun: false
* rollbackSteps:
* - step:
* name: Rolling Rollback
* identifier: rollingRollback
* type: K8sRollingRollback
* timeout: 10m
* spec: {}
* rollbackSteps: []
* tags: {}
* failureStrategies:
* - onFailure:
* errors:
* - AllErrors
* action:
* type: StageRollback
* `,
* });
* //## Importing Pipeline from Git
* const test = new harness.platform.Organization("test", {
* identifier: "identifier",
* name: "name",
* });
* const testPipeline = new harness.platform.Pipeline("test", {
* identifier: "gitx",
* orgId: "default",
* projectId: "V",
* name: "gitx",
* importFromGit: true,
* gitImportInfo: {
* branchName: "main",
* filePath: ".harness/gitx.yaml",
* connectorRef: "account.DoNotDeleteGithub",
* repoName: "open-repo",
* },
* pipelineImportRequest: {
* pipelineName: "gitx",
* pipelineDescription: "Pipeline Description",
* },
* });
* ```
*
* ## Import
*
* The `pulumi import` command can be used, for example:
*
* Import pipeline from default branch
*
* ```sh
* $ pulumi import harness:platform/pipeline:Pipeline example <org_id>/<project_id>/<pipeline_id>
* ```
*
* Import pipeline from non default branch
*
* ```sh
* $ pulumi import harness:platform/pipeline:Pipeline example <org_id>/<project_id>/<pipeline_id>/<branch>
* ```
*/
class Pipeline extends pulumi.CustomResource {
/**
* Get an existing Pipeline resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new Pipeline(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Pipeline. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Pipeline.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["description"] = state?.description;
resourceInputs["gitDetails"] = state?.gitDetails;
resourceInputs["gitImportInfo"] = state?.gitImportInfo;
resourceInputs["identifier"] = state?.identifier;
resourceInputs["importFromGit"] = state?.importFromGit;
resourceInputs["name"] = state?.name;
resourceInputs["orgId"] = state?.orgId;
resourceInputs["pipelineImportRequest"] = state?.pipelineImportRequest;
resourceInputs["projectId"] = state?.projectId;
resourceInputs["tags"] = state?.tags;
resourceInputs["templateApplied"] = state?.templateApplied;
resourceInputs["templateAppliedPipelineYaml"] = state?.templateAppliedPipelineYaml;
resourceInputs["yaml"] = state?.yaml;
}
else {
const args = argsOrState;
if (args?.identifier === undefined && !opts.urn) {
throw new Error("Missing required property 'identifier'");
}
if (args?.orgId === undefined && !opts.urn) {
throw new Error("Missing required property 'orgId'");
}
if (args?.projectId === undefined && !opts.urn) {
throw new Error("Missing required property 'projectId'");
}
resourceInputs["description"] = args?.description;
resourceInputs["gitDetails"] = args?.gitDetails;
resourceInputs["gitImportInfo"] = args?.gitImportInfo;
resourceInputs["identifier"] = args?.identifier;
resourceInputs["importFromGit"] = args?.importFromGit;
resourceInputs["name"] = args?.name;
resourceInputs["orgId"] = args?.orgId;
resourceInputs["pipelineImportRequest"] = args?.pipelineImportRequest;
resourceInputs["projectId"] = args?.projectId;
resourceInputs["tags"] = args?.tags;
resourceInputs["templateApplied"] = args?.templateApplied;
resourceInputs["templateAppliedPipelineYaml"] = args?.templateAppliedPipelineYaml;
resourceInputs["yaml"] = args?.yaml;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Pipeline.__pulumiType, name, resourceInputs, opts);
}
}
exports.Pipeline = Pipeline;
/** @internal */
Pipeline.__pulumiType = 'harness:platform/pipeline:Pipeline';
//# sourceMappingURL=pipeline.js.map