semaphore

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const FailedOutputChannel = "failed"
View Source
const PassedOutputChannel = "passed"
View Source
const PayloadType = "semaphore.workflow.finished"
View Source
const PipelineResultPassed = "passed"
View Source
const PipelineStateDone = "done"
View Source
const PollInterval = 5 * time.Minute

Variables

This section is empty.

Functions

This section is empty.

Types

type Client added in v0.5.0

type Client struct {
	OrgURL   string
	APIToken string
	// contains filtered or unexported fields
}

func NewClient added in v0.5.0

func NewClient(http core.HTTPContext, ctx core.IntegrationContext) (*Client, error)

func (*Client) CreateNotification added in v0.5.0

func (c *Client) CreateNotification(params any) (*Notification, error)

func (*Client) CreateWebhookSecret added in v0.5.0

func (c *Client) CreateWebhookSecret(name, key string) (*Secret, error)

func (*Client) DeleteNotification added in v0.5.0

func (c *Client) DeleteNotification(id string) error

func (*Client) DeleteSecret added in v0.5.0

func (c *Client) DeleteSecret(name string) error

func (*Client) GetNotification added in v0.5.0

func (c *Client) GetNotification(id string) (*Notification, error)

func (*Client) GetPipeline added in v0.5.0

func (c *Client) GetPipeline(id string) (*Pipeline, error)

func (*Client) GetProject added in v0.5.0

func (c *Client) GetProject(idOrName string) (*ProjectResponse, error)

func (*Client) GetSecret added in v0.5.0

func (c *Client) GetSecret(id string) (*Secret, error)

func (*Client) ListPipelines added in v0.5.0

func (c *Client) ListPipelines(projectID string) ([]any, error)

func (*Client) RunWorkflow added in v0.5.0

func (c *Client) RunWorkflow(params any) (*CreateWorkflowResponse, error)

type Configuration added in v0.5.0

type Configuration struct {
	OrganizationURL string `json:"organizationUrl"`
	APIToken        string `json:"apiToken"`
}

type CreateWorkflowResponse

type CreateWorkflowResponse struct {
	WorkflowID string `json:"workflow_id"`
	PipelineID string `json:"pipeline_id"`
}

type Metadata added in v0.5.0

type Metadata struct {
	Projects []string `json:"projects"`
}

type Notification

type Notification struct {
	APIVersion string               `json:"apiVersion"`
	Kind       string               `json:"kind"`
	Metadata   NotificationMetadata `json:"metadata"`
	Spec       NotificationSpec     `json:"spec"`
}

type NotificationMetadata

type NotificationMetadata struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type NotificationNotifySlack

type NotificationNotifySlack struct {
	Endpoint string   `json:"endpoint,omitempty"`
	Channels []string `json:"channels,omitempty"`
}

type NotificationNotifyWebhook

type NotificationNotifyWebhook struct {
	Endpoint string `json:"endpoint"`
	Secret   string `json:"secret"`
}

type NotificationRule

type NotificationRule struct {
	Name   string                 `json:"name"`
	Filter NotificationRuleFilter `json:"filter"`
	Notify NotificationRuleNotify `json:"notify"`
}

type NotificationRuleFilter

type NotificationRuleFilter struct {
	Branches  []string `json:"branches"`
	Pipelines []string `json:"pipelines"`
	Projects  []string `json:"projects"`
	Results   []string `json:"results"`
}

type NotificationRuleNotify

type NotificationRuleNotify struct {
	Webhook NotificationNotifyWebhook `json:"webhook"`

	// TODO
	// we don't really need this, but if it's not in the request,
	// the API does not work properly.
	// Once it's fixed, or we migrate to v2 API, we can remove it from here.
	//
	Slack NotificationNotifySlack `json:"slack"`
}

type NotificationSpec

type NotificationSpec struct {
	Rules []NotificationRule `json:"rules"`
}

type OnPipelineDone added in v0.5.0

type OnPipelineDone struct{}

func (*OnPipelineDone) Actions added in v0.5.0

func (p *OnPipelineDone) Actions() []core.Action

func (*OnPipelineDone) Color added in v0.5.0

func (p *OnPipelineDone) Color() string

func (*OnPipelineDone) Configuration added in v0.5.0

func (p *OnPipelineDone) Configuration() []configuration.Field

func (*OnPipelineDone) Description added in v0.5.0

func (p *OnPipelineDone) Description() string

func (*OnPipelineDone) Documentation added in v0.5.0

func (p *OnPipelineDone) Documentation() string

func (*OnPipelineDone) ExampleData added in v0.5.0

func (t *OnPipelineDone) ExampleData() map[string]any

func (*OnPipelineDone) HandleAction added in v0.5.0

func (p *OnPipelineDone) HandleAction(ctx core.TriggerActionContext) (map[string]any, error)

func (*OnPipelineDone) HandleWebhook added in v0.5.0

func (p *OnPipelineDone) HandleWebhook(ctx core.WebhookRequestContext) (int, error)

func (*OnPipelineDone) Icon added in v0.5.0

func (p *OnPipelineDone) Icon() string

func (*OnPipelineDone) Label added in v0.5.0

func (p *OnPipelineDone) Label() string

func (*OnPipelineDone) Name added in v0.5.0

func (p *OnPipelineDone) Name() string

func (*OnPipelineDone) Setup added in v0.5.0

func (p *OnPipelineDone) Setup(ctx core.TriggerContext) error

type OnPipelineDoneConfiguration added in v0.5.0

type OnPipelineDoneConfiguration struct {
	Project string `json:"project"`
}

type OnPipelineDoneMetadata added in v0.5.0

type OnPipelineDoneMetadata struct {
	Project *Project `json:"project"`
}

type Parameter added in v0.5.0

type Parameter struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type Pipeline

type Pipeline struct {
	PipelineName string `json:"name"`
	PipelineID   string `json:"ppl_id"`
	WorkflowID   string `json:"wf_id"`
	State        string `json:"state"`
	Result       string `json:"result"`
}

type PipelineMetadata added in v0.5.0

type PipelineMetadata struct {
	ID     string `json:"id"`
	State  string `json:"state"`
	Result string `json:"result"`
}

type PipelineResponse

type PipelineResponse struct {
	Pipeline *Pipeline `json:"pipeline"`
}

type Project

type Project struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	URL  string `json:"url"`
}

type ProjectMetadata

type ProjectMetadata struct {
	ProjectName string `json:"name"`
	ProjectID   string `json:"id"`
}

type ProjectResponse added in v0.5.0

type ProjectResponse struct {
	Metadata *ProjectMetadata `json:"metadata"`
}

type RunWorkflow added in v0.5.0

type RunWorkflow struct{}

func (*RunWorkflow) Actions added in v0.5.0

func (r *RunWorkflow) Actions() []core.Action

func (*RunWorkflow) Cancel added in v0.5.0

func (r *RunWorkflow) Cancel(ctx core.ExecutionContext) error

func (*RunWorkflow) Color added in v0.5.0

func (r *RunWorkflow) Color() string

func (*RunWorkflow) Configuration added in v0.5.0

func (r *RunWorkflow) Configuration() []configuration.Field

func (*RunWorkflow) Description added in v0.5.0

func (r *RunWorkflow) Description() string

func (*RunWorkflow) Documentation added in v0.5.0

func (r *RunWorkflow) Documentation() string

func (*RunWorkflow) ExampleOutput added in v0.5.0

func (c *RunWorkflow) ExampleOutput() map[string]any

func (*RunWorkflow) Execute added in v0.5.0

func (r *RunWorkflow) Execute(ctx core.ExecutionContext) error

func (*RunWorkflow) HandleAction added in v0.5.0

func (r *RunWorkflow) HandleAction(ctx core.ActionContext) error

func (*RunWorkflow) HandleWebhook added in v0.5.0

func (r *RunWorkflow) HandleWebhook(ctx core.WebhookRequestContext) (int, error)

func (*RunWorkflow) Icon added in v0.5.0

func (r *RunWorkflow) Icon() string

func (*RunWorkflow) Label added in v0.5.0

func (r *RunWorkflow) Label() string

func (*RunWorkflow) Name added in v0.5.0

func (r *RunWorkflow) Name() string

func (*RunWorkflow) OutputChannels added in v0.5.0

func (r *RunWorkflow) OutputChannels(configuration any) []core.OutputChannel

func (*RunWorkflow) ProcessQueueItem added in v0.5.0

func (r *RunWorkflow) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*RunWorkflow) Setup added in v0.5.0

func (r *RunWorkflow) Setup(ctx core.SetupContext) error

type RunWorkflowExecutionMetadata added in v0.5.0

type RunWorkflowExecutionMetadata struct {
	Workflow *WorkflowMetadata `json:"workflow" mapstructure:"workflow"`
	Pipeline *PipelineMetadata `json:"pipeline" mapstructure:"pipeline"`
	Extra    map[string]any    `json:"extra,omitempty" mapstructure:"extra,omitempty"`
}

type RunWorkflowNodeMetadata added in v0.5.0

type RunWorkflowNodeMetadata struct {
	Project *Project `json:"project" mapstructure:"project"`
}

type RunWorkflowSpec added in v0.5.0

type RunWorkflowSpec struct {
	Project      string      `json:"project"`
	Ref          string      `json:"ref"`
	PipelineFile string      `json:"pipelineFile"`
	CommitSha    string      `json:"commitSha"`
	Parameters   []Parameter `json:"parameters"`
}

type Secret

type Secret struct {
	APIVersion string         `json:"apiVersion"`
	Kind       string         `json:"kind"`
	Metadata   SecretMetadata `json:"metadata"`
	Data       SecretSpecData `json:"data"`
}

type SecretMetadata

type SecretMetadata struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type SecretSpecData

type SecretSpecData struct {
	EnvVars []SecretSpecDataEnvVar `json:"env_vars"`
}

type SecretSpecDataEnvVar

type SecretSpecDataEnvVar struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type Semaphore added in v0.5.0

type Semaphore struct{}

func (*Semaphore) CleanupWebhook added in v0.5.0

func (s *Semaphore) CleanupWebhook(ctx core.CleanupWebhookContext) error

func (*Semaphore) CompareWebhookConfig added in v0.5.0

func (s *Semaphore) CompareWebhookConfig(a, b any) (bool, error)

func (*Semaphore) Components added in v0.5.0

func (s *Semaphore) Components() []core.Component

func (*Semaphore) Configuration added in v0.5.0

func (s *Semaphore) Configuration() []configuration.Field

func (*Semaphore) Description added in v0.5.0

func (s *Semaphore) Description() string

func (*Semaphore) HandleRequest added in v0.5.0

func (s *Semaphore) HandleRequest(ctx core.HTTPRequestContext)

func (*Semaphore) Icon added in v0.5.0

func (s *Semaphore) Icon() string

func (*Semaphore) Instructions added in v0.5.0

func (s *Semaphore) Instructions() string

func (*Semaphore) Label added in v0.5.0

func (s *Semaphore) Label() string

func (*Semaphore) ListResources added in v0.5.0

func (s *Semaphore) ListResources(resourceType string, ctx core.ListResourcesContext) ([]core.IntegrationResource, error)

func (*Semaphore) Name added in v0.5.0

func (s *Semaphore) Name() string

func (*Semaphore) SetupWebhook added in v0.5.0

func (s *Semaphore) SetupWebhook(ctx core.SetupWebhookContext) (any, error)

func (*Semaphore) Sync added in v0.5.0

func (s *Semaphore) Sync(ctx core.SyncContext) error

func (*Semaphore) Triggers added in v0.5.0

func (s *Semaphore) Triggers() []core.Trigger

type WebhookConfiguration added in v0.5.0

type WebhookConfiguration struct {
	Project string `json:"project"`
}

type WebhookMetadata

type WebhookMetadata struct {
	Secret       WebhookSecretMetadata       `json:"secret"`
	Notification WebhookNotificationMetadata `json:"notification"`
}

type WebhookNotificationMetadata

type WebhookNotificationMetadata struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type WebhookSecretMetadata

type WebhookSecretMetadata struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type WorkflowMetadata added in v0.5.0

type WorkflowMetadata struct {
	ID  string `json:"id"`
	URL string `json:"url"`
}

Jump to

Keyboard shortcuts

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