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 (*BuildInfo) GetContextualStatus ¶
func (*BuildInfo) ShouldSkipPosting ¶
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
Click to show internal directories.
Click to hide internal directories.