Skip to content

Commit

Permalink
fix(api): load keys on take job (#4386)
Browse files Browse the repository at this point in the history
  • Loading branch information
sguiheux authored and richardlt committed Jun 18, 2019
1 parent 0461791 commit ab78a16
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
8 changes: 7 additions & 1 deletion engine/api/workflow/execute_node_job_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ func checkStatusWaiting(store cache.Store, jobID int64, status string) error {
}

// LoadNodeJobRunKeys loads all keys for a job run
func LoadNodeJobRunKeys(p *sdk.Project, wr *sdk.WorkflowRun, nodeRun *sdk.WorkflowNodeRun) ([]sdk.Parameter, []sdk.Variable, error) {
func LoadNodeJobRunKeys(db gorp.SqlExecutor, p *sdk.Project, wr *sdk.WorkflowRun, nodeRun *sdk.WorkflowNodeRun) ([]sdk.Parameter, []sdk.Variable, error) {
var app *sdk.Application
var env *sdk.Environment

Expand All @@ -333,12 +333,18 @@ func LoadNodeJobRunKeys(p *sdk.Project, wr *sdk.WorkflowRun, nodeRun *sdk.Workfl
appMap, has := wr.Workflow.Applications[n.Context.ApplicationID]
if has {
app = &appMap
if err := application.LoadAllBase64Keys(db, app); err != nil {
return nil, nil, err
}
}
}
if n.Context.EnvironmentID != 0 {
envMap, has := wr.Workflow.Environments[n.Context.EnvironmentID]
if has {
env = &envMap
if err := environment.LoadAllBase64Keys(db, env); err != nil {
return nil, nil, err
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion engine/api/workflow_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func takeJob(ctx context.Context, dbFunc func() *gorp.DbMap, store cache.Store,
wnjri.SubNumber = noderun.SubNumber
wnjri.Secrets = secrets

params, secretsKeys, errK := workflow.LoadNodeJobRunKeys(p, workflowRun, noderun)
params, secretsKeys, errK := workflow.LoadNodeJobRunKeys(tx, p, workflowRun, noderun)
if errK != nil {
return nil, sdk.WrapError(errK, "Cannot load keys")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ export class WorkflowWizardNodeInputComponent implements OnInit {

n.context.default_payload = this.editableNode.context.default_payload;
n.context.default_pipeline_parameters = this.editableNode.context.default_pipeline_parameters;
if (n.context.default_pipeline_parameters) {
n.context.default_pipeline_parameters.forEach(p => {
p.value = p.value.toString();
});
}
this.store.dispatch(new UpdateWorkflow({
projectKey: this.workflow.project_key,
workflowName: this.workflow.name,
Expand Down

0 comments on commit ab78a16

Please sign in to comment.