Skip to content

Commit bfe79cc

Browse files
committed
update variables
1 parent 723aabd commit bfe79cc

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

backend/src/apiserver/template/v2_template.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ func (t *V2Spec) ScheduledWorkflow(modelJob *model.Job) (*scheduledworkflow.Sche
7777
}
7878
}
7979

80-
var pipeline_options argocompiler.Options
80+
var PipelineOptions argocompiler.Options
8181
for _, platform := range t.platformSpec.Platforms {
8282
if platform.PipelineConfig.PipelineTtl != 0 {
83-
pipeline_options = argocompiler.Options{
83+
PipelineOptions = argocompiler.Options{
8484
TtlSeconds: platform.PipelineConfig.PipelineTtl,
8585
}
8686
break
@@ -89,7 +89,7 @@ func (t *V2Spec) ScheduledWorkflow(modelJob *model.Job) (*scheduledworkflow.Sche
8989

9090
var obj interface{}
9191
if util.CurrentExecutionType() == util.ArgoWorkflow {
92-
obj, err = argocompiler.Compile(job, kubernetesSpec, &pipeline_options)
92+
obj, err = argocompiler.Compile(job, kubernetesSpec, &PipelineOptions)
9393
} else if util.CurrentExecutionType() == util.TektonPipelineRun {
9494
obj, err = tektoncompiler.Compile(job, kubernetesSpec, &tektoncompiler.Options{LauncherImage: Launcher})
9595
}
@@ -310,19 +310,21 @@ func (t *V2Spec) RunWorkflow(modelRun *model.Run, options RunWorkflowOptions) (u
310310
}
311311
}
312312

313-
var pipeline_options *argocompiler.Options
314-
for _, platform := range t.platformSpec.Platforms {
315-
if platform.PipelineConfig.PipelineTtl != 0 {
316-
pipeline_options = &argocompiler.Options{
317-
TtlSeconds: platform.PipelineConfig.PipelineTtl,
313+
var PipelineOptions *argocompiler.Options
314+
if t.platformSpec != nil && t.platformSpec.Platforms != nil {
315+
for _, platform := range t.platformSpec.Platforms {
316+
if platform.PipelineConfig.PipelineTtl != 0 {
317+
PipelineOptions = &argocompiler.Options{
318+
TtlSeconds: platform.PipelineConfig.PipelineTtl,
319+
}
320+
break
318321
}
319-
break
320322
}
321323
}
322324

323325
var obj interface{}
324326
if util.CurrentExecutionType() == util.ArgoWorkflow {
325-
obj, err = argocompiler.Compile(job, kubernetesSpec, pipeline_options)
327+
obj, err = argocompiler.Compile(job, kubernetesSpec, PipelineOptions)
326328
} else if util.CurrentExecutionType() == util.TektonPipelineRun {
327329
obj, err = tektoncompiler.Compile(job, kubernetesSpec, nil)
328330
}

backend/src/v2/compiler/argocompiler/argo.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ type Options struct {
4444
}
4545

4646
const (
47-
pipeline_default_ttlSeconds = int32(30)
47+
pipelineDefaultTtlSeconds = int32(30)
4848
)
4949

5050
func Compile(jobArg *pipelinespec.PipelineJob, kubernetesSpecArg *pipelinespec.SinglePlatformSpec, opts *Options) (*wfapi.Workflow, error) {
@@ -91,9 +91,9 @@ func Compile(jobArg *pipelinespec.PipelineJob, kubernetesSpecArg *pipelinespec.S
9191
}
9292
}
9393

94-
pipeline_ttlseconds := pipeline_default_ttlSeconds
94+
pipelineTtlSeconds := pipelineDefaultTtlSeconds
9595
if &opts.TtlSeconds != nil {
96-
pipeline_ttlseconds = opts.TtlSeconds
96+
pipelineTtlSeconds = opts.TtlSeconds
9797
}
9898

9999
// initialization
@@ -128,7 +128,7 @@ func Compile(jobArg *pipelinespec.PipelineJob, kubernetesSpecArg *pipelinespec.S
128128
ServiceAccountName: "pipeline-runner",
129129
Entrypoint: tmplEntrypoint,
130130
TTLStrategy: &wfapi.TTLStrategy{
131-
SecondsAfterCompletion: &pipeline_ttlseconds,
131+
SecondsAfterCompletion: &pipelineTtlSeconds,
132132
},
133133
},
134134
}

0 commit comments

Comments
 (0)