Skip to content

Commit

Permalink
fix(api): add new application to ascode workflow (#5152)
Browse files Browse the repository at this point in the history
  • Loading branch information
richardlt authored May 7, 2020
1 parent 366458b commit 8c856e3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
8 changes: 6 additions & 2 deletions engine/api/workflow/execute_node_job_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,11 +442,15 @@ func LoadSecrets(db gorp.SqlExecutor, store cache.Store, nodeRun *sdk.WorkflowNo
// Application variables
av := []sdk.Variable{}
if app != nil {
// FIXME manage secret ascode
// try to retreive application from database, application can be not found for ascode run
tempApp, err := application.LoadByIDWithClearVCSStrategyPassword(db, app.ID)
if err != nil {
if err != nil && !sdk.ErrorIs(err, sdk.ErrNotFound) {
return nil, err
}
app.RepositoryStrategy = tempApp.RepositoryStrategy
if tempApp != nil {
app.RepositoryStrategy.Password = tempApp.RepositoryStrategy.Password
}

appVariables, err := application.LoadAllVariablesWithDecrytion(db, app.ID)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions sdk/hatchery/starter.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,6 @@ func spawnWorkerForJob(ctx context.Context, h Interface, j workerStarterRequest)
})
next()

log.Info(ctx, "hatchery> spawnWorkerForJob> SpawnWorker> starting model %s for job %d", modelName, j.id)

_, next = observability.Span(ctxJob, "hatchery.SpawnWorker")
arg := SpawnArguments{
WorkerName: generateWorkerName(h.Service().Name, false, modelName),
Expand All @@ -178,6 +176,8 @@ func spawnWorkerForJob(ctx context.Context, h Interface, j workerStarterRequest)
HatcheryName: h.Service().Name,
}

log.Info(ctx, "hatchery> spawnWorkerForJob> SpawnWorker> starting model %s for job %d with name %s", modelName, arg.JobID, arg.WorkerName)

// Get a JWT to authentified the worker
jwt, err := NewWorkerToken(h.Service().Name, h.GetPrivateKey(), time.Now().Add(1*time.Hour), arg)
if err != nil {
Expand Down
13 changes: 8 additions & 5 deletions ui/src/app/shared/workflow/node/run/node.run.param.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ declare var CodeMirror: any;
changeDetection: ChangeDetectionStrategy.OnPush
})
@AutoUnsubscribe()

export class WorkflowNodeRunParamComponent implements AfterViewInit {
@ViewChild('runWithParamModal')
runWithParamModal: ModalTemplate<boolean, boolean, void>;
Expand Down Expand Up @@ -104,7 +103,7 @@ export class WorkflowNodeRunParamComponent implements AfterViewInit {
this.currentNodeRun = this._store.selectSnapshot(WorkflowState.nodeRunSnapshot);
this.currentWorkflowRun = this._store.selectSnapshot(WorkflowState.workflowRunSnapshot);
this.workflow = this._store.selectSnapshot(WorkflowState.workflowSnapshot);
this.projectKey = this._store.selectSnapshot(ProjectState.projectSnapshot).key;
this.projectKey = this._store.selectSnapshot(ProjectState.projectSnapshot).key;

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

this.linkedToRepo = WNode.linkedToRepo(this.nodeToRun, this.workflow);
if (this.currentWorkflowRun && this.currentWorkflowRun.workflow) {
this.linkedToRepo = WNode.linkedToRepo(this.nodeToRun, this.currentWorkflowRun.workflow);
} else {
this.linkedToRepo = WNode.linkedToRepo(this.nodeToRun, this.workflow);
}

let num: number;
let nodeRunID: number;
Expand Down Expand Up @@ -221,7 +224,7 @@ export class WorkflowNodeRunParamComponent implements AfterViewInit {
.pipe(first(), finalize(() => this._cd.markForCheck()))
.subscribe(n => {
this.lastNum = n.num + 1;
this.getCommits( n.num + 1, false);
this.getCommits(n.num + 1, false);
});
} else {
this.getCommits(this.num, false);
Expand Down Expand Up @@ -433,7 +436,7 @@ export class WorkflowNodeRunParamComponent implements AfterViewInit {
this.refreshVCSInfos(this.payloadRemote);
}

this.getCommits( num || this.lastNum, true);
this.getCommits(num || this.lastNum, true);
});
}
}
Expand Down

0 comments on commit 8c856e3

Please sign in to comment.