Skip to content

Commit 2885cee

Browse files
Merge pull request #90 from codefresh-io/CR-proces-non-root-app
process non root app
2 parents 2b915fe + 8d0cedc commit 2885cee

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.1.14-cap-CR-11708-send-app-deletion
1+
2.1.15-cap-CR-process-non-root-app

server/application/application.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"errors"
66
"fmt"
77
"math"
8+
"os"
89
"reflect"
910
"sort"
1011
"strconv"
@@ -828,6 +829,15 @@ func (s *Server) Watch(q *application.ApplicationQuery, ws application.Applicati
828829
}
829830
}
830831

832+
func shouldProcessNonRootApp() bool {
833+
value := os.Getenv("PROCESS_NON_ROOT_APP")
834+
result, err := strconv.ParseBool(value)
835+
if err != nil {
836+
return false
837+
}
838+
return result
839+
}
840+
831841
func (s *Server) StartEventSource(es *events.EventSource, stream events.Eventing_StartEventSourceServer) error {
832842
var (
833843
logCtx log.FieldLogger = log.StandardLogger()
@@ -875,7 +885,7 @@ func (s *Server) StartEventSource(es *events.EventSource, stream events.Eventing
875885
return
876886
}
877887

878-
err := s.streamApplicationEvents(stream.Context(), &a, es, stream, ts)
888+
err := s.streamApplicationEvents(stream.Context(), &a, es, stream, ts, shouldProcessNonRootApp())
879889
if err != nil {
880890
logCtx.WithError(err).Error("failed to stream application events")
881891
return
@@ -972,6 +982,7 @@ func (s *Server) streamApplicationEvents(
972982
es *events.EventSource,
973983
stream events.Eventing_StartEventSourceServer,
974984
ts string,
985+
processRootApp bool,
975986
) error {
976987
var (
977988
logCtx = log.WithField("application", a.Name)
@@ -985,7 +996,7 @@ func (s *Server) streamApplicationEvents(
985996
isChildApp = a.Labels["app.kubernetes.io/instance"] != ""
986997
}
987998

988-
if !isChildApp {
999+
if !isChildApp || processRootApp {
9891000
// application events for child apps would be sent by its parent app
9901001
// as resource event
9911002
appEvent, err := s.getApplicationEventPayload(ctx, a, es, ts)

0 commit comments

Comments
 (0)