Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api): load plugins for job template jobs check #7282

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions engine/api/v2_workflow_run_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/ovh/cds/engine/api/authentication"
"github.com/ovh/cds/engine/api/event_v2"
"github.com/ovh/cds/engine/api/group"
"github.com/ovh/cds/engine/api/plugin"
"github.com/ovh/cds/engine/api/project"
"github.com/ovh/cds/engine/api/rbac"
"github.com/ovh/cds/engine/api/region"
Expand Down Expand Up @@ -264,6 +265,14 @@ func (api *API) workflowRunV2Trigger(ctx context.Context, wrEnqueue sdk.V2Workfl
wref.ef.repoCache[vcsServer.Name+"/"+repo.Name] = *repo
wref.ef.vcsServerCache[vcsServer.Name] = *vcsServer

plugins, err := plugin.LoadAllByType(ctx, api.mustDB(), sdk.GRPCPluginAction)
if err != nil {
return err
}
for _, p := range plugins {
wref.ef.plugins[p.Name] = p
}

// Enqueue JOB
hasTemplatedMatrixedJob := false
for _, j := range jobsToQueue {
Expand Down Expand Up @@ -967,6 +976,9 @@ func prepareRunJobs(ctx context.Context, db *gorp.DbMap, store cache.Store, proj
RunNumber: run.RunNumber,
RunAttempt: run.RunAttempt,
}
if jobToTrigger.Status.IsTerminated() {
runJob.Status = jobToTrigger.Status
}
runJobs = append(runJobs, runJob)
continue
}
Expand Down
2 changes: 1 addition & 1 deletion tests/08_v2_workflow_job_template_with_stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ testcases:
stage: stage-[[.params.region]]
runs-on: "{{.worker_model}}"
steps:
- run: echo "Inside test_1"
- uses: actions/checkout
job2_[[.params.region]]:
stage: stage-[[.params.region]]
runs-on: "{{.worker_model}}"
Expand Down