Skip to content

Commit c824577

Browse files
committed
Fix isolated volume for verify task.
1 parent 76a4d3e commit c824577

File tree

3 files changed

+13
-19
lines changed

3 files changed

+13
-19
lines changed

deploy/tasks/maven-deployment.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,12 @@ spec:
3939
- name: restore-trusted-artifact
4040
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:81c4864dae6bb11595f657be887e205262e70086a05ed16ada827fd6391926ac
4141
script: |
42-
echo "Restoring artifacts to workspace"
43-
ls -laR /var/workdir
44-
echo "Root"
45-
ls -laR $HOME
4642
echo "Restoring artifacts to workspace"
4743
URL=$IMAGE_URL
4844
DIGEST=$IMAGE_DIGEST
4945
AARCHIVE=$(oras manifest fetch $ORAS_OPTIONS $URL@$DIGEST | jq --raw-output '.layers[0].digest')
5046
echo "URL $URL DIGEST $DIGEST AARCHIVE $AARCHIVE"
5147
use-archive oci:$URL@$AARCHIVE=/var/workdir/
52-
ls -laR /var/workdir
53-
echo "DONE"
5448
env:
5549
- name: IMAGE_DIGEST
5650
value: $(params.IMAGE_DIGEST)

pkg/reconciler/dependencybuild/buildrecipeyaml.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ import (
1919
)
2020

2121
const (
22-
PostBuildVolume = "post-build-volume"
23-
WorkspaceSource = "source"
24-
WorkspaceMount = "/var/workdir"
25-
WorkspaceTls = "tls"
22+
PostBuildVolume = "post-build-volume"
23+
PostBuildVolumeMount = "/var/workdir"
24+
WorkspaceSource = "source"
25+
WorkspaceTls = "tls"
2626

2727
GitTaskName = "git-clone"
2828
PreBuildTaskName = "pre-build"
@@ -138,8 +138,8 @@ func createPipelineSpec(log logr.Logger, tool string, commitTime int64, jbsConfi
138138
verifyBuiltArtifactsArgs := verifyParameters(jbsConfig, recipe)
139139
deployArgs := []string{
140140
"verify",
141-
"--path=$(workspaces.source.path)/artifacts",
142-
"--logs-path=$(workspaces.source.path)/logs",
141+
fmt.Sprintf("--path=%s/artifacts", PostBuildVolumeMount),
142+
fmt.Sprintf("--logs-path=%s/logs", PostBuildVolumeMount),
143143
"--task-run-name=$(context.taskRun.name)",
144144
"--build-id=" + buildId,
145145
"--scm-uri=" + db.Spec.ScmInfo.SCMURL,
@@ -543,31 +543,32 @@ func createPipelineSpec(log logr.Logger, tool string, commitTime int64, jbsConfi
543543
{Name: PipelineResultPassedVerification},
544544
{Name: PipelineResultVerificationResult},
545545
},
546+
StepTemplate: &tektonpipeline.StepTemplate{
547+
VolumeMounts: []v1.VolumeMount{{Name: PostBuildVolume, MountPath: PostBuildVolumeMount}},
548+
},
546549
Steps: []tektonpipeline.Step{
547550
{
548551
Name: "restore-post-build-artifacts",
549-
VolumeMounts: []v1.VolumeMount{{Name: PostBuildVolume, MountPath: WorkspaceMount}},
550552
Image: strings.TrimSpace(strings.Split(buildTrustedArtifacts, "FROM")[1]),
551553
ImagePullPolicy: v1.PullIfNotPresent,
552554
SecurityContext: &v1.SecurityContext{RunAsUser: &zero},
553555
Env: secretVariables,
554556
// While the manifest digest is available we need the manifest of the layer within the archive hence
555557
// using 'oras manifest fetch' to extract the correct layer.
556-
Script: fmt.Sprintf(`echo "Restoring artifacts to workspace : $(workspaces.source.path)"
558+
Script: fmt.Sprintf(`echo "Restoring artifacts"
557559
export ORAS_OPTIONS="%s"
558560
URL=%s
559561
DIGEST=$(tasks.%s.results.IMAGE_DIGEST)
560562
AARCHIVE=$(oras manifest fetch $ORAS_OPTIONS $URL@$DIGEST | jq --raw-output '.layers[0].digest')
561563
echo "URL $URL DIGEST $DIGEST AARCHIVE $AARCHIVE"
562-
use-archive oci:$URL@$AARCHIVE=$(workspaces.source.path)/artifacts`, orasOptions, registryArgsWithDefaults(jbsConfig, ""), BuildTaskName),
564+
use-archive oci:$URL@$AARCHIVE=%s/artifacts`, orasOptions, registryArgsWithDefaults(jbsConfig, ""), BuildTaskName, PostBuildVolumeMount),
563565
},
564566
{
565567
Name: "verify-and-check-for-contaminates",
566568
Image: buildRequestProcessorImage,
567569
ImagePullPolicy: pullPolicy,
568570
SecurityContext: &v1.SecurityContext{RunAsUser: &zero},
569571
Env: secretVariables,
570-
VolumeMounts: []v1.VolumeMount{{Name: PostBuildVolume, MountPath: WorkspaceMount}},
571572
ComputeResources: v1.ResourceRequirements{
572573
Requests: v1.ResourceList{"memory": limits.defaultBuildRequestMemory, "cpu": limits.defaultRequestCPU},
573574
Limits: v1.ResourceList{"memory": limits.defaultBuildRequestMemory, "cpu": limits.defaultLimitCPU},
@@ -855,7 +856,7 @@ func verifyParameters(jbsConfig *v1alpha1.JBSConfig, recipe *v1alpha1.BuildRecip
855856
verifyBuiltArtifactsArgs := []string{
856857
"verify-built-artifacts",
857858
"--repository-url=$(params." + PipelineParamProxyUrl + ")",
858-
"--deploy-path=$(workspaces.source.path)/artifacts",
859+
fmt.Sprintf("--deploy-path=%s/artifacts", PostBuildVolumeMount),
859860
"--task-run-name=$(context.taskRun.name)",
860861
"--results-file=$(results." + PipelineResultPassedVerification + ".path)",
861862
}

pkg/reconciler/dependencybuild/dependencybuild.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,10 +1362,9 @@ func (r *ReconcileDependencyBuild) removePipelineFinalizer(ctx context.Context,
13621362
return reconcile.Result{}, nil
13631363
}
13641364

1365+
// TODO: ### Either remove or replace with verification step *but* the contaminants/verification is all tied to the build pipeline in dependencybuild.go
13651366
func (r *ReconcileDependencyBuild) handleStateDeploying(ctx context.Context, db *v1alpha1.DependencyBuild) (reconcile.Result, error) {
1366-
13671367
log, _ := logr.FromContext(ctx)
1368-
log.Info(fmt.Sprintf("### handleStateDeploying %#v", db.Name))
13691368
//first we check to see if the pipeline exists
13701369

13711370
pr := tektonpipeline.PipelineRun{}

0 commit comments

Comments
 (0)