Skip to content

Commit 6688bc2

Browse files
committed
Remove workspace from prebuildgit
1 parent 46a350e commit 6688bc2

File tree

5 files changed

+29
-13
lines changed

5 files changed

+29
-13
lines changed

deploy/tasks/pre-build-git.yaml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ spec:
1313
description: |-
1414
Sets up pre-build for pushing the source.
1515
params:
16+
- name: PRE_BUILD_IMAGE_DIGEST
17+
description: Digest to use
18+
type: string
1619
- name: NAME
1720
description: Name of the pipeline run (i.e. unique dependency build name)
1821
type: string
@@ -41,16 +44,25 @@ spec:
4144
- name: JVM_BUILD_SERVICE_REQPROCESSOR_IMAGE
4245
description: Name of the processor image. Useful to override for development.
4346
type: string
44-
default: "quay.io/ncross/hacbs-jvm-build-request-processor:latest"
45-
# default: "quay.io/redhat-user-workloads/konflux-jbs-pnc-tenant/jvm-build-service/build-request-processor:latest"
4647
results:
4748
- name: GIT_ARCHIVE
4849
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
50+
volumes:
51+
- name: workdir
52+
emptyDir: {}
53+
stepTemplate:
54+
volumeMounts:
55+
- mountPath: /var/workdir
56+
name: workdir
5357
steps:
58+
- name: restore-trusted-artifact
59+
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:52f1391e6f1c472fd10bb838f64fae2ed3320c636f536014978a5ddbdfc6b3af
60+
script: |
61+
echo "Restoring source to workspace"
62+
use-archive $PRE_BUILD_IMAGE_DIGEST=/var/workdir/
63+
env:
64+
- name: PRE_BUILD_IMAGE_DIGEST
65+
value: $(params.PRE_BUILD_IMAGE_DIGEST)
5466
- name: create-pre-build-source
5567
image: $(params.JVM_BUILD_SERVICE_REQPROCESSOR_IMAGE)
5668
securityContext:
@@ -71,7 +83,7 @@ spec:
7183
key: gitdeploytoken
7284
args:
7385
- deploy-pre-build-source
74-
- --source-path=$(workspaces.source.path)/source
86+
- --source-path=/var/workdir
7587
- --task-run-name=$(context.taskRun.name)
7688
- --scm-uri=$(params.SCM_URL)
7789
- --scm-commit=$(params.SCM_HASH)

java-components/build-request-processor/src/main/java/com/redhat/hacbs/container/deploy/git/Git.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ protected GitStatus pushRepository(Path path, String httpTransportUrl, String co
146146
}
147147
var branchName = tagName + "-jbs-branch";
148148
var createBranch = jGit.branchList().call().stream().map(Ref::getName).noneMatch(("refs/heads/" + branchName)::equals);
149+
Log.infof("Will create branch %s for tag %s and branch name %s", createBranch, tagName, branchName);
149150
var ref = jGit.checkout().setStartPoint(tagName).setName(branchName).setCreateBranch(createBranch).call();
150151
StoredConfig jConfig = jRepo.getConfig();
151152
Log.infof("Updating current origin of %s to %s", jConfig.getString("remote", "origin", "url"),

pkg/apis/jvmbuildservice/v1alpha1/systemconfig_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,5 @@ const (
5050
KonfluxPreBuildDefinitions = "https://raw.githubusercontent.com/rnc/jvm-build-service/BR1/deploy/tasks/pre-build.yaml"
5151
KonfluxPreBuildGitDefinitions = "https://raw.githubusercontent.com/rnc/jvm-build-service/BR1/deploy/tasks/pre-build-git.yaml"
5252
KonfluxBuildDefinitions = "https://raw.githubusercontent.com/redhat-appstudio/jvm-build-service/main/deploy/tasks/buildah-oci-ta.yaml"
53-
KonfluxMavenDeployDefinitions = "https://raw.githubusercontent.com/redhat-appstudio/jvm-build-service/main/deploy/tasks/maven-deployment.yaml"
53+
KonfluxMavenDeployDefinitions = "https://raw.githubusercontent.com/rnc/jvm-build-service/BR1/deploy/tasks/maven-deployment.yaml"
5454
)

pkg/reconciler/dependencybuild/buildrecipeyaml.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,17 +436,13 @@ func createPipelineSpec(log logr.Logger, tool string, commitTime int64, jbsConfi
436436
},
437437
},
438438
}}
439-
fmt.Printf("### RECIPE : DISABLEDPLUGINS %#v \n", recipe.DisabledPlugins)
440439
pipelinePreBuildGitTask := []tektonpipeline.PipelineTask{{
441440
Name: PreBuildGitTaskName,
442441
RunAfter: []string{PreBuildTaskName},
443442
TaskRef: &tektonpipeline.TaskRef{
444443
// Can't specify name and resolver as they clash.
445444
ResolverRef: preBuildGitResolver,
446445
},
447-
Workspaces: []tektonpipeline.WorkspacePipelineTaskBinding{
448-
{Name: WorkspaceSource, Workspace: WorkspaceSource},
449-
},
450446
Params: []tektonpipeline.Param{
451447
{
452448
Name: "NAME",
@@ -455,6 +451,13 @@ func createPipelineSpec(log logr.Logger, tool string, commitTime int64, jbsConfi
455451
StringVal: imageId,
456452
},
457453
},
454+
{
455+
Name: "PRE_BUILD_IMAGE_DIGEST",
456+
Value: tektonpipeline.ParamValue{
457+
Type: tektonpipeline.ParamTypeString,
458+
StringVal: "$(tasks." + PreBuildTaskName + ".results." + PipelineResultPreBuildImageDigest + ")",
459+
},
460+
},
458461
{
459462
Name: "GIT_IDENTITY",
460463
Value: tektonpipeline.ParamValue{

pkg/reconciler/dependencybuild/dependencybuild.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ func (r *ReconcileDependencyBuild) handleStateBuilding(ctx context.Context, db *
666666
log.Info(fmt.Sprintf("handleStateBuilding: pipelinerun %s:%s already exists, not retrying", pr.Namespace, pr.Name))
667667
return reconcile.Result{}, nil
668668
}
669-
r.eventRecorder.Eventf(db, v1.EventTypeWarning, "PipelineRunCreationFailed", "The DependencyBuild %s/%s failed to create its build pipeline run", db.Namespace, db.Name)
669+
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)
670670
return reconcile.Result{}, err
671671
}
672672
return reconcile.Result{}, r.client.Status().Update(ctx, db)

0 commit comments

Comments
 (0)