Skip to content

Commit bb22bd9

Browse files
committed
Merge conflict fix
2 parents 4e85ec6 + 30bfa32 commit bb22bd9

File tree

6 files changed

+101
-3
lines changed

6 files changed

+101
-3
lines changed

ai.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3261,6 +3261,8 @@ func expandShuffleApps(authHeader string, foundApp WorkflowApp, apps []WorkflowA
32613261
fmt.Sprintf("/apps"),
32623262
user.ActiveOrg.Id,
32633263
true,
3264+
"LOW",
3265+
"ai",
32643266
)
32653267

32663268
if err != nil {

db-connector.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6432,6 +6432,13 @@ func GetEnvironments(ctx context.Context, orgId string) ([]Environment, error) {
64326432
hideEnvs := false
64336433
multiEnvLimit := 0
64346434
if project.Environment == "onprem" {
6435+
if orgId == "" {
6436+
if debug {
6437+
log.Printf("[DEBUG] No orgId provided, skipping multi-env license check")
6438+
}
6439+
return environments, nil
6440+
}
6441+
64356442
currentOrg, err := GetOrg(ctx, orgId)
64366443
if err != nil {
64376444
log.Printf("[WARNING] Failed to get current org %s: %v", orgId, err)
@@ -13530,6 +13537,8 @@ func SetDatastoreKeyBulk(ctx context.Context, allKeys []CacheKeyData) ([]Datasto
1353013537
fmt.Sprintf("/admin?tab=datastore&category=%s", cacheData.Category),
1353113538
cacheData.OrgId,
1353213539
true,
13540+
"MEDIUM",
13541+
"Datastore_Automation_Error",
1353313542
)
1353413543
}
1353513544
}(cacheData, automation)
@@ -13744,6 +13753,8 @@ func SetDatastoreKey(ctx context.Context, cacheData CacheKeyData) error {
1374413753
fmt.Sprintf("/admin?tab=datastore&category=%s", cacheData.Category),
1374513754
cacheData.OrgId,
1374613755
true,
13756+
"MEDIUM",
13757+
"Datastore_Automation_Error",
1374713758
)
1374813759
}
1374913760
}(cacheData, automation)
@@ -15580,6 +15591,8 @@ func ValidateFinished(ctx context.Context, extra int, workflowExecution Workflow
1558015591
fmt.Sprintf("/workflows/%s?execution_id=%s&view=executions", workflowExecution.Workflow.ID, workflowExecution.ExecutionId),
1558115592
workflowExecution.ExecutionOrg,
1558215593
true,
15594+
"MEDIUM",
15595+
"workflow_long_execution",
1558315596
)
1558415597

1558515598
if err != nil {
@@ -17099,7 +17112,7 @@ func InitOpensearchIndexes() {
1709917112
GetESIndexPrefix("notifications"),
1710017113
GetESIndexPrefix("shuffle_logs"),
1710117114
GetESIndexPrefix("environments"),
17102-
GetESIndexPrefix("notifications"),
17115+
GetESIndexPrefix("org_statistics"),
1710317116
}
1710417117

1710517118
customConfig := os.Getenv("OPENSEARCH_INDEX_CONFIG")

notifications.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ func forwardNotificationRequest(ctx context.Context, title, description, referen
624624
return nil
625625
}
626626

627-
func CreateOrgNotification(ctx context.Context, title, description, referenceUrl, orgId string, adminsOnly bool) error {
627+
func CreateOrgNotification(ctx context.Context, title, description, referenceUrl, orgId string, adminsOnly bool, severity string, origin string) error {
628628
if standalone {
629629
return nil
630630
}
@@ -732,6 +732,8 @@ func CreateOrgNotification(ctx context.Context, title, description, referenceUrl
732732
Read: false,
733733
CreatedAt: int64(time.Now().Unix()),
734734
UpdatedAt: int64(time.Now().Unix()),
735+
Severity: severity,
736+
Origin: origin,
735737
}
736738

737739
selectedApikey := ""
@@ -1113,6 +1115,8 @@ func HandleCreateNotification(resp http.ResponseWriter, request *http.Request) {
11131115
notification.ReferenceUrl,
11141116
orgId,
11151117
false,
1118+
notification.Severity,
1119+
notification.Origin,
11161120
)
11171121

11181122
DeleteCache(ctx, fmt.Sprintf("%s_%s", "notifications", user.ActiveOrg.Id))

oauth2.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3926,6 +3926,8 @@ func RunOauth2Request(ctx context.Context, user User, appAuth AppAuthenticationS
39263926
fmt.Sprintf("/admin?admin_tab=notifications"),
39273927
appAuth.OrgId,
39283928
true,
3929+
"HIGH",
3930+
"oauth",
39293931
)
39303932

39313933
if newresp.StatusCode >= 300 {

shared.go

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ import (
6161
"golang.org/x/crypto/bcrypt"
6262

6363
"github.com/Masterminds/semver"
64+
dockerclient "github.com/docker/docker/client"
6465
)
6566

6667
var project ShuffleStorage
@@ -3335,7 +3336,7 @@ func HandleApiAuthentication(resp http.ResponseWriter, request *http.Request) (U
33353336
// Get the user based on APIkey here
33363337
userdata, err := GetApikey(ctx, apikeyCheck[1])
33373338
if err != nil {
3338-
//log.Printf("[WARNING] Apikey %s doesn't exist: %s", apikey, err)
3339+
log.Printf("[WARNING] Apikey %s doesn't exist: %s", apikey, err)
33393340
return User{}, err
33403341
}
33413342

@@ -8052,6 +8053,13 @@ func SaveWorkflow(resp http.ResponseWriter, request *http.Request) {
80528053
return
80538054
}
80548055

8056+
// This fix the region issues with public workflow but can it create problem?
8057+
if len(tmpworkflow.ID) == 0 || workflow.Public == true {
8058+
log.Printf("[WARNING] Failed to find public workflow in region, using user provided workflow data")
8059+
tmp := workflow
8060+
tmpworkflow = &tmp
8061+
}
8062+
80558063
if project.Environment == "cloud" && tmpworkflow.Validated == false {
80568064
if workflow.Validated == true {
80578065

@@ -8892,6 +8900,8 @@ func SaveWorkflow(resp http.ResponseWriter, request *http.Request) {
88928900
fmt.Sprintf("/workflows/%s", workflow.ID),
88938901
user.ActiveOrg.Id,
88948902
true,
8903+
"MEDIUM",
8904+
"git",
88958905
)
88968906

88978907
if err != nil {
@@ -16761,6 +16771,8 @@ func ParsedExecutionResult(ctx context.Context, workflowExecution WorkflowExecut
1676116771
fmt.Sprintf("/workflows/%s?execution_id=%s&view=executions&node=%s", workflowExecution.Workflow.ID, workflowExecution.ExecutionId, actionResult.Action.ID),
1676216772
workflowExecution.ExecutionOrg,
1676316773
true,
16774+
"CRITICAL",
16775+
"workflow_execution",
1676416776
)
1676516777

1676616778
workflowExecution.NotificationsCreated++
@@ -16798,6 +16810,8 @@ func ParsedExecutionResult(ctx context.Context, workflowExecution WorkflowExecut
1679816810
fmt.Sprintf("/workflows/%s?execution_id=%s&view=executions&node=%s", workflowExecution.Workflow.ID, workflowExecution.ExecutionId, actionResult.Action.ID),
1679916811
workflowExecution.ExecutionOrg,
1680016812
true,
16813+
"CRITICAL",
16814+
"liquid_syntax",
1680116815
)
1680216816

1680316817
workflowExecution.NotificationsCreated++
@@ -16840,6 +16854,8 @@ func ParsedExecutionResult(ctx context.Context, workflowExecution WorkflowExecut
1684016854
fmt.Sprintf("/workflows/%s?execution_id=%s&view=executions&node=%s", workflowExecution.Workflow.ID, workflowExecution.ExecutionId, actionResult.Action.ID),
1684116855
workflowExecution.ExecutionOrg,
1684216856
true,
16857+
"CRITICAL",
16858+
"action_failure",
1684316859
)
1684416860

1684516861
workflowExecution.NotificationsCreated++
@@ -17261,6 +17277,8 @@ func ParsedExecutionResult(ctx context.Context, workflowExecution WorkflowExecut
1726117277
fmt.Sprintf("/workflows/%s?execution_id=%s&view=executions&node=%s", workflowExecution.Workflow.ID, workflowExecution.ExecutionId, actionResult.Action.ID),
1726217278
workflowExecution.ExecutionOrg,
1726317279
true,
17280+
"HIGH",
17281+
"workflow_silent_failure",
1726417282
)
1726517283

1726617284
workflowExecution.NotificationsCreated++
@@ -17287,6 +17305,8 @@ func ParsedExecutionResult(ctx context.Context, workflowExecution WorkflowExecut
1728717305
fmt.Sprintf("/workflows/%s?execution_id=%s&node=%s", workflowExecution.Workflow.ID, workflowExecution.ExecutionId, actionResult.Action.ID),
1728817306
workflowExecution.ExecutionOrg,
1728917307
true,
17308+
"CRITICAL",
17309+
"app_error",
1729017310
)
1729117311
}
1729217312
}
@@ -25645,6 +25665,8 @@ func PrepareWorkflowExecution(ctx context.Context, workflow Workflow, request *h
2564525665
fmt.Sprintf("/workflows/%s?execution_id=%s", workflowExecution.Workflow.ID, workflowExecution.ExecutionId),
2564625666
workflowExecution.ExecutionOrg,
2564725667
true,
25668+
"MEDIUM",
25669+
"KMS_DECRYPT_FAILURE",
2564825670
)
2564925671
}
2565025672
}
@@ -25824,6 +25846,8 @@ func GetAuthentication(ctx context.Context, workflowExecution WorkflowExecution,
2582425846
fmt.Sprintf("/workflows/%s?execution_id=%s", workflowExecution.Workflow.ID, workflowExecution.ExecutionId),
2582525847
workflowExecution.ExecutionOrg,
2582625848
true,
25849+
"HIGH",
25850+
"AUTH_ID_MISSING",
2582725851
)
2582825852

2582925853
//return workflowExecution, ExecInfo{}, fmt.Sprintf("App Auth ID %s doesn't exist for app '%s' among %d auth for org ID '%s'. Please re-authenticate the app (1).", action.AuthenticationId, action.AppName, len(allAuths), workflow.ExecutingOrg.Id), errors.New(fmt.Sprintf("App Auth ID %s doesn't exist for app '%s' among %d auth for org ID '%s'. Please re-authenticate the app (2).", action.AuthenticationId, action.AppName, len(allAuths), workflow.ExecutingOrg.Id))
@@ -25976,6 +26000,8 @@ func GetAuthentication(ctx context.Context, workflowExecution WorkflowExecution,
2597626000
fmt.Sprintf("/workflows/%s?execution_id=%s", workflowExecution.Workflow.ID, workflowExecution.ExecutionId),
2597726001
workflowExecution.ExecutionOrg,
2597826002
true,
26003+
"HIGH",
26004+
"OAUTH2_REFRESH_FAILURE",
2597926005
)
2598026006

2598126007
// Abort the workflow due to auth being bad
@@ -26076,6 +26102,8 @@ func GetAuthentication(ctx context.Context, workflowExecution WorkflowExecution,
2607626102
fmt.Sprintf("/workflows/%s?execution_id=%s", workflowExecution.Workflow.ID, workflowExecution.ExecutionId),
2607726103
workflowExecution.ExecutionOrg,
2607826104
true,
26105+
"HIGH",
26106+
"OAUTH2_REFRESH_FAILURE",
2607926107
)
2608026108

2608126109
// Adding so it can be used to fail the auth naturally with Outlook
@@ -33720,3 +33748,49 @@ func getPrioritisedAppActions(ctx context.Context, inputApp string, maxAmount in
3372033748

3372133749
return returnActions
3372233750
}
33751+
33752+
func GetDockerClient() (*dockerclient.Client, string, error) {
33753+
ctx := context.Background()
33754+
dockerApiVersion := os.Getenv("DOCKER_API_VERSION")
33755+
cli, err := dockerclient.NewEnvClient()
33756+
if err != nil {
33757+
return nil, dockerApiVersion,err
33758+
}
33759+
33760+
_, err = cli.Info(ctx)
33761+
if err == nil {
33762+
return cli, dockerApiVersion,nil
33763+
}
33764+
33765+
if strings.Contains(strings.ToLower(err.Error()), strings.ToLower("Minimum supported API version is")) {
33766+
re := regexp.MustCompile(`(?i)minimum supported api version is ([0-9\.]+)`)
33767+
match := re.FindStringSubmatch(err.Error())
33768+
if len(match) == 2 {
33769+
required := match[1]
33770+
os.Setenv("DOCKER_API_VERSION", required)
33771+
cli, err = dockerclient.NewEnvClient()
33772+
if err == nil {
33773+
dockerApiVersion = required
33774+
_, err = cli.Info(ctx)
33775+
return cli, dockerApiVersion, err
33776+
}
33777+
}
33778+
}
33779+
33780+
if strings.Contains(strings.ToLower(err.Error()), strings.ToLower("Maximum supported API version is")) {
33781+
re := regexp.MustCompile(`(?i)maximum supported api version is ([0-9\.]+)`)
33782+
match := re.FindStringSubmatch(err.Error())
33783+
if len(match) == 2 {
33784+
required := match[1]
33785+
os.Setenv("DOCKER_API_VERSION", required)
33786+
cli, err = dockerclient.NewEnvClient()
33787+
if err == nil {
33788+
dockerApiVersion = required
33789+
_, err = cli.Info(ctx)
33790+
return cli, dockerApiVersion, err
33791+
}
33792+
}
33793+
}
33794+
33795+
return cli, dockerApiVersion, err
33796+
}

structs.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,6 +1653,9 @@ type Notification struct {
16531653
ModifiedBy string `json:"modified_by" datastore:"modified_by"`
16541654
Ignored bool `json:"ignored" datastore:"ignored"`
16551655
ExecutionId string `json:"execution_id" datastore:"execution_id"`
1656+
1657+
Severity string `json:"severity" datastore:"severity"`
1658+
Origin string `json:"origin" datastore:"origin"`
16561659
}
16571660

16581661
type NotificationCached struct {

0 commit comments

Comments
 (0)