Skip to content

Commit

Permalink
Fixed issue with executed_by label in subscriber and updated upgrade …
Browse files Browse the repository at this point in the history
…agent (#3734)

* Fixed executed_by issue in subscriber

Signed-off-by: Amit Kumar Das <[email protected]>

* Updated upgrade agent

Signed-off-by: Amit Kumar Das <[email protected]>

Signed-off-by: Amit Kumar Das <[email protected]>
  • Loading branch information
amityt authored Aug 12, 2022
1 parent 99b7f19 commit 5c2a3b2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
11 changes: 11 additions & 0 deletions litmus-portal/cluster-agents/subscriber/pkg/events/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package events

import (
"context"
"encoding/base64"
"errors"
"regexp"
"strconv"
Expand Down Expand Up @@ -156,6 +157,8 @@ func GenerateWorkflowPayload(cid, accessKey, version, completed string, wfEvent
wfEvent.Nodes[id] = event
}

wfEvent.ExecutedBy = URLDecodeBase64(wfEvent.ExecutedBy)

processed, err := graphql.MarshalGQLData(wfEvent)
if err != nil {
return nil, err
Expand All @@ -164,3 +167,11 @@ func GenerateWorkflowPayload(cid, accessKey, version, completed string, wfEvent
var payload = []byte(`{"query":"mutation { chaosWorkflowRun(request:` + mutation + ` )}"}`)
return payload, nil
}

func URLDecodeBase64(encoded string) string {
decoded, err := base64.RawURLEncoding.DecodeString(encoded)
if err != nil {
return encoded
}
return string(decoded)
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import (
dbOperationsWorkflowTemplate "github.com/litmuschaos/litmus/litmus-portal/graphql-server/pkg/database/mongodb/workflowtemplate"
dbSchemaWorkflowTemplate "github.com/litmuschaos/litmus/litmus-portal/graphql-server/pkg/database/mongodb/workflowtemplate"
gitOpsHandler "github.com/litmuschaos/litmus/litmus-portal/graphql-server/pkg/gitops/handler"
"github.com/litmuschaos/litmus/litmus-portal/graphql-server/utils"
)

func CreateChaosWorkflow(ctx context.Context, request *model.ChaosWorkFlowRequest, r *store.StateData) (*model.ChaosWorkFlowResponse, error) {
Expand Down Expand Up @@ -483,7 +482,7 @@ func ListWorkflowRuns(request model.ListWorkflowRunsRequest) (*model.ListWorkflo
ClusterName: workflow.ClusterName,
ClusterType: &workflow.ClusterType,
IsRemoved: workflowRun.IsRemoved,
ExecutedBy: utils.URLDecodeBase64(workflowRun.ExecutedBy),
ExecutedBy: workflowRun.ExecutedBy,
}
result = append(result, &newWorkflowRun)
}
Expand Down Expand Up @@ -739,7 +738,7 @@ func ChaosWorkflowRun(request model.WorkflowRunRequest, r store.StateData) (stri
ExecutionData: request.ExecutionData,
Completed: request.Completed,
IsRemoved: &isRemoved,
ExecutedBy: utils.URLDecodeBase64(request.ExecutedBy),
ExecutedBy: request.ExecutedBy,
})

if err != nil {
Expand Down Expand Up @@ -769,7 +768,7 @@ func ChaosWorkflowRun(request model.WorkflowRunRequest, r store.StateData) (stri
ExecutionData: request.ExecutionData,
WorkflowID: request.WorkflowID,
IsRemoved: &isRemoved,
ExecutedBy: utils.URLDecodeBase64(request.ExecutedBy),
ExecutedBy: request.ExecutedBy,
}, &r)

return "Workflow Run Accepted", nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,13 @@ func (m *UpgradeManager) getUpgradePath() map[string]UpgradeExecutor {
VersionManager: nil,
},

// latest version, no more upgrades available
"2.11.0": {
NextVersion: "2.12.0",
VersionManager: nil,
},

// latest version, no more upgrades available
"2.12.0": {
NextVersion: "",
VersionManager: nil,
},
Expand Down

0 comments on commit 5c2a3b2

Please sign in to comment.