action

package
v0.54.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ArtifactDownload = Manifest{
	Action: sdk.Action{
		Name:        sdk.ArtifactDownload,
		Description: "This action can be used to retrieve an artifact previously uploaded by an Artifact Upload.",
		Parameters: []sdk.Parameter{
			{
				Name:        "path",
				Description: "Path where artifacts will be downloaded.",
				Type:        sdk.StringParameter,
			},
			{
				Name:        "tag",
				Description: "Artifact are uploaded with a tag, generally {{.cds.version}}.",
				Type:        sdk.StringParameter,
				Value:       "{{.cds.version}}",
			},
			{
				Name:        "pattern",
				Type:        sdk.StringParameter,
				Description: "(optional) Empty: download all files. Otherwise, enter regexp pattern to choose file: (fileA|fileB).",
				Value:       "",
				Advanced:    true,
			},
		},
	},
	Example: exportentities.PipelineV1{
		Version: exportentities.PipelineVersion1,
		Name:    "Pipeline1",
		Stages:  []string{"Stage1"},
		Jobs: []exportentities.Job{{
			Name:  "Job1",
			Stage: "Stage1",
			Steps: []exportentities.Step{
				{
					ArtifactDownload: &exportentities.StepArtifactDownload{
						Path:    "{{.cds.workspace}}",
						Pattern: "*.tag.gz",
						Tag:     "{{.cds.version}}",
					},
				},
			},
		}},
	},
}

ArtifactDownload action definition.

View Source
var ArtifactUpload = Manifest{
	Action: sdk.Action{
		Name:        sdk.ArtifactUpload,
		Description: "This action can be used to upload artifacts in CDS. This is the recommended way to share files between pipelines or stages.",
		Parameters: []sdk.Parameter{
			{
				Name:        "path",
				Type:        sdk.StringParameter,
				Description: "Path of file to upload, example: ./src/yourFile.json.",
			},
			{
				Name:        "tag",
				Type:        sdk.StringParameter,
				Description: "Artifact will be uploaded with a tag, generally {{.cds.version}}.",
				Value:       "{{.cds.version}}",
			},
			{
				Name:        "destination",
				Description: "(optional) Destination of this artifact. Use the name of integration attached on your project.",
				Value:       "",
				Type:        sdk.StringParameter,
				Advanced:    true,
			},
		},
	},
	Example: exportentities.PipelineV1{
		Version: exportentities.PipelineVersion1,
		Name:    "Pipeline1",
		Stages:  []string{"Stage1"},
		Jobs: []exportentities.Job{{
			Name:  "Job1",
			Stage: "Stage1",
			Steps: []exportentities.Step{
				{
					ArtifactUpload: &exportentities.StepArtifactUpload{
						Path: "{{.cds.workspace}}/myFile",
						Tag:  "{{.cds.version}}",
					},
				},
			},
		}},
	},
}

ArtifactUpload action definition.

View Source
var CheckoutApplication = Manifest{
	Action: sdk.Action{
		Name: sdk.CheckoutApplicationAction,
		Description: `CDS Builtin Action.
Checkout a repository into a new directory.

This action use the configuration from application vcs strategy to git clone the repository.
The clone will be done with a depth of 50 and with submodules.
If you want to modify theses options, you have to use gitClone action.
`,
		Parameters: []sdk.Parameter{
			{
				Name:        "directory",
				Description: "The name of a directory to clone into.",
				Value:       "{{.cds.workspace}}",
				Type:        sdk.StringParameter,
			},
		},
		Requirements: []sdk.Requirement{
			{
				Name:  "git",
				Type:  sdk.BinaryRequirement,
				Value: "git",
			},
		},
	},
	Example: exportentities.PipelineV1{
		Version: exportentities.PipelineVersion1,
		Name:    "Pipeline1",
		Stages:  []string{"Stage1"},
		Jobs: []exportentities.Job{{
			Name:  "Job1",
			Stage: "Stage1",
			Steps: []exportentities.Step{
				{
					Checkout: &checkoutExample,
				},
			},
		}},
	},
}

CheckoutApplication action definition.

View Source
var Coverage = Manifest{
	Action: sdk.Action{
		Name: sdk.CoverageAction,
		Description: `CDS Builtin Action.
Upload you coverage file to CDS as a coverage run result.
`,
		Parameters: []sdk.Parameter{
			{
				Name:        "path",
				Description: `Path of the coverage report file.`,
				Type:        sdk.StringParameter,
			},
		},
	},
	Example: exportentities.PipelineV1{
		Version: exportentities.PipelineVersion1,
		Name:    "Pipeline1",
		Stages:  []string{"Stage1"},
		Jobs: []exportentities.Job{{
			Name:  "Job1",
			Stage: "Stage1",
			Steps: []exportentities.Step{
				{
					Coverage: &exportentities.StepCoverage{
						Path: "./coverage.xml",
					},
				},
			},
		}},
	},
}

Coverage action definition.

View Source
var DeployApplication = Manifest{
	Action: sdk.Action{
		Name:        sdk.DeployApplicationAction,
		Description: `Deploy an application, useful only if you have a Deployment Plaftorm associated to your current application.`,
	},
	Example: exportentities.PipelineV1{
		Version: exportentities.PipelineVersion1,
		Name:    "Pipeline1",
		Stages:  []string{"Stage1"},
		Jobs: []exportentities.Job{{
			Name:  "Job1",
			Stage: "Stage1",
			Steps: []exportentities.Step{
				{
					Deploy: &deployExample,
				},
			},
		}},
	},
}

DeployApplication action definition.

View Source
var GitClone = Manifest{
	Action: sdk.Action{
		Name:        sdk.GitCloneAction,
		Description: "Clone a repository into a new directory.",
		Parameters: []sdk.Parameter{
			{
				Name: "url",
				Description: `URL must contain information about the transport protocol, the address of the remote server, and the path to the repository.
If your application is linked to a repository, you can use {{.git.url}} (clone over ssh) or {{.git.http_url}} (clone over https).`,
				Value: "{{.git.url}}",
				Type:  sdk.StringParameter,
			},
			{
				Name:  "privateKey",
				Value: "",
				Description: `(optional) Set the private key to be able to git clone from ssh.
You can create an application key named 'app-key' and use it in this action.
The public key have to be granted on your repository.`,
				Type: sdk.KeySSHParameter,
			},
			{
				Name:        "user",
				Description: "(optional) Set the user to be able to git clone from https with authentication.",
				Type:        sdk.StringParameter,
			},
			{
				Name:        "password",
				Description: "(optional) Set the password to be able to git clone from https with authentication.",
				Type:        sdk.StringParameter,
			},
			{
				Name:        "branch",
				Description: "(optional) Instead of pointing the newly created HEAD to the branch pointed to by the cloned repository’s HEAD, point to {{.git.branch}} branch instead.",
				Value:       "{{.git.branch}}",
				Type:        sdk.StringParameter,
			},
			{
				Name:        "commit",
				Description: "(optional) Set the current branch head (HEAD) to the commit.",
				Value:       "{{.git.hash}}",
				Type:        sdk.StringParameter,
			},
			{
				Name:        "directory",
				Description: "(optional) The name of a directory to clone into.",
				Value:       "{{.cds.workspace}}",
				Type:        sdk.StringParameter,
			},
			{
				Name:        "depth",
				Description: "(optional) Clone with a depth of 50 by default. You can remove --depth with the value 'false'.",
				Value:       "",
				Type:        sdk.StringParameter,
				Advanced:    true,
			},
			{
				Name:        "submodules",
				Description: "(optional) Submodules are cloned by default, you can set 'false' to avoid this.",
				Value:       "true",
				Type:        sdk.BooleanParameter,
				Advanced:    true,
			},
			{
				Name:        "tag",
				Description: "(optional) Useful when you want to git clone a specific tag. Empty by default, you can set to `{{.git.tag}}` to clone a tag from your repository. In this way, in your workflow payload you can add a key in your JSON like \"git.tag\": \"1.0.2\".",
				Value:       sdk.DefaultGitCloneParameterTagValue,
				Type:        sdk.StringParameter,
				Advanced:    true,
			},
		},
		Requirements: []sdk.Requirement{
			sdk.Requirement{
				Name:  "git",
				Type:  sdk.BinaryRequirement,
				Value: "git",
			},
		},
	},
	Example: exportentities.PipelineV1{
		Version: exportentities.PipelineVersion1,
		Name:    "Pipeline1",
		Stages:  []string{"Stage1"},
		Jobs: []exportentities.Job{{
			Name:  "Job1",
			Stage: "Stage1",
			Steps: []exportentities.Step{
				{
					GitClone: &exportentities.StepGitClone{
						URL:        "{{.git.url}}",
						Branch:     "{{.git.branch}}",
						Commit:     "{{.git.commit}}",
						PrivateKey: "proj-mykey",
						Directory:  "{{.cds.workspace}}",
					},
				},
			},
		}},
	},
}

GitClone action definition.

View Source
var GitTag = Manifest{
	Action: sdk.Action{
		Name: sdk.GitTagAction,
		Description: `Tag the current branch and push it. Use vcs config from your application.
Semver used if fully compatible with https://semver.org.
`,
		Parameters: []sdk.Parameter{
			{
				Name:        "tagLevel",
				Description: "Set the level of the tag. Must be 'major' or 'minor' or 'patch'.",
				Value:       "",
				Type:        sdk.StringParameter,
			},
			{
				Name:        "tagPrerelease",
				Description: "(optional) Prerelease version of the tag. Example: alpha on a tag 1.0.0 will return 1.0.0-alpha.",
				Value:       "",
				Type:        sdk.StringParameter,
			},
			{
				Name:        "tagMetadata",
				Description: "(optional) Metadata of the tag. Example: cds.42 on a tag 1.0.0 will return 1.0.0+cds.42.",
				Value:       "",
				Type:        sdk.StringParameter,
			},
			{
				Name:        "tagMessage",
				Description: "(optional) Set a message for the tag.",
				Value:       "",
				Type:        sdk.StringParameter,
			},
			{
				Name:        "path",
				Description: "(optional) The path to your git directory.",
				Value:       "{{.cds.workspace}}",
				Type:        sdk.StringParameter,
			},
			{
				Name:        "prefix",
				Description: "(optional) Add a prefix for tag name.",
				Value:       "",
				Type:        sdk.StringParameter,
				Advanced:    true,
			},
		},
		Requirements: []sdk.Requirement{
			{
				Name:  "git",
				Type:  sdk.BinaryRequirement,
				Value: "git",
			},
			{
				Name:  "gpg",
				Type:  sdk.BinaryRequirement,
				Value: "gpg",
			},
		},
	},
	Example: exportentities.PipelineV1{
		Version: exportentities.PipelineVersion1,
		Name:    "Pipeline1",
		Parameters: map[string]exportentities.ParameterValue{
			"tagLevel": exportentities.ParameterValue{
				Type:         "list",
				DefaultValue: "major;minor;patch",
				Description:  "major, minor or patch",
			},
		},
		Stages: []string{"Stage1"},
		Jobs: []exportentities.Job{{
			Name:  "Job1",
			Stage: "Stage1",
			Steps: []exportentities.Step{
				{
					Checkout: &checkoutExample,
				},
				{
					GitTag: &exportentities.StepGitTag{
						Path:       "{{.cds.workspace}}",
						TagLevel:   "{{.cds.pip.tagLevel}}",
						TagMessage: "Release from CDS run {{.cds.version}}",
					},
				},
			},
		}},
	},
}

GitTag action definition.

View Source
var JUnit = Manifest{
	Action: sdk.Action{
		Name:        sdk.JUnitAction,
		Description: "This action parses a given Junit formatted XML file to extract its test results.",
		Parameters: []sdk.Parameter{
			{
				Name:        "path",
				Description: `Path to junit xml file.`,
				Type:        sdk.TextParameter,
			},
		},
	},
	Example: exportentities.PipelineV1{
		Version: exportentities.PipelineVersion1,
		Name:    "Pipeline1",
		Stages:  []string{"Stage1"},
		Jobs: []exportentities.Job{{
			Name:  "Job1",
			Stage: "Stage1",
			Steps: []exportentities.Step{
				{
					JUnitReport: &exampleJUnit,
				},
			},
		}},
	},
}

JUnit action definition.

List of all available actions.

View Source
var Promote = Manifest{
	Action: sdk.Action{
		Name:        sdk.PromoteAction,
		Description: "This action promote artifacts in an artifact manager",
		Parameters: []sdk.Parameter{
			{
				Name:        "artifacts",
				Description: "(optional) Set a list of artifacts, separate by ','. You can also use regexp.",
				Type:        sdk.StringParameter,
			},
			{
				Name:        "srcMaturity",
				Description: "Repository suffix from which the artifact will be moved",
				Type:        sdk.StringParameter,
				Advanced:    true,
			},
			{
				Name:        "destMaturity",
				Description: "Repository suffix in which the artifact will be moved",
				Type:        sdk.StringParameter,
				Value:       "release",
			},
			{
				Name:        "setProperties",
				Description: "Properties to add on the promoted artifacts",
				Type:        sdk.StringParameter,
				Advanced:    true,
			},
		},
	},
	Example: exportentities.PipelineV1{
		Version: exportentities.PipelineVersion1,
		Name:    "Pipeline1",
		Stages:  []string{"Stage1"},
		Jobs: []exportentities.Job{{
			Name:  "Job1",
			Stage: "Stage1",
			Steps: []exportentities.Step{
				{
					Promote: &exportentities.StepPromote{
						Artifacts: "(.*).zip",
					},
				},
			},
		}},
	},
}

Promote action definition.

View Source
var PushBuildInfo = Manifest{
	Action: sdk.Action{
		Name:        sdk.PushBuildInfo,
		Description: `Push build info into an artifact manager, useful only if you have an artifact manager linked to your workflow.`,
	},
	Example: exportentities.PipelineV1{
		Version: exportentities.PipelineVersion1,
		Name:    "Pipeline1",
		Stages:  []string{"Stage1"},
		Jobs: []exportentities.Job{{
			Name:  "Job1",
			Stage: "Stage1",
			Steps: []exportentities.Step{
				{
					PushBuildInfo: &pushBuildInfoExample,
				},
			},
		}},
	},
}

PushBuildInfo action definition.

View Source
var Release = Manifest{
	Action: sdk.Action{
		Name:        sdk.ReleaseAction,
		Description: "This action creates a release on a artifact manager. It promotes artifacts.",
		Parameters: []sdk.Parameter{
			{
				Name:        "releaseNote",
				Description: "(optional) Set a release note for the release.",
				Type:        sdk.TextParameter,
			},
			{
				Name:        "artifacts",
				Description: "(optional) Set a list of artifacts, separate by ','. You can also use regexp.",
				Type:        sdk.StringParameter,
			},
			{
				Name:        "srcMaturity",
				Description: "Repository suffix from which the artifact will be moved",
				Type:        sdk.StringParameter,
				Advanced:    true,
			},
			{
				Name:        "destMaturity",
				Description: "Repository suffix in which the artifact will be moved",
				Type:        sdk.StringParameter,
				Value:       "release",
			},
			{
				Name:        "setProperties",
				Description: "Properties to add on the released artifacts",
				Type:        sdk.StringParameter,
				Advanced:    true,
			},
		},
	},
	Example: exportentities.PipelineV1{
		Version: exportentities.PipelineVersion1,
		Name:    "Pipeline1",
		Stages:  []string{"Stage1"},
		Jobs: []exportentities.Job{{
			Name:  "Job1",
			Stage: "Stage1",
			Steps: []exportentities.Step{
				{
					Release: &exportentities.StepRelease{
						Artifacts: "(.*).zip",
					},
				},
			},
		}},
	},
}

Release action definition.

View Source
var ReleaseVCS = Manifest{
	Action: sdk.Action{
		Name:        sdk.ReleaseVCSAction,
		Description: "This action creates a release on the git repository linked to the application, if repository manager implements it.",
		Parameters: []sdk.Parameter{
			{
				Name:        "tag",
				Description: "Tag attached to the release.",
				Value:       "{{.cds.release.version}}",
				Type:        sdk.StringParameter,
			},
			{
				Name:        "title",
				Value:       "",
				Description: "Set a title for the release.",
				Type:        sdk.StringParameter,
			},
			{
				Name:        "releaseNote",
				Description: "(optional) Set a release note for the release.",
				Type:        sdk.TextParameter,
			},
			{
				Name:        "artifacts",
				Description: "(optional) Set a list of artifacts, separate by ','. You can also use regexp.",
				Type:        sdk.StringParameter,
			},
		},
	},
	Example: exportentities.PipelineV1{
		Version: exportentities.PipelineVersion1,
		Name:    "Pipeline1",
		Parameters: map[string]exportentities.ParameterValue{
			"tagLevel": exportentities.ParameterValue{
				Type:         "list",
				DefaultValue: "major;minor;patch",
				Description:  "major, minor or patch",
			},
		},
		Stages: []string{"Stage1"},
		Jobs: []exportentities.Job{{
			Name:  "Job1",
			Stage: "Stage1",
			Steps: []exportentities.Step{
				{
					Checkout: &checkoutExample,
				},
				{
					GitTag: &exportentities.StepGitTag{
						Path:       "{{.cds.workspace}}",
						TagLevel:   "{{.cds.pip.tagLevel}}",
						TagMessage: "Release from CDS run {{.cds.version}}",
					},
				},
				{
					Script: []string{
						"#!/bin/sh",
						"TAG=`git describe --abbrev=0 --tags`",
						"worker export tag $TAG",
					},
				},
				{
					ReleaseVCS: &exportentities.StepReleaseVCS{
						Artifacts:   "{{.cds.workspace}}/myFile",
						Title:       "{{.cds.build.tag}}",
						ReleaseNote: "My release {{.cds.build.tag}}",
						Tag:         "{{.cds.build.tag}}",
					},
				},
			},
		}},
	},
}

ReleaseVCS action definition.

View Source
var Script = Manifest{
	Action: sdk.Action{
		Name:        sdk.ScriptAction,
		Description: `This action executes a given script with a given interpreter.`,
		Parameters: []sdk.Parameter{
			{
				Name: "script",
				Description: `Content of your script.
You can put #!/bin/bash, or #!/bin/perl at first line.
Make sure that the binary used is in
the pre-requisites of action.`,
				Type: sdk.TextParameter,
			},
		},
	},
	Example: exportentities.PipelineV1{
		Version: exportentities.PipelineVersion1,
		Name:    "Pipeline1",
		Stages:  []string{"Stage1"},
		Jobs: []exportentities.Job{{
			Name:  "Job1",
			Stage: "Stage1",
			Steps: []exportentities.Step{
				{
					Script: []string{
						"#!/bin/sh",
						"echo \"{{.cds.application}}\"",
					},
				},
			},
		}},
	},
}

Script action definition.

Functions

This section is empty.

Types

type Manifest

type Manifest struct {
	Action  sdk.Action
	Example exportentities.PipelineV1
}

Manifest for a action.

func (Manifest) Markdown

func (m Manifest) Markdown() string

Markdown returns string formatted for an action.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL