Skip to content

Commit 8c856e3

Browse files
authored
fix(api): add new application to ascode workflow (#5152)
1 parent 366458b commit 8c856e3

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

engine/api/workflow/execute_node_job_run.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -442,11 +442,15 @@ func LoadSecrets(db gorp.SqlExecutor, store cache.Store, nodeRun *sdk.WorkflowNo
442442
// Application variables
443443
av := []sdk.Variable{}
444444
if app != nil {
445+
// FIXME manage secret ascode
446+
// try to retreive application from database, application can be not found for ascode run
445447
tempApp, err := application.LoadByIDWithClearVCSStrategyPassword(db, app.ID)
446-
if err != nil {
448+
if err != nil && !sdk.ErrorIs(err, sdk.ErrNotFound) {
447449
return nil, err
448450
}
449-
app.RepositoryStrategy = tempApp.RepositoryStrategy
451+
if tempApp != nil {
452+
app.RepositoryStrategy.Password = tempApp.RepositoryStrategy.Password
453+
}
450454

451455
appVariables, err := application.LoadAllVariablesWithDecrytion(db, app.ID)
452456
if err != nil {

sdk/hatchery/starter.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,6 @@ func spawnWorkerForJob(ctx context.Context, h Interface, j workerStarterRequest)
167167
})
168168
next()
169169

170-
log.Info(ctx, "hatchery> spawnWorkerForJob> SpawnWorker> starting model %s for job %d", modelName, j.id)
171-
172170
_, next = observability.Span(ctxJob, "hatchery.SpawnWorker")
173171
arg := SpawnArguments{
174172
WorkerName: generateWorkerName(h.Service().Name, false, modelName),
@@ -178,6 +176,8 @@ func spawnWorkerForJob(ctx context.Context, h Interface, j workerStarterRequest)
178176
HatcheryName: h.Service().Name,
179177
}
180178

179+
log.Info(ctx, "hatchery> spawnWorkerForJob> SpawnWorker> starting model %s for job %d with name %s", modelName, arg.JobID, arg.WorkerName)
180+
181181
// Get a JWT to authentified the worker
182182
jwt, err := NewWorkerToken(h.Service().Name, h.GetPrivateKey(), time.Now().Add(1*time.Hour), arg)
183183
if err != nil {

ui/src/app/shared/workflow/node/run/node.run.param.component.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ declare var CodeMirror: any;
2626
changeDetection: ChangeDetectionStrategy.OnPush
2727
})
2828
@AutoUnsubscribe()
29-
3029
export class WorkflowNodeRunParamComponent implements AfterViewInit {
3130
@ViewChild('runWithParamModal')
3231
runWithParamModal: ModalTemplate<boolean, boolean, void>;
@@ -104,7 +103,7 @@ export class WorkflowNodeRunParamComponent implements AfterViewInit {
104103
this.currentNodeRun = this._store.selectSnapshot(WorkflowState.nodeRunSnapshot);
105104
this.currentWorkflowRun = this._store.selectSnapshot(WorkflowState.workflowRunSnapshot);
106105
this.workflow = this._store.selectSnapshot(WorkflowState.workflowSnapshot);
107-
this.projectKey = this._store.selectSnapshot(ProjectState.projectSnapshot).key;
106+
this.projectKey = this._store.selectSnapshot(ProjectState.projectSnapshot).key;
108107

109108
if (this.currentNodeRun && this.currentNodeRun.workflow_node_id !== this.nodeToRun.id) {
110109
delete this.currentNodeRun;
@@ -124,7 +123,11 @@ export class WorkflowNodeRunParamComponent implements AfterViewInit {
124123
}
125124
}
126125

127-
this.linkedToRepo = WNode.linkedToRepo(this.nodeToRun, this.workflow);
126+
if (this.currentWorkflowRun && this.currentWorkflowRun.workflow) {
127+
this.linkedToRepo = WNode.linkedToRepo(this.nodeToRun, this.currentWorkflowRun.workflow);
128+
} else {
129+
this.linkedToRepo = WNode.linkedToRepo(this.nodeToRun, this.workflow);
130+
}
128131

129132
let num: number;
130133
let nodeRunID: number;
@@ -221,7 +224,7 @@ export class WorkflowNodeRunParamComponent implements AfterViewInit {
221224
.pipe(first(), finalize(() => this._cd.markForCheck()))
222225
.subscribe(n => {
223226
this.lastNum = n.num + 1;
224-
this.getCommits( n.num + 1, false);
227+
this.getCommits(n.num + 1, false);
225228
});
226229
} else {
227230
this.getCommits(this.num, false);
@@ -433,7 +436,7 @@ export class WorkflowNodeRunParamComponent implements AfterViewInit {
433436
this.refreshVCSInfos(this.payloadRemote);
434437
}
435438

436-
this.getCommits( num || this.lastNum, true);
439+
this.getCommits(num || this.lastNum, true);
437440
});
438441
}
439442
}

0 commit comments

Comments
 (0)