8000 fix(api): load keys on take job (#4386) · ovh/cds@ab78a16 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit ab78a16

Browse files
sguiheuxrichardlt
authored andcommitted
fix(api): load keys on take job (#4386)
1 parent 0461791 commit ab78a16

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

engine/api/workflow/execute_node_job_run.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ func checkStatusWaiting(store cache.Store, jobID int64, status string) error {
324324
}
325325

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

@@ -333,12 +333,18 @@ func LoadNodeJobRunKeys(p *sdk.Project, wr *sdk.WorkflowRun, nodeRun *sdk.Workfl
333333
appMap, has := wr.Workflow.Applications[n.Context.ApplicationID]
334334
if has {
335335
app = &appMap
336+
if err := application.LoadAllBase64Keys(db, app); err != nil {
337+
return nil, nil, err
338+
}
336339
}
337340
}
338341
if n.Context.EnvironmentID != 0 {
339342
envMap, has := wr.Workflow.Environments[n.Context.EnvironmentID]
340343
if has {
341344
env = &envMap
345+
if err := environment.LoadAllBase64Keys(db, env); err != nil {
346+
return nil, nil, err
347+
}
342348
}
343349
}
344350

engine/api/workflow_queue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func takeJob(ctx context.Context, dbFunc func() *gorp.DbMap, store cache.Store,
180180
wnjri.SubNumber = noderun.SubNumber
181181
wnjri.Secrets = secrets
182182

183-
params, secretsKeys, errK := workflow.LoadNodeJobRunKeys(p, workflowRun, noderun)
183+
params, secretsKeys, errK := workflow.LoadNodeJobRunKeys(tx, p, workflowRun, noderun)
184184
if errK != nil {
185185
return nil, sdk.WrapError(errK, "Cannot load keys")
186186
}

ui/src/app/shared/workflow/wizard/input/wizard.input.component.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,11 @@ export class WorkflowWizardNodeInputComponent implements OnInit {
226226

227227
n.context.default_payload = this.editableNode.context.default_payload;
228228
n.context.default_pipeline_parameters = this.editableNode.context.default_pipeline_parameters;
229+
if (n.context.default_pipeline_parameters) {
230+
n.context.default_pipeline_parameters.forEach(p => {
231+
p.value = p.value.toString();
232+
});
233+
}
229234
this.store.dispatch(new UpdateWorkflow({
230235
projectKey: this.workflow.project_key,
231236
workflowName: this.workflow.name,

0 commit comments

Comments
 (0)
0