Skip to content

Commit 46a350e

Browse files
committed
Split prebuild source committing for JBS
1 parent 9bf2b93 commit 46a350e

File tree

6 files changed

+177
-179
lines changed

6 files changed

+177
-179
lines changed

deploy/tasks/pre-build-git.yaml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
apiVersion: tekton.dev/v1
3+
kind: Task
4+
metadata:
5+
name: pre-build-git
6+
annotations:
7+
tekton.dev/pipelines.minVersion: 0.12.1
8+
tekton.dev/tags: image-build, konflux
9+
labels:
10+
app.kubernetes.io/version: "0.1"
11+
build.appstudio.redhat.com/build_type: docker
12+
spec:
13+
description: |-
14+
Sets up pre-build for pushing the source.
15+
params:
16+
- name: NAME
17+
description: Name of the pipeline run (i.e. unique dependency build name)
18+
type: string
19+
- name: GIT_IDENTITY
20+
description: Git username. If empty, deploy-pre-build-source step will be skipped.
21+
type: string
22+
default: ""
23+
- name: GIT_URL
24+
description: String to determine whether we're using gitlab or github
25+
type: string
26+
default: "github"
27+
- name: GIT_SSL_VERIFICATION
28+
description: Whether to disable ssl verification
29+
type: string
30+
default: "false"
31+
- name: GIT_REUSE_REPOSITORY
32+
description: Whether to reuse existing git repository or create new one
33+
type: string
34+
default: "false"
35+
- name: SCM_URL
36+
description: Reference to the git repository
37+
type: string
38+
- name: SCM_HASH
39+
description: Git hash
40+
type: string
41+
- name: JVM_BUILD_SERVICE_REQPROCESSOR_IMAGE
42+
description: Name of the processor image. Useful to override for development.
43+
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"
46+
results:
47+
- name: GIT_ARCHIVE
48+
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
53+
steps:
54+
- name: create-pre-build-source
55+
image: $(params.JVM_BUILD_SERVICE_REQPROCESSOR_IMAGE)
56+
securityContext:
57+
runAsUser: 0
58+
computeResources:
59+
limits:
60+
cpu: 300m
61+
memory: 512Mi
62+
requests:
63+
cpu: 10m
64+
memory: 512Mi
65+
env:
66+
- name: GIT_DEPLOY_TOKEN
67+
valueFrom:
68+
secretKeyRef:
69+
optional: true
70+
name: jvm-build-git-repo-secrets
71+
key: gitdeploytoken
72+
args:
73+
- deploy-pre-build-source
74+
- --source-path=$(workspaces.source.path)/source
75+
- --task-run-name=$(context.taskRun.name)
76+
- --scm-uri=$(params.SCM_URL)
77+
- --scm-commit=$(params.SCM_HASH)
78+
- --image-id=$(params.NAME)
79+
- --git-identity=$(params.GIT_IDENTITY)
80+
- --git-url=$(params.GIT_URL)
81+
- --git-disable-ssl-verification=$(params.GIT_SSL_VERIFICATION)
82+
- --git-reuse-repository=$(params.GIT_REUSE_REPOSITORY)

deploy/tasks/pre-build-jbs.yaml

Lines changed: 0 additions & 133 deletions
This file was deleted.

deploy/tasks/pre-build.yaml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,24 @@ metadata:
1111
build.appstudio.redhat.com/build_type: docker
1212
spec:
1313
description: |-
14-
Sets up pre-build running the preprocessor, pushing the source and creating the OCI image.
14+
Sets up pre-build running the preprocessor creating the OCI image.
1515
params:
16-
- name: IMAGE_URL
17-
description: URL of the OCI image to use.
18-
type: string
19-
- name: NAME
20-
description: Name of the pipeline run (i.e. unique dependency build name)
21-
type: string
22-
- name: RECIPE_IMAGE
23-
description: The image from the build recipe to use
2416
- name: BUILD_TOOL
2517
description: The build tool to use (ant, gradle, maven, sbt).
2618
- name: BUILD_TOOL_VERSION
2719
description: The build tool version to use (e.g. 3.9.5)
28-
- name: JAVA_VERSION
29-
description: Java version to use (7, 8, 9, 11, 17, 21, 22, 23)
3020
- name: BUILD_SCRIPT
3121
description: The build script to embed with the Containerfile
22+
- name: JAVA_VERSION
23+
description: Java version to use (7, 8, 9, 11, 17, 21, 22, 23)
24+
- name: IMAGE_URL
25+
description: URL of the OCI image to use.
26+
type: string
3227
- name: JVM_BUILD_SERVICE_REQPROCESSOR_IMAGE
3328
description: Name of the processor image. Useful to override for development.
3429
type: string
30+
- name: RECIPE_IMAGE
31+
description: The image from the build recipe to use
3532
results:
3633
- name: PRE_BUILD_IMAGE_DIGEST
3734
description: Digest of the image just built

java-components/build-request-processor/src/main/java/com/redhat/hacbs/container/build/preprocessor/AbstractPreprocessor.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
* We keep all the options the same between maven, gradle, sbt and ant for now to keep the pipeline setup simpler.
1717
* Some of these may be ignored by different processors
1818
*/
19-
public abstract class AbstractPreprocessor implements Runnable {
19+
@CommandLine.Command(name = "prepare")
20+
public class AbstractPreprocessor implements Runnable {
2021

2122
/**
2223
* Equivalent to <code>$(workspaces.source.path)/source</code>
@@ -40,6 +41,7 @@ public abstract class AbstractPreprocessor implements Runnable {
4041
@CommandLine.Option(names = "--build-tool-version", required = true)
4142
protected String buildToolVersion;
4243

44+
@CommandLine.Option(names = "--type")
4345
protected ToolType type;
4446

4547
protected enum ToolType {

pkg/apis/jvmbuildservice/v1alpha1/systemconfig_types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ type SystemConfigList struct {
4747

4848
const (
4949
KonfluxGitDefinition = "https://raw.githubusercontent.com/konflux-ci/build-definitions/refs/heads/main/task/git-clone/0.1/git-clone.yaml"
50-
KonfluxPreBuildDefinitions = "https://raw.githubusercontent.com/redhat-appstudio/jvm-build-service/main/deploy/tasks/pre-build.yaml"
51-
KonfluxPreBuildGitDefinitions = "https://raw.githubusercontent.com/redhat-appstudio/jvm-build-service/main/deploy/tasks/pre-build-jbs.yaml"
52-
KonfluxBuildDefinitions = "https://raw.githubusercontent.com/tecarter94/jvm-build-service/rename-domain-proxy-whitelist/deploy/tasks/buildah-oci-ta.yaml"
50+
KonfluxPreBuildDefinitions = "https://raw.githubusercontent.com/rnc/jvm-build-service/BR1/deploy/tasks/pre-build.yaml"
51+
KonfluxPreBuildGitDefinitions = "https://raw.githubusercontent.com/rnc/jvm-build-service/BR1/deploy/tasks/pre-build-git.yaml"
52+
KonfluxBuildDefinitions = "https://raw.githubusercontent.com/redhat-appstudio/jvm-build-service/main/deploy/tasks/buildah-oci-ta.yaml"
5353
KonfluxMavenDeployDefinitions = "https://raw.githubusercontent.com/redhat-appstudio/jvm-build-service/main/deploy/tasks/maven-deployment.yaml"
5454
)

0 commit comments

Comments
 (0)