Skip to content

Commit

Permalink
Remove workspace from prebuildgit
Browse files Browse the repository at this point in the history
  • Loading branch information
rnc committed Dec 24, 2024
1 parent bfc2f8b commit ca8a653
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 12 deletions.
26 changes: 19 additions & 7 deletions deploy/tasks/pre-build-git.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
11 changes: 7 additions & 4 deletions pkg/reconciler/dependencybuild/buildrecipeyaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,17 +433,13 @@ 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},
TaskRef: &tektonpipeline.TaskRef{
// Can't specify name and resolver as they clash.
ResolverRef: preBuildGitResolver,
},
Workspaces: []tektonpipeline.WorkspacePipelineTaskBinding{
{Name: WorkspaceSource, Workspace: WorkspaceSource},
},
Params: []tektonpipeline.Param{
{
Name: "NAME",
Expand All @@ -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{
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/dependencybuild/dependencybuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ca8a653

Please sign in to comment.