diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 77becd54af..4adbf9d3c6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -42,7 +42,7 @@ eval $(minikube docker-env) #### 5. Build the project ``` -make all +make build ``` Follow [README](README.md#install) to install components. diff --git a/USERS.md b/USERS.md index 1d6c980dfa..22aa33a275 100644 --- a/USERS.md +++ b/USERS.md @@ -3,6 +3,7 @@ Organizations below are **officially** using Argo Events. Please send a PR with your organization name if you are using Argo Events. 1. [3Rein](https://www.3rein.com) +1. [7shifts](https://www.7shifts.com) 1. [BioBox Analytics](https://biobox.io) 1. [BlackRock](https://www.blackrock.com/) 1. [Canva](https://www.canva.com/) @@ -13,8 +14,8 @@ Organizations below are **officially** using Argo Events. Please send a PR with 1. [Intuit](https://www.intuit.com/) 1. [OneCause](https://www.onecause.com/) 1. [Produvar](https://www.produvar.com/) +1. [ProPoint Solutions](https://supersalon.com) 1. [Rakuten](https://www.rakuten.com) 1. [RTL Nederland](https://www.rtl.nl) 1. [Viaduct](https://www.viaduct.ai/) 1. [Woolworths Group](https://www.woolworthsgroup.com.au/) -1. [7shifts](https://www.7shifts.com) diff --git a/api/openapi-spec/swagger.json b/api/openapi-spec/swagger.json index 3b910892ba..af905e82c7 100644 --- a/api/openapi-spec/swagger.json +++ b/api/openapi-spec/swagger.json @@ -187,11 +187,11 @@ "description": "SASLMechanism is the name of the enabled SASL mechanism. Possible values: OAUTHBEARER, PLAIN (defaults to PLAIN).", "type": "string" }, - "password": { + "passwordSecret": { "description": "Password for SASL/PLAIN authentication", "$ref": "#/definitions/io.k8s.api.core.v1.SecretKeySelector" }, - "user": { + "userSecret": { "description": "User is the authentication identity (authcid) to present for SASL/PLAIN or SASL/SCRAM authentication", "$ref": "#/definitions/io.k8s.api.core.v1.SecretKeySelector" } diff --git a/eventsources/common/webhook/webhook.go b/eventsources/common/webhook/webhook.go index 065de1af86..9541f98f00 100644 --- a/eventsources/common/webhook/webhook.go +++ b/eventsources/common/webhook/webhook.go @@ -45,7 +45,7 @@ func NewController() *Controller { func NewRoute(hookContext *v1alpha1.WebhookContext, logger *zap.SugaredLogger, eventSourceName, eventName string, metrics *metrics.Metrics) *Route { return &Route{ Context: hookContext, - Logger: logger.With(logging.LabelEventSourceName, eventSourceName, logging.LabelEventName, eventName), + Logger: logger, EventSourceName: eventSourceName, EventName: eventName, Active: false, diff --git a/eventsources/sources/kafka/start.go b/eventsources/sources/kafka/start.go index 047935425c..647dbd5f9c 100644 --- a/eventsources/sources/kafka/start.go +++ b/eventsources/sources/kafka/start.go @@ -275,14 +275,14 @@ func getSaramaConfig(kafkaEventSource *v1alpha1.KafkaEventSource, log *zap.Sugar config.Net.SASL.Mechanism = sarama.SASLMechanism(kafkaEventSource.SASL.GetMechanism()) - user, err := common.GetSecretFromVolume(kafkaEventSource.SASL.User) + user, err := common.GetSecretFromVolume(kafkaEventSource.SASL.UserSecret) if err != nil { log.Errorf("Error getting user value from secret: %v", err) return nil, err } config.Net.SASL.User = user - password, err := common.GetSecretFromVolume(kafkaEventSource.SASL.Password) + password, err := common.GetSecretFromVolume(kafkaEventSource.SASL.PasswordSecret) if err != nil { log.Errorf("Error getting password value from secret: %v", err) return nil, err diff --git a/examples/event-sources/kafka.yaml b/examples/event-sources/kafka.yaml index 8508a20a2d..7286e85bb4 100644 --- a/examples/event-sources/kafka.yaml +++ b/examples/event-sources/kafka.yaml @@ -33,11 +33,7 @@ spec: # limitEventsPerSecond: 1 # version: "2.5.0" -# example-tls: -# url: "kafka.argo-events:9092" -# topic: "topic-2" -# jsonBody: true -# partition: "1" +## Enable TLS authentication ( not to be used with SASL) # tls: # caCertSecret: # name: my-secret @@ -48,3 +44,13 @@ spec: # clientKeySecret: # name: my-secret # key: client-key-key + +## Enable SASL authentication (not to be used with TLS) +# sasl: +# mechanism: PLAIN +# passwordSecret: +# key: password +# name: my-user +# userSecret: +# key: user +# name: my-user diff --git a/pkg/apis/common/common.go b/pkg/apis/common/common.go index 24457f8f9d..63f31b6b93 100644 --- a/pkg/apis/common/common.go +++ b/pkg/apis/common/common.go @@ -136,9 +136,9 @@ type SASLConfig struct { Mechanism string `json:"mechanism,omitempty" protobuf:"bytes,1,opt,name=mechanism"` // User is the authentication identity (authcid) to present for // SASL/PLAIN or SASL/SCRAM authentication - User *corev1.SecretKeySelector `json:"user,omitempty" protobuf:"bytes,2,opt,name=user"` + UserSecret *corev1.SecretKeySelector `json:"userSecret,omitempty" protobuf:"bytes,2,opt,name=user"` // Password for SASL/PLAIN authentication - Password *corev1.SecretKeySelector `json:"password,omitempty" protobuf:"bytes,3,opt,name=password"` + PasswordSecret *corev1.SecretKeySelector `json:"passwordSecret,omitempty" protobuf:"bytes,3,opt,name=password"` } // Backoff for an operation diff --git a/pkg/apis/common/deepcopy_generated.go b/pkg/apis/common/deepcopy_generated.go index 081eca305e..f572ba77e3 100644 --- a/pkg/apis/common/deepcopy_generated.go +++ b/pkg/apis/common/deepcopy_generated.go @@ -269,13 +269,13 @@ func (in *S3Filter) DeepCopy() *S3Filter { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SASLConfig) DeepCopyInto(out *SASLConfig) { *out = *in - if in.User != nil { - in, out := &in.User, &out.User + if in.UserSecret != nil { + in, out := &in.UserSecret, &out.UserSecret *out = new(v1.SecretKeySelector) (*in).DeepCopyInto(*out) } - if in.Password != nil { - in, out := &in.Password, &out.Password + if in.PasswordSecret != nil { + in, out := &in.PasswordSecret, &out.PasswordSecret *out = new(v1.SecretKeySelector) (*in).DeepCopyInto(*out) } diff --git a/pkg/apis/common/generated.pb.go b/pkg/apis/common/generated.pb.go index 9d276e6001..e42bd5ad6b 100644 --- a/pkg/apis/common/generated.pb.go +++ b/pkg/apis/common/generated.pb.go @@ -432,87 +432,88 @@ func init() { } var fileDescriptor_02aae6165a434fa7 = []byte{ - // 1278 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 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0xee, 0xf8, - 0x91, 0x8c, 0xa1, 0xed, 0x45, 0x8c, 0xb6, 0x8f, 0x2f, 0x2e, 0xc7, 0x50, 0xbf, 0x32, 0xd7, 0x09, - 0x88, 0x77, 0xe4, 0x87, 0x94, 0x4d, 0xe7, 0x81, 0x07, 0x54, 0x90, 0x77, 0x58, 0xb5, 0xce, 0x41, - 0xa5, 0x13, 0x44, 0x71, 0x28, 0x50, 0x13, 0xd6, 0x8e, 0xc9, 0x38, 0xa6, 0x35, 0x6b, 0xd7, 0xda, - 0xdb, 0x74, 0xed, 0x64, 0xd6, 0x5c, 0x7b, 0x24, 0x05, 0x58, 0xcb, 0x5b, 0xbf, 0xad, 0xc2, 0xba, - 0x4b, 0xbc, 0x51, 0x34, 0x18, 0xa0, 0x23, 0xa8, 0xf6, 0x63, 0x46, 0x84, 0x1f, 0x85, 0x4a, 0x7f, - 0xe3, 0xd2, 0x0d, 0xa7, 0x60, 0x0e, 0x9c, 0xdb, 0xa1, 0xf8, 0xec, 0xca, 0x7d, 0xd6, 0x13, 0xcc, - 0x0f, 0x87, 0xee, 0x66, 0x32, 0x6b, 0x56, 0x6f, 0x1a, 0x26, 0xce, 0xe8, 0xe8, 0x09, 0x54, 0x06, - 0xc4, 0x13, 0x11, 0xab, 0xad, 0x2a, 0x3f, 0x9f, 0x17, 0xf6, 0xa3, 0xcf, 0xe7, 0x42, 0x32, 0x6b, - 0x56, 0x6e, 0x29, 0x14, 0x36, 0x48, 0x09, 0x7f, 0xea, 0x0b, 0x41, 0x59, 0xad, 0xf4, 0x1e, 0xe0, - 0x77, 0x14, 0x0a, 0x1b, 0x24, 0xfa, 0x10, 0xd6, 0xb8, 0xa0, 0x13, 0x5e, 0x2b, 0xef, 0x5a, 0x7b, - 0x6b, 0xee, 0xd6, 0x8b, 0x59, 0x73, 0x45, 0x26, 0xb5, 0x27, 0x85, 0x58, 0xef, 0xb5, 0x7e, 0xb5, - 0xc0, 0x76, 0x09, 0xf7, 0xbd, 0x4e, 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0xd1, - 0x76, 0x32, 0x6b, 0x6e, 0x76, 0x3b, 0x73, 0x73, 0xbc, 0x00, 0x43, 0x43, 0xd8, 0xf6, 0xc6, 0x3e, - 0x0d, 0x45, 0xce, 0x41, 0xa1, 0x6b, 0xd8, 0x49, 0x66, 0xcd, 0xed, 0xee, 0x12, 0x02, 0xbf, 0x05, - 0x45, 0x7d, 0x38, 0xad, 0x65, 0xca, 0x58, 0xf9, 0x29, 0x74, 0x4b, 0x67, 0x92, 0x59, 0xf3, 0x74, - 0x77, 0x91, 0x80, 0x97, 0x91, 0xe8, 0x4b, 0x00, 0x7d, 0xbc, 0x07, 0x44, 0x1c, 0x99, 0xdf, 0x92, - 0x0f, 0x4c, 0xb6, 0x77, 0x6e, 0xd2, 0x09, 0xa3, 0x9e, 0xfc, 0xef, 0xd7, 0x09, 0x91, 0x3a, 0x38, - 0xa7, 0x8f, 0xbe, 0x86, 0x53, 0xf3, 0xb8, 0x15, 0x41, 0xff, 0xaf, 0xec, 0x1a, 0x42, 0x2d, 0x47, - 0x58, 0xd0, 0xc3, 0x4b, 0x76, 0x68, 0x1f, 0xb6, 0xb2, 0xd0, 0x14, 0xa8, 0xa2, 0x40, 0x4d, 0x03, - 0xfa, 0xff, 0x32, 0xc8, 0xa8, 0xe1, 0x45, 0x2b, 0xf7, 0xfc, 0x8b, 0xd7, 0x8d, 0x95, 0x97, 0xaf, - 0x1b, 0x2b, 0xaf, 0x5e, 0x37, 0x56, 0x7e, 0x48, 0x1a, 0xd6, 0x8b, 0xa4, 0x61, 0xbd, 0x4c, 0x1a, - 0xd6, 0xab, 0xa4, 0x61, 0xfd, 0x99, 0x34, 0xac, 0x5f, 0xfe, 0x6a, 0xac, 0x3c, 0xae, 0xe8, 0x02, - 0xfb, 0x27, 0x00, 0x00, 0xff, 0xff, 0xf2, 0x82, 0x23, 0xb6, 0xc2, 0x0d, 0x00, 0x00, + // 1291 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x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 0x00, + 0x00, 0xff, 0xff, 0x72, 0xea, 0x22, 0xb9, 0xce, 0x0d, 0x00, 0x00, } func (m *Amount) Marshal() (dAtA []byte, err error) { @@ -1050,9 +1051,9 @@ func (m *SASLConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.Password != nil { + if m.PasswordSecret != nil { { - size, err := m.Password.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.PasswordSecret.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1062,9 +1063,9 @@ func (m *SASLConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1a } - if m.User != nil { + if m.UserSecret != nil { { - size, err := m.User.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.UserSecret.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1404,12 +1405,12 @@ func (m *SASLConfig) Size() (n int) { _ = l l = len(m.Mechanism) n += 1 + l + sovGenerated(uint64(l)) - if m.User != nil { - l = m.User.Size() + if m.UserSecret != nil { + l = m.UserSecret.Size() n += 1 + l + sovGenerated(uint64(l)) } - if m.Password != nil { - l = m.Password.Size() + if m.PasswordSecret != nil { + l = m.PasswordSecret.Size() n += 1 + l + sovGenerated(uint64(l)) } return n @@ -1620,8 +1621,8 @@ func (this *SASLConfig) String() string { } s := strings.Join([]string{`&SASLConfig{`, `Mechanism:` + fmt.Sprintf("%v", this.Mechanism) + `,`, - `User:` + strings.Replace(fmt.Sprintf("%v", this.User), "SecretKeySelector", "v1.SecretKeySelector", 1) + `,`, - `Password:` + strings.Replace(fmt.Sprintf("%v", this.Password), "SecretKeySelector", "v1.SecretKeySelector", 1) + `,`, + `UserSecret:` + strings.Replace(fmt.Sprintf("%v", this.UserSecret), "SecretKeySelector", "v1.SecretKeySelector", 1) + `,`, + `PasswordSecret:` + strings.Replace(fmt.Sprintf("%v", this.PasswordSecret), "SecretKeySelector", "v1.SecretKeySelector", 1) + `,`, `}`, }, "") return s @@ -3494,7 +3495,7 @@ func (m *SASLConfig) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field UserSecret", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3521,16 +3522,16 @@ func (m *SASLConfig) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.User == nil { - m.User = &v1.SecretKeySelector{} + if m.UserSecret == nil { + m.UserSecret = &v1.SecretKeySelector{} } - if err := m.User.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.UserSecret.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Password", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PasswordSecret", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3557,10 +3558,10 @@ func (m *SASLConfig) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Password == nil { - m.Password = &v1.SecretKeySelector{} + if m.PasswordSecret == nil { + m.PasswordSecret = &v1.SecretKeySelector{} } - if err := m.Password.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.PasswordSecret.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/pkg/apis/common/openapi_generated.go b/pkg/apis/common/openapi_generated.go index 0fcf695565..48ba7f25ef 100644 --- a/pkg/apis/common/openapi_generated.go +++ b/pkg/apis/common/openapi_generated.go @@ -385,13 +385,13 @@ func schema_argo_events_pkg_apis_common_SASLConfig(ref common.ReferenceCallback) Format: "", }, }, - "user": { + "userSecret": { SchemaProps: spec.SchemaProps{ Description: "User is the authentication identity (authcid) to present for SASL/PLAIN or SASL/SCRAM authentication", Ref: ref("k8s.io/api/core/v1.SecretKeySelector"), }, }, - "password": { + "passwordSecret": { SchemaProps: spec.SchemaProps{ Description: "Password for SASL/PLAIN authentication", Ref: ref("k8s.io/api/core/v1.SecretKeySelector"), diff --git a/pkg/apis/common/validate.go b/pkg/apis/common/validate.go index bc563c2a4f..d1836bedc0 100644 --- a/pkg/apis/common/validate.go +++ b/pkg/apis/common/validate.go @@ -43,8 +43,8 @@ func ValidateSASLConfig(saslConfig *SASLConfig) error { } // user and password must both be set - if saslConfig.User == nil || saslConfig.Password == nil { - return errors.New("invalid sasl config, please configure either User, and/or Password") + if saslConfig.UserSecret == nil || saslConfig.PasswordSecret == nil { + return errors.New("invalid sasl config, both userSecret and passwordSecret must be defined") } return nil diff --git a/pkg/apis/common/validate_test.go b/pkg/apis/common/validate_test.go index 805eb36f0b..cf00f53e39 100644 --- a/pkg/apis/common/validate_test.go +++ b/pkg/apis/common/validate_test.go @@ -37,13 +37,13 @@ func fakeSASLConfig(t *testing.T) *SASLConfig { return &SASLConfig{ Mechanism: "PLAIN", - User: &corev1.SecretKeySelector{ + UserSecret: &corev1.SecretKeySelector{ Key: "fake-key1", LocalObjectReference: corev1.LocalObjectReference{ Name: "user", }, }, - Password: &corev1.SecretKeySelector{ + PasswordSecret: &corev1.SecretKeySelector{ Key: "fake-key2", LocalObjectReference: corev1.LocalObjectReference{ Name: "password", @@ -96,7 +96,7 @@ func TestValidateSASLConfig(t *testing.T) { s := &SASLConfig{} err := ValidateSASLConfig(s) assert.NotNil(t, err) - assert.True(t, strings.Contains(err.Error(), "invalid sasl config, please configure either User, and/or Password")) + assert.True(t, strings.Contains(err.Error(), "invalid sasl config, both userSecret and passwordSecret must be defined")) }) t.Run("test invalid Mechanism is set", func(t *testing.T) { @@ -109,14 +109,14 @@ func TestValidateSASLConfig(t *testing.T) { t.Run("test only User is set", func(t *testing.T) { s := fakeSASLConfig(t) - s.Password = nil + s.PasswordSecret = nil err := ValidateSASLConfig(s) assert.NotNil(t, err) }) t.Run("test only Password is set", func(t *testing.T) { s := fakeSASLConfig(t) - s.User = nil + s.UserSecret = nil err := ValidateSASLConfig(s) assert.NotNil(t, err) }) diff --git a/sensors/triggers/kafka/kafka.go b/sensors/triggers/kafka/kafka.go index abc09a669a..5dff393702 100644 --- a/sensors/triggers/kafka/kafka.go +++ b/sensors/triggers/kafka/kafka.go @@ -67,13 +67,13 @@ func NewKafkaTrigger(sensor *v1alpha1.Sensor, trigger *v1alpha1.Trigger, kafkaPr config.Net.SASL.Enable = true config.Net.SASL.Mechanism = sarama.SASLMechanism(kafkatrigger.SASL.GetMechanism()) - user, err := common.GetSecretFromVolume(kafkatrigger.SASL.User) + user, err := common.GetSecretFromVolume(kafkatrigger.SASL.UserSecret) if err != nil { return nil, errors.Wrap(err, "Error getting user value from secret") } config.Net.SASL.User = user - password, err := common.GetSecretFromVolume(kafkatrigger.SASL.Password) + password, err := common.GetSecretFromVolume(kafkatrigger.SASL.PasswordSecret) if err != nil { return nil, errors.Wrap(err, "Error getting password value from secret") } diff --git a/sensors/triggers/slack/slack.go b/sensors/triggers/slack/slack.go index e9103d4a3a..4acd7817ef 100644 --- a/sensors/triggers/slack/slack.go +++ b/sensors/triggers/slack/slack.go @@ -20,6 +20,7 @@ import ( "encoding/json" "net/http" "strings" + "time" "github.com/pkg/errors" "github.com/slack-go/slack" @@ -114,54 +115,65 @@ func (t *SlackTrigger) Execute(ctx context.Context, events map[string]*v1alpha1. api := slack.New(slackToken, slack.OptionDebug(false)) - params := &slack.GetConversationsParameters{ - Limit: 200, - Types: []string{"public_channel", "private_channel"}, - } - channelID := "" - isPrivateChannel := false + t.Logger.Infow("posting to channel...", zap.Any("channelName", channel)) for { - channels, nextCursor, err := api.GetConversations(params) + channelID, timestamp, err := api.PostMessage(channel, slack.MsgOptionText(message, false)) if err != nil { - t.Logger.Errorw("unable to list channels", zap.Error(err)) - return nil, errors.Wrapf(err, "failed to list channels") - } - for _, c := range channels { - if c.Name == channel { - channelID = c.ID - isPrivateChannel = c.IsPrivate - break + if err.Error() == "not_in_channel" { + isPrivateChannel := false + params := &slack.GetConversationsParameters{ + Limit: 200, + Types: []string{"public_channel", "private_channel"}, + ExcludeArchived: "true", + } + + for { + channels, nextCursor, err := api.GetConversations(params) + if err != nil { + switch e := err.(type) { + case *slack.RateLimitedError: + <-time.After(e.RetryAfter) + continue + default: + t.Logger.Errorw("unable to list channels", zap.Error(err)) + return nil, errors.Wrapf(err, "failed to list channels") + } + } + for _, c := range channels { + if c.Name == channel { + channelID = c.ID + isPrivateChannel = c.IsPrivate + break + } + } + if nextCursor == "" || channelID != "" { + break + } + params.Cursor = nextCursor + } + if channelID == "" { + return nil, errors.Errorf("failed to get channelID of %s", channel) + } + if isPrivateChannel { + return nil, errors.Errorf("cannot join private channel %s", channel) + } + + c, _, _, err := api.JoinConversation(channelID) + if err != nil { + t.Logger.Errorw("unable to join channel...", zap.Any("channelName", channel), zap.Any("channelID", channelID), zap.Error(err)) + return nil, errors.Wrapf(err, "failed to join channel %s", channel) + } + t.Logger.Debugw("successfully joined channel", zap.Any("channel", c)) + continue + } else { + t.Logger.Errorw("unable to post to channel...", zap.Any("channelName", channel), zap.Error(err)) + return nil, errors.Wrapf(err, "failed to post to channel %s", channel) } } - if nextCursor == "" { - break - } - params.Cursor = nextCursor + t.Logger.Infow("message successfully sent to channelID with timestamp", zap.Any("message", message), zap.Any("channelID", channelID), zap.Any("timestamp", timestamp)) + t.Logger.Info("finished executing SlackTrigger") + return nil, nil } - if channelID == "" { - return nil, errors.Errorf("failed to get channelID of %s", channel) - } - // Only join if not joined? Maybe a join API call is easier. - // Not applicable for private channels since bot cannot join private channels - if !isPrivateChannel { - c, _, _, err := api.JoinConversation(channelID) - t.Logger.Debugw("successfully joined channel", zap.Any("channel", c)) - if err != nil { - t.Logger.Errorw("unable to join channel...", zap.Any("channelName", channel), zap.Any("channelID", channelID), zap.Error(err)) - return nil, errors.Wrapf(err, "failed to join channel %s", channel) - } - } - - t.Logger.Infow("posting to channel...", zap.Any("channelName", channel)) - channelID, timestamp, err := api.PostMessage(channel, slack.MsgOptionText(message, false)) - if err != nil { - t.Logger.Errorw("unable to post to channel...", zap.Any("channelName", channel), zap.Error(err)) - return nil, errors.Wrapf(err, "failed to post to channel %s", channel) - } - - t.Logger.Infow("message successfully sent to channelID with timestamp", zap.Any("message", message), zap.Any("channelID", channelID), zap.Any("timestamp", timestamp)) - t.Logger.Info("finished executing SlackTrigger") - return nil, nil } // No Policies for SlackTrigger