diff --git a/deploy/tasks/pre-build-git.yaml b/deploy/tasks/pre-build-git.yaml index ee38332c9..5348c9ed3 100644 --- a/deploy/tasks/pre-build-git.yaml +++ b/deploy/tasks/pre-build-git.yaml @@ -13,6 +13,9 @@ spec: description: |- Sets up pre-build for pushing the source. params: + - name: PRE_BUILD_IMAGE_DIGEST + description: Digest to use + type: string - name: NAME description: Name of the pipeline run (i.e. unique dependency build name) type: string @@ -41,16 +44,25 @@ spec: - name: JVM_BUILD_SERVICE_REQPROCESSOR_IMAGE description: Name of the processor image. Useful to override for development. type: string - default: "quay.io/ncross/hacbs-jvm-build-request-processor:latest" - # default: "quay.io/redhat-user-workloads/konflux-jbs-pnc-tenant/jvm-build-service/build-request-processor:latest" results: - name: GIT_ARCHIVE description: Git archive information - workspaces: - - description: The git repo will be cloned onto the volume backing this Workspace. - name: source - mountPath: /var/workdir + volumes: + - name: workdir + emptyDir: {} + stepTemplate: + volumeMounts: + - mountPath: /var/workdir + name: workdir steps: + - name: restore-trusted-artifact + image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:52f1391e6f1c472fd10bb838f64fae2ed3320c636f536014978a5ddbdfc6b3af + script: | + echo "Restoring source to workspace" + use-archive $PRE_BUILD_IMAGE_DIGEST=/var/workdir/ + env: + - name: PRE_BUILD_IMAGE_DIGEST + value: $(params.PRE_BUILD_IMAGE_DIGEST) - name: create-pre-build-source image: $(params.JVM_BUILD_SERVICE_REQPROCESSOR_IMAGE) securityContext: @@ -71,7 +83,7 @@ spec: key: gitdeploytoken args: - deploy-pre-build-source - - --source-path=$(workspaces.source.path)/source + - --source-path=/var/workdir - --task-run-name=$(context.taskRun.name) - --scm-uri=$(params.SCM_URL) - --scm-commit=$(params.SCM_HASH) diff --git a/java-components/build-request-processor/src/main/java/com/redhat/hacbs/container/deploy/git/Git.java b/java-components/build-request-processor/src/main/java/com/redhat/hacbs/container/deploy/git/Git.java index d733410d5..b13742c82 100644 --- a/java-components/build-request-processor/src/main/java/com/redhat/hacbs/container/deploy/git/Git.java +++ b/java-components/build-request-processor/src/main/java/com/redhat/hacbs/container/deploy/git/Git.java @@ -146,6 +146,7 @@ protected GitStatus pushRepository(Path path, String httpTransportUrl, String co } var branchName = tagName + "-jbs-branch"; var createBranch = jGit.branchList().call().stream().map(Ref::getName).noneMatch(("refs/heads/" + branchName)::equals); + Log.infof("Will create branch %s for tag %s and branch name %s", createBranch, tagName, branchName); var ref = jGit.checkout().setStartPoint(tagName).setName(branchName).setCreateBranch(createBranch).call(); StoredConfig jConfig = jRepo.getConfig(); Log.infof("Updating current origin of %s to %s", jConfig.getString("remote", "origin", "url"), diff --git a/pkg/reconciler/dependencybuild/buildrecipeyaml.go b/pkg/reconciler/dependencybuild/buildrecipeyaml.go index b17d8fdce..0c56a3b3b 100644 --- a/pkg/reconciler/dependencybuild/buildrecipeyaml.go +++ b/pkg/reconciler/dependencybuild/buildrecipeyaml.go @@ -433,7 +433,6 @@ func createPipelineSpec(log logr.Logger, tool string, commitTime int64, jbsConfi }, }, }} - fmt.Printf("### RECIPE : DISABLEDPLUGINS %#v \n", recipe.DisabledPlugins) pipelinePreBuildGitTask := []tektonpipeline.PipelineTask{{ Name: PreBuildGitTaskName, RunAfter: []string{PreBuildTaskName}, @@ -441,9 +440,6 @@ func createPipelineSpec(log logr.Logger, tool string, commitTime int64, jbsConfi // Can't specify name and resolver as they clash. ResolverRef: preBuildGitResolver, }, - Workspaces: []tektonpipeline.WorkspacePipelineTaskBinding{ - {Name: WorkspaceSource, Workspace: WorkspaceSource}, - }, Params: []tektonpipeline.Param{ { Name: "NAME", @@ -452,6 +448,13 @@ func createPipelineSpec(log logr.Logger, tool string, commitTime int64, jbsConfi StringVal: imageId, }, }, + { + Name: "PRE_BUILD_IMAGE_DIGEST", + Value: tektonpipeline.ParamValue{ + Type: tektonpipeline.ParamTypeString, + StringVal: "$(tasks." + PreBuildTaskName + ".results." + PipelineResultPreBuildImageDigest + ")", + }, + }, { Name: "GIT_IDENTITY", Value: tektonpipeline.ParamValue{ diff --git a/pkg/reconciler/dependencybuild/dependencybuild.go b/pkg/reconciler/dependencybuild/dependencybuild.go index ce97587aa..ab5925d54 100644 --- a/pkg/reconciler/dependencybuild/dependencybuild.go +++ b/pkg/reconciler/dependencybuild/dependencybuild.go @@ -668,7 +668,7 @@ func (r *ReconcileDependencyBuild) handleStateBuilding(ctx context.Context, db * log.Info(fmt.Sprintf("handleStateBuilding: pipelinerun %s:%s already exists, not retrying", pr.Namespace, pr.Name)) return reconcile.Result{}, nil } - r.eventRecorder.Eventf(db, v1.EventTypeWarning, "PipelineRunCreationFailed", "The DependencyBuild %s/%s failed to create its build pipeline run", db.Namespace, db.Name) + 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) return reconcile.Result{}, err } return reconcile.Result{}, r.client.Status().Update(ctx, db)