internal

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

* Copyright (c) 2021, salesforce.com, inc. * All rights reserved. * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause

* Copyright (c) 2021, salesforce.com, inc. * All rights reserved. * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause

Index

Constants

View Source
const ChannelMessageTestErr = "error from postChannelMessage"
View Source
const WebhookMessageTestErr = "error from postWebhookMessage"

Variables

View Source
var (
	PickRunModeErrorMessage = "please specify either HOOK_URL or both OAUTH_TOKEN and DEST_CHANNEL_ID"
)

Functions

This section is empty.

Types

type BuildInfo

type BuildInfo struct {
	JobName         string `required:"true" split_words:"true" desc:"Name of the build's job"`
	BuildURL        string `required:"true" split_words:"true" desc:"Direct URL to the build"`
	BuildStatus     string `required:"true" split_words:"true" desc:"Status of build (e.g. currentBuild.currentResult in Jenkins)"`
	HookURL         string `split_words:"true" desc:"Slack Webhook URL set via Incoming Webhooks"`
	DestChannelId   string `split_words:"true" desc:"Destination Channel ID (not the name of the channel)"`
	OauthToken      string `split_words:"true" desc:"OAuth Token used to send message via app"`
	LastBuildStatus string `split_words:"true" default:"UNKNOWN" desc:"Status of last build used to provide contextual build Status"`
	BranchName      string `split_words:"true" desc:"Name of git branch"`
	GitCommit       string `split_words:"true" desc:"Git commit hash"`
	BuildTime       string `split_words:"true" desc:"Build time (e.g. durationString in Jenkins)"`
	TriggeredBy     string `split_words:"true" desc:"The action which triggered the build"`
	SkipIfSuccess   bool   `split_words:"true" desc:"Skip posting if contextual Status is success"`
}

BuildInfo represents the build information passed in from the caller

func GetBuildInfoFromEnv

func GetBuildInfoFromEnv() (BuildInfo, error)

func (*BuildInfo) GetContextualStatus

func (buildInfo *BuildInfo) GetContextualStatus() Status

func (*BuildInfo) ShouldSkipPosting

func (buildInfo *BuildInfo) ShouldSkipPosting() bool

type SlackClient

type SlackClient struct {
	// contains filtered or unexported fields
}

func NewSlackClient

func NewSlackClient() SlackClient

func NewTestClient

func NewTestClient(postChannelMessageShouldError bool, postWebhookMessageShouldError bool) SlackClient

func (*SlackClient) PostToSlack

func (client *SlackClient) PostToSlack(buildInfo BuildInfo) error

type Status

type Status struct {
	// contains filtered or unexported fields
}

Status represents generic build status with text and an associated color

Jump to

Keyboard shortcuts

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