Skip to content

Commit 2996bbe

Browse files
committed
Remove workspace from prebuildgit
1 parent bfc2f8b commit 2996bbe

File tree

3 files changed

+45
-5
lines changed

3 files changed

+45
-5
lines changed

deploy/tasks/pre-build-git.yaml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ spec:
1313
description: |-
1414
Sets up pre-build for pushing the source.
1515
params:
16+
- name: IMAGE_URL
17+
description: Reference to the OCI archive
18+
type: string
19+
- name: PRE_BUILD_IMAGE_DIGEST
20+
description: Digest to use
21+
type: string
1622
- name: NAME
1723
description: Name of the pipeline run (i.e. unique dependency build name)
1824
type: string
@@ -46,11 +52,28 @@ spec:
4652
results:
4753
- name: GIT_ARCHIVE
4854
description: Git archive information
49-
workspaces:
50-
- description: The git repo will be cloned onto the volume backing this Workspace.
51-
name: source
52-
mountPath: /var/workdir
55+
volumes:
56+
- name: workdir
57+
emptyDir: {}
58+
stepTemplate:
59+
volumeMounts:
60+
- mountPath: /var/workdir
61+
name: workdir
5362
steps:
63+
- name: restore-trusted-artifact
64+
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:52f1391e6f1c472fd10bb838f64fae2ed3320c636f536014978a5ddbdfc6b3af
65+
script: |
66+
echo "Restoring artifacts to workspace"
67+
URL=$IMAGE_URL
68+
DIGEST=$PRE_BUILD_IMAGE_DIGEST
69+
AARCHIVE=$(oras manifest fetch $ORAS_OPTIONS $URL@$DIGEST | jq --raw-output '.layers[0].digest')
70+
echo "URL $URL DIGEST $DIGEST AARCHIVE $AARCHIVE"
71+
use-archive oci:$URL@$AARCHIVE=/var/workdir/
72+
env:
73+
- name: IMAGE_DIGEST
74+
value: $(params.IMAGE_DIGEST)
75+
- name: IMAGE_URL
76+
value: $(params.IMAGE_URL)
5477
- name: create-pre-build-source
5578
image: $(params.JVM_BUILD_SERVICE_REQPROCESSOR_IMAGE)
5679
securityContext:

pkg/reconciler/dependencybuild/buildrecipeyaml.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ func createPipelineSpec(log logr.Logger, tool string, commitTime int64, jbsConfi
273273
preBuildImageRequired := preBuildImage == ""
274274
if preBuildImageRequired {
275275
preBuildImage = "$(tasks." + PreBuildTaskName + ".results." + PipelineResultPreBuildImageDigest + ")"
276+
//runAfter = []string{PreBuildTaskName}
276277
runAfter = []string{PreBuildGitTaskName}
277278
}
278279
runAfterBuild = append(runAfter, BuildTaskName)
@@ -452,6 +453,20 @@ func createPipelineSpec(log logr.Logger, tool string, commitTime int64, jbsConfi
452453
StringVal: imageId,
453454
},
454455
},
456+
{
457+
Name: "IMAGE_URL",
458+
Value: tektonpipeline.ParamValue{
459+
Type: tektonpipeline.ParamTypeString,
460+
StringVal: registryArgsWithDefaults(jbsConfig, imageId+"-pre-build-image"),
461+
},
462+
},
463+
{
464+
Name: "PRE_BUILD_IMAGE_DIGEST",
465+
Value: tektonpipeline.ParamValue{
466+
Type: tektonpipeline.ParamTypeString,
467+
StringVal: "$(tasks." + PreBuildTaskName + ".results." + PipelineResultPreBuildImageDigest + ")",
468+
},
469+
},
455470
{
456471
Name: "GIT_IDENTITY",
457472
Value: tektonpipeline.ParamValue{
@@ -503,6 +518,7 @@ func createPipelineSpec(log logr.Logger, tool string, commitTime int64, jbsConfi
503518
},
504519
},
505520
}}
521+
fmt.Printf("### prebuildgit %#v \n", pipelinePreBuildGitTask)
506522
ps.Tasks = append(pipelineGitTask, ps.Tasks...)
507523
ps.Tasks = append(pipelinePreBuildTask, ps.Tasks...)
508524
ps.Tasks = append(pipelinePreBuildGitTask, ps.Tasks...)
@@ -801,6 +817,7 @@ use-archive oci:$URL@$AARCHIVE=%s`, orasOptions, registryArgsWithDefaults(jbsCon
801817
ps.Tasks[index].Params = append(ps.Tasks[index].Params, tektonpipeline.Param{
802818
Name: i.Name,
803819
Value: value})
820+
fmt.Printf("### index %s and params %#v \n ", ps.Tasks[index].Params)
804821
index += 1
805822
ps.Tasks[index].Params = append(ps.Tasks[index].Params, tektonpipeline.Param{
806823
Name: i.Name,

pkg/reconciler/dependencybuild/dependencybuild.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ func (r *ReconcileDependencyBuild) handleStateBuilding(ctx context.Context, db *
668668
log.Info(fmt.Sprintf("handleStateBuilding: pipelinerun %s:%s already exists, not retrying", pr.Namespace, pr.Name))
669669
return reconcile.Result{}, nil
670670
}
671-
r.eventRecorder.Eventf(db, v1.EventTypeWarning, "PipelineRunCreationFailed", "The DependencyBuild %s/%s failed to create its build pipeline run", db.Namespace, db.Name)
671+
r.eventRecorder.Eventf(db, v1.EventTypeWarning, "PipelineRunCreationFailed", "The DependencyBuild %s/%s failed to create its build pipeline run with %#v", db.Namespace, db.Name, err)
672672
return reconcile.Result{}, err
673673
}
674674
return reconcile.Result{}, r.client.Status().Update(ctx, db)

0 commit comments

Comments
 (0)