@@ -597,9 +597,9 @@ func (r *ReconcileDependencyBuild) handleStateBuilding(ctx context.Context, db *
597597 {Name : PipelineParamJavaVersion , Value : tektonpipeline.ResultValue {Type : tektonpipeline .ParamTypeString , StringVal : attempt .Recipe .JavaVersion }},
598598 }
599599
600- orasOptions := ""
600+ insecure := false
601601 if jbsConfig .Annotations != nil && jbsConfig .Annotations [jbsconfig .TestRegistry ] == "true" {
602- orasOptions = "--insecure --plain-http"
602+ insecure = true
603603 }
604604 systemConfig := v1alpha1.SystemConfig {}
605605 err = r .client .Get (ctx , types.NamespacedName {Name : systemconfig .SystemConfigKey }, & systemConfig )
@@ -616,7 +616,7 @@ func (r *ReconcileDependencyBuild) handleStateBuilding(ctx context.Context, db *
616616 Pipeline : & v12.Duration {Duration : time .Hour * v1alpha1 .DefaultTimeout },
617617 Tasks : & v12.Duration {Duration : time .Hour * v1alpha1 .DefaultTimeout },
618618 }
619- pr .Spec .PipelineSpec , diagnosticContainerfile , err = createPipelineSpec (log , attempt .Recipe .Tool , db .Status .CommitTime , jbsConfig , & systemConfig , attempt .Recipe , db , paramValues , buildRequestProcessorImage , attempt .BuildId , preBuildImages , orasOptions )
619+ pr .Spec .PipelineSpec , diagnosticContainerfile , err = createPipelineSpec (log , attempt .Recipe .Tool , db .Status .CommitTime , jbsConfig , & systemConfig , attempt .Recipe , db , paramValues , buildRequestProcessorImage , attempt .BuildId , preBuildImages , insecure )
620620 if err != nil {
621621 return reconcile.Result {}, err
622622 }
@@ -636,29 +636,30 @@ func (r *ReconcileDependencyBuild) handleStateBuilding(ctx context.Context, db *
636636 },
637637 }},
638638 }
639- // TODO: ### Enclose this within an annotation to denote test CI system in use?
640- pr .Spec .TaskRunTemplate = tektonpipeline.PipelineTaskRunTemplate {
641- PodTemplate : & pod.Template {
642- Env : []v1.EnvVar {
643- {
644- Name : "ORAS_OPTIONS" ,
645- Value : orasOptions ,
639+ if insecure {
640+ pr .Spec .TaskRunTemplate = tektonpipeline.PipelineTaskRunTemplate {
641+ PodTemplate : & pod.Template {
642+ Env : []v1.EnvVar {
643+ {
644+ Name : "ORAS_OPTIONS" ,
645+ Value : "--insecure --plain-http" ,
646+ },
646647 },
647648 },
648- },
649+ }
650+ }
651+ if jbsConfig .Annotations != nil && jbsConfig .Annotations [jbsconfig .CITests ] == "true" {
652+ podMemR , _ := resource .ParseQuantity ("1792Mi" )
653+ podMemL , _ := resource .ParseQuantity ("3584Mi" )
654+ podCPU , _ := resource .ParseQuantity ("500m" )
655+ pr .Spec .TaskRunSpecs = []tektonpipeline.PipelineTaskRunSpec {{
656+ PipelineTaskName : BuildTaskName ,
657+ ComputeResources : & v1.ResourceRequirements {
658+ Requests : v1.ResourceList {"memory" : podMemR , "cpu" : podCPU },
659+ Limits : v1.ResourceList {"memory" : podMemL , "cpu" : podCPU },
660+ },
661+ }}
649662 }
650- // TODO: ### Enclose this within an annotation to denote test CI system in use?
651- podMemR , _ := resource .ParseQuantity ("1792Mi" )
652- podMemL , _ := resource .ParseQuantity ("3584Mi" )
653- podCPU , _ := resource .ParseQuantity ("500m" )
654- pr .Spec .TaskRunSpecs = []tektonpipeline.PipelineTaskRunSpec {{
655- PipelineTaskName : BuildTaskName ,
656- ComputeResources : & v1.ResourceRequirements {
657- Requests : v1.ResourceList {"memory" : podMemR , "cpu" : podCPU },
658- Limits : v1.ResourceList {"memory" : podMemL , "cpu" : podCPU },
659- },
660- }}
661-
662663 if ! jbsConfig .Spec .CacheSettings .DisableTLS {
663664 pr .Spec .Workspaces = append (pr .Spec .Workspaces , tektonpipeline.WorkspaceBinding {Name : "tls" , ConfigMap : & v1.ConfigMapVolumeSource {LocalObjectReference : v1.LocalObjectReference {Name : v1alpha1 .TlsConfigMapName }}})
664665 } else {
@@ -1422,10 +1423,6 @@ func (r *ReconcileDependencyBuild) handleStateDeploying(ctx context.Context, db
14221423 {Name : PipelineResultPreBuildImageDigest , Value : tektonpipeline.ResultValue {Type : tektonpipeline .ParamTypeString , StringVal : db .Status .PreBuildImages [len (db .Status .PreBuildImages )- 1 ].BuiltImageDigest }},
14231424 }
14241425
1425- orasOptions := ""
1426- if jbsConfig .Annotations != nil && jbsConfig .Annotations [jbsconfig .TestRegistry ] == "true" {
1427- orasOptions = "--insecure --plain-http"
1428- }
14291426 systemConfig := v1alpha1.SystemConfig {}
14301427 err = r .client .Get (ctx , types.NamespacedName {Name : systemconfig .SystemConfigKey }, & systemConfig )
14311428 if err != nil {
@@ -1450,28 +1447,29 @@ func (r *ReconcileDependencyBuild) handleStateDeploying(ctx context.Context, db
14501447 pr .Spec .Workspaces = append (pr .Spec .Workspaces , tektonpipeline.WorkspaceBinding {Name : "tls" , EmptyDir : & v1.EmptyDirVolumeSource {}})
14511448 }
14521449 pr .Spec .Timeouts = & tektonpipeline.TimeoutFields {Pipeline : & v12.Duration {Duration : time .Hour * v1alpha1 .DefaultTimeout }}
1453- // TODO: ### Enclose this within an annotation to denote test CI system in use? Could inline orasOptions then as well?
1454- pr .Spec .TaskRunTemplate = tektonpipeline.PipelineTaskRunTemplate {
1455- PodTemplate : & pod.Template {
1456- Env : []v1.EnvVar {
1457- {
1458- Name : "ORAS_OPTIONS" ,
1459- Value : orasOptions ,
1450+ if jbsConfig .Annotations != nil && jbsConfig .Annotations [jbsconfig .TestRegistry ] == "true" {
1451+ pr .Spec .TaskRunTemplate = tektonpipeline.PipelineTaskRunTemplate {
1452+ PodTemplate : & pod.Template {
1453+ Env : []v1.EnvVar {
1454+ {
1455+ Name : "ORAS_OPTIONS" ,
1456+ Value : "--insecure --plain-http" ,
1457+ },
14601458 },
14611459 },
1462- },
1460+ }
1461+ }
1462+ if jbsConfig .Annotations != nil && jbsConfig .Annotations [jbsconfig .CITests ] == "true" {
1463+ podMem , _ := resource .ParseQuantity ("1024Mi" )
1464+ podCPU , _ := resource .ParseQuantity ("250m" )
1465+ pr .Spec .TaskRunSpecs = []tektonpipeline.PipelineTaskRunSpec {{
1466+ PipelineTaskName : DeployTaskName ,
1467+ ComputeResources : & v1.ResourceRequirements {
1468+ Requests : v1.ResourceList {"memory" : podMem , "cpu" : podCPU },
1469+ Limits : v1.ResourceList {"memory" : podMem , "cpu" : podCPU },
1470+ },
1471+ }}
14631472 }
1464- // TODO: ### Enclose this within an annotation to denote test CI system in use?
1465- podMem , _ := resource .ParseQuantity ("1024Mi" )
1466- podCPU , _ := resource .ParseQuantity ("250m" )
1467- pr .Spec .TaskRunSpecs = []tektonpipeline.PipelineTaskRunSpec {{
1468- PipelineTaskName : DeployTaskName ,
1469- ComputeResources : & v1.ResourceRequirements {
1470- Requests : v1.ResourceList {"memory" : podMem , "cpu" : podCPU },
1471- Limits : v1.ResourceList {"memory" : podMem , "cpu" : podCPU },
1472- },
1473- }}
1474-
14751473 if err := controllerutil .SetOwnerReference (db , & pr , r .scheme ); err != nil {
14761474 return reconcile.Result {}, err
14771475 }
0 commit comments