plugin

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2022 License: BlueOak-1.0.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exec

func Exec(ctx context.Context, args Args) error

Exec executes the plugin.

Types

type Args

type Args struct {
	Pipeline

	// Level defines the plugin log level.
	Level string `envconfig:"PLUGIN_LOG_LEVEL"`

	// Atlassian Cloud ID (required)
	CloudID string `envconfig:"PLUGIN_CLOUD_ID"`

	// Atlassian Oauth2 Client ID (required)
	ClientID string `envconfig:"PLUGIN_CLIENT_ID"`

	// Atlassian Oauth2 Client Secret (required)
	ClientSecret string `envconfig:"PLUGIN_CLIENT_SECRET"`

	// Site Name (optional)
	Site string `envconfig:"PLUGIN_INSTANCE"`

	// Project Name (required)
	Project string `envconfig:"PLUGIN_PROJECT"`

	// Pipeline Name (optional)
	Name string `envconfig:"PLUGIN_PIPELINE"`

	// Deployment environment (optional)
	EnvironmentName string `envconfig:"PLUGIN_ENVIRONMENT_NAME"`

	// Link to deployment (optional)
	Link string `envconfig:"PLUGIN_LINK"`

	// State of the deployment (optional)
	State string `envconfig:"PLUGIN_STATE"`

	// Path to the adaptive card
	CardFilePath string `envconfig:"DRONE_CARD_PATH"`
}

Args provides plugin execution arguments.

type Association

type Association struct {
	Associationtype string   `json:"associationType"`
	Values          []string `json:"values"`
}

Association provides the association details.

type Card added in v1.1.0

type Card struct {
	Pipeline    string `json:"pipeline"`
	Instance    string `json:"instance"`
	Project     string `json:"project"`
	State       string `json:"state"`
	Version     string `json:"version"`
	Environment string `json:"environment"`
	URL         string `json:"url"`
}

struct for adaptive card

type Deployment

type Deployment struct {
	Deploymentsequencenumber int           `json:"deploymentSequenceNumber"`
	Updatesequencenumber     int           `json:"updateSequenceNumber"`
	Associations             []Association `json:"associations"`
	Displayname              string        `json:"displayName"`
	URL                      string        `json:"url"`
	Description              string        `json:"description"`
	Lastupdated              time.Time     `json:"lastUpdated"`
	State                    string        `json:"state"`
	Pipeline                 JiraPipeline  `json:"pipeline"`
	Environment              Environment   `json:"environment"`
}

Deployment provides the Deployment details.

type Environment

type Environment struct {
	ID          string `json:"id"`
	Displayname string `json:"displayName"`
	Type        string `json:"type"`
}

Environment provides the environment details.

type JiraPipeline

type JiraPipeline struct {
	ID          string `json:"id"`
	Displayname string `json:"displayName"`
	URL         string `json:"url"`
}

JiraPipeline provides the jira pipeline details.

type Payload

type Payload struct {
	Deployments []*Deployment `json:"deployments"`
}

Payload provides the Deployment payload.

type Pipeline

type Pipeline struct {
	// Build provides build metadata.
	Build struct {
		Branch   string `envconfig:"DRONE_BUILD_BRANCH"`
		Number   int    `envconfig:"DRONE_BUILD_NUMBER"`
		Parent   int    `envconfig:"DRONE_BUILD_PARENT"`
		Event    string `envconfig:"DRONE_BUILD_EVENT"`
		Action   string `envconfig:"DRONE_BUILD_ACTION"`
		Status   string `envconfig:"DRONE_BUILD_STATUS"`
		Created  int64  `envconfig:"DRONE_BUILD_CREATED"`
		Started  int64  `envconfig:"DRONE_BUILD_STARTED"`
		Finished int64  `envconfig:"DRONE_BUILD_FINISHED"`
		Link     string `envconfig:"DRONE_BUILD_LINK"`
	}

	// Calver provides the calver details parsed from the
	// git tag. If the git tag is empty or is not a valid
	// calver, the values will be empty.
	Calver struct {
		Version    string `envconfig:"DRONE_CALVER"`
		Short      string `envconfig:"DRONE_CALVER_SHORT"`
		MajorMinor string `envconfig:"DRONE_CALVER_MAJOR_MINOR"`
		Major      string `envconfig:"DRONE_CALVER_MAJOR"`
		Minor      string `envconfig:"DRONE_CALVER_MINOR"`
		Micro      string `envconfig:"DRONE_CALVER_MICRO"`
		Modifier   string `envconfig:"DRONE_CALVER_MODIFIER"`
	}

	// Commit provides the commit metadata.
	Commit struct {
		Rev     string `envconfig:"DRONE_COMMIT_SHA"`
		Before  string `envconfig:"DRONE_COMMIT_BEFORE"`
		After   string `envconfig:"DRONE_COMMIT_AFTER"`
		Ref     string `envconfig:"DRONE_COMMIT_REF"`
		Branch  string `envconfig:"DRONE_COMMIT_BRANCH"`
		Source  string `envconfig:"DRONE_COMMIT_SOURCE"`
		Target  string `envconfig:"DRONE_COMMIT_TARGET"`
		Link    string `envconfig:"DRONE_COMMIT_LINK"`
		Message string `envconfig:"DRONE_COMMIT_MESSAGE"`

		Author struct {
			Username string `envconfig:"DRONE_COMMIT_AUTHOR"`
			Name     string `envconfig:"DRONE_COMMIT_AUTHOR_NAME"`
			Email    string `envconfig:"DRONE_COMMIT_AUTHOR_EMAIL"`
			Avatar   string `envconfig:"DRONE_COMMIT_AUTHOR_AVATAR"`
		}
	}

	// Deploy provides the deployment metadata.
	Deploy struct {
		ID     string `envconfig:"DRONE_DEPLOY_TO"`
		Target string `envconfig:"DRONE_DEPLOY_ID"`
	}

	// Failed provides a list of failed steps and failed stages
	// for the current pipeline.
	Failed struct {
		Steps  []string `envconfig:"DRONE_FAILED_STEPS"`
		Stages []string `envconfig:"DRONE_FAILED_STAGES"`
	}

	// Git provides the git repository metadata.
	Git struct {
		HTTPURL string `envconfig:"DRONE_GIT_HTTP_URL"`
		SSHURL  string `envconfig:"DRONE_GIT_SSH_URL"`
	}

	// PullRequest provides the pull request metadata.
	PullRequest struct {
		Number int    `envconfig:"DRONE_PULL_REQUEST"`
		Title  string `envconfig:"DRONE_PULL_REQUEST_TITLE"`
	}

	// Repo provides the repository metadata.
	Repo struct {
		Branch     string `envconfig:"DRONE_REPO_BRANCH"`
		Link       string `envconfig:"DRONE_REPO_LINK"`
		Namespace  string `envconfig:"DRONE_REPO_NAMESPACE"`
		Name       string `envconfig:"DRONE_REPO_NAME"`
		Private    bool   `envconfig:"DRONE_REPO_PRIVATE"`
		Remote     string `envconfig:"DRONE_GIT_HTTP_URL"`
		SCM        string `envconfig:"DRONE_REPO_SCM"`
		Slug       string `envconfig:"DRONE_REPO"`
		Visibility string `envconfig:"DRONE_REPO_VISIBILITY"`
	}

	// Stage provides the stage metadata.
	Stage struct {
		Kind      string   `envconfig:"DRONE_STAGE_KIND"`
		Type      string   `envconfig:"DRONE_STAGE_TYPE"`
		Name      string   `envconfig:"DRONE_STAGE_NAME"`
		Number    int      `envconfig:"DRONE_STAGE_NUMBER"`
		Machine   string   `envconfig:"DRONE_STAGE_MACHINE"`
		OS        string   `envconfig:"DRONE_STAGE_OS"`
		Arch      string   `envconfig:"DRONE_STAGE_ARCH"`
		Variant   string   `envconfig:"DRONE_STAGE_VARIANT"`
		Status    string   `envconfig:"DRONE_STAGE_STATUS"`
		Started   int64    `envconfig:"DRONE_STAGE_STARTED"`
		Finished  int64    `envconfig:"DRONE_STAGE_FINISHED"`
		DependsOn []string `envconfig:"DRONE_STAGE_DEPENDS_ON"`
	}

	// Step provides the step metadata.
	Step struct {
		Number int    `envconfig:"DRONE_STEP_NUMBER"`
		Name   string `envconfig:"DRONE_STEP_NAME"`
	}

	// Semver provides the semver details parsed from the
	// git tag. If the git tag is empty or is not a valid
	// semver, the values will be empty and the error field
	// will be populated with the parsing error.
	Semver struct {
		Version    string `envconfig:"DRONE_SEMVER"`
		Short      string `envconfig:"DRONE_SEMVER_SHORT"`
		Major      string `envconfig:"DRONE_SEMVER_MAJOR"`
		Minor      string `envconfig:"DRONE_SEMVER_MINOR"`
		Patch      string `envconfig:"DRONE_SEMVER_PATCH"`
		Build      string `envconfig:"DRONE_SEMVER_BUILD"`
		PreRelease string `envconfig:"DRONE_SEMVER_PRERELEASE"`
		Error      string `envconfig:"DRONE_SEMVER_ERROR"`
	}

	// System provides the Drone system metadata, including
	// the system version of details required to create the
	// drone website address.
	System struct {
		Proto    string `envconfig:"DRONE_SYSTEM_PROTO"`
		Host     string `envconfig:"DRONE_SYSTEM_HOST"`
		Hostname string `envconfig:"DRONE_SYSTEM_HOSTNAME"`
		Version  string `envconfig:"DRONE_SYSTEM_VERSION"`
	}

	// Tag provides the git tag details.
	Tag struct {
		Name string `envconfig:"DRONE_TAG"`
	}
}

Pipeline provides Pipeline metadata from the environment.

type Tenant

type Tenant struct {
	ID string `json:"cloudId"`
}

Tenant provides the jira instance tenant details.

Jump to

Keyboard shortcuts

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