Skip to content

Commit ca560ae

Browse files
committed
Use a computeresources for the pipeline.
1 parent cbc2848 commit ca560ae

File tree

4 files changed

+33
-21
lines changed

4 files changed

+33
-21
lines changed

deploy/tasks/buildah-oci-ta.yaml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,6 @@ spec:
7272
hours, days, and weeks, respectively.
7373
type: string
7474
default: ""
75-
- name: CACHE_URL
76-
type: string
77-
description: For JBS, URL of the cache.
78-
default: ""
7975
- name: PREFETCH_INPUT
8076
description: In case it is not empty, the prefetched content should
8177
be made available to the build.
@@ -245,8 +241,6 @@ spec:
245241
env:
246242
- name: COMMIT_SHA
247243
value: $(params.COMMIT_SHA)
248-
- name: CACHE_URL
249-
value: $(params.CACHE_URL)
250244
script: |
251245
#!/bin/bash
252246
set -e
@@ -398,11 +392,6 @@ spec:
398392
done < <(find $ADDITIONAL_SECRET_TMP -maxdepth 1 -type f -exec basename {} \;)
399393
fi
400394
401-
# TODO: Rename to JBS_CACHE_URL?
402-
if [ -n "$CACHE_URL" ]; then
403-
BUILDAH_ARGS+=("--build-arg=CACHE_URL=$CACHE_URL")
404-
fi
405-
406395
unshare -Uf $UNSHARE_ARGS --keep-caps -r --map-users 1,1,65536 --map-groups 1,1,65536 -w ${SOURCE_CODE_DIR}/$CONTEXT -- buildah build \
407396
$VOLUME_MOUNTS \
408397
"${BUILDAH_ARGS[@]}" \

pkg/reconciler/dependencybuild/buildrecipeyaml.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const (
2929
PreBuildTaskName = "pre-build"
3030
BuildTaskName = "build"
3131
PostBuildTaskName = "post-build"
32-
TagTaskName = "tag"
32+
DeployTaskName = "deploy"
3333
)
3434

3535
//go:embed scripts/maven-build.sh
@@ -81,7 +81,7 @@ func createDeployPipelineSpec(jbsConfig *v1alpha1.JBSConfig, buildRequestProcess
8181
Params: []tektonpipeline.ParamSpec{{Name: PipelineResultImageDigest, Type: tektonpipeline.ParamTypeString}},
8282
Tasks: []tektonpipeline.PipelineTask{
8383
{
84-
Name: TagTaskName,
84+
Name: DeployTaskName,
8585
TaskRef: &tektonpipeline.TaskRef{
8686
// Can't specify name and resolver as they clash.
8787
ResolverRef: resolver,
@@ -527,13 +527,13 @@ func createPipelineSpec(log logr.Logger, tool string, commitTime int64, jbsConfi
527527
StringVal: tlsVerify,
528528
},
529529
},
530-
//{
531-
// Name: "BUILD_ARGS",
532-
// Value: tektonpipeline.ParamValue{
533-
// Type: tektonpipeline.ParamTypeArray,
534-
// ArrayVal: []string{"CACHE_URL=" + cacheUrl},
535-
// },
536-
//},
530+
{
531+
Name: "BUILD_ARGS",
532+
Value: tektonpipeline.ParamValue{
533+
Type: tektonpipeline.ParamTypeArray,
534+
ArrayVal: []string{"CACHE_URL=" + cacheUrl},
535+
},
536+
},
537537
},
538538

539539
// TODO: ### How to pass build-settings/tls information to buildah task?

pkg/reconciler/dependencybuild/dependencybuild.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,7 @@ 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?
639640
pr.Spec.TaskRunTemplate = tektonpipeline.PipelineTaskRunTemplate{
640641
PodTemplate: &pod.Template{
641642
Env: []v1.EnvVar{
@@ -646,6 +647,17 @@ func (r *ReconcileDependencyBuild) handleStateBuilding(ctx context.Context, db *
646647
},
647648
},
648649
}
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+
}}
649661

650662
if !jbsConfig.Spec.CacheSettings.DisableTLS {
651663
pr.Spec.Workspaces = append(pr.Spec.Workspaces, tektonpipeline.WorkspaceBinding{Name: "tls", ConfigMap: &v1.ConfigMapVolumeSource{LocalObjectReference: v1.LocalObjectReference{Name: v1alpha1.TlsConfigMapName}}})
@@ -1438,6 +1450,7 @@ func (r *ReconcileDependencyBuild) handleStateDeploying(ctx context.Context, db
14381450
pr.Spec.Workspaces = append(pr.Spec.Workspaces, tektonpipeline.WorkspaceBinding{Name: "tls", EmptyDir: &v1.EmptyDirVolumeSource{}})
14391451
}
14401452
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?
14411454
pr.Spec.TaskRunTemplate = tektonpipeline.PipelineTaskRunTemplate{
14421455
PodTemplate: &pod.Template{
14431456
Env: []v1.EnvVar{
@@ -1448,6 +1461,16 @@ func (r *ReconcileDependencyBuild) handleStateDeploying(ctx context.Context, db
14481461
},
14491462
},
14501463
}
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+
}}
14511474

14521475
if err := controllerutil.SetOwnerReference(db, &pr, r.scheme); err != nil {
14531476
return reconcile.Result{}, err

pkg/reconciler/jbsconfig/jbsconfig.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import (
3535

3636
const (
3737
TlsServiceName = v1alpha1.CacheDeploymentName + "-tls"
38-
TestRegistry = "jvmbuildservice.io/test-registry"
38+
TestRegistry = "jvmbuildservice.io/test-registry" // Denote using an insecure registry in GitHub Actions
3939
RetryTimeAnnotations = "jvmbuildservice.io/retry-time"
4040
RetryTimestampAnnotations = "jvmbuildservice.io/retry-timestamp"
4141
)

0 commit comments

Comments
 (0)