Skip to content

Commit

Permalink
Split prebuild source committing for JBS
Browse files Browse the repository at this point in the history
  • Loading branch information
rnc committed Dec 24, 2024
1 parent 7d78120 commit ab9366a
Show file tree
Hide file tree
Showing 6 changed files with 176 additions and 178 deletions.
82 changes: 82 additions & 0 deletions deploy/tasks/pre-build-git.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: pre-build-git
annotations:
tekton.dev/pipelines.minVersion: 0.12.1
tekton.dev/tags: image-build, konflux
labels:
app.kubernetes.io/version: "0.1"
build.appstudio.redhat.com/build_type: docker
spec:
description: |-
Sets up pre-build for pushing the source.
params:
- name: NAME
description: Name of the pipeline run (i.e. unique dependency build name)
type: string
- name: GIT_IDENTITY
description: Git username. If empty, deploy-pre-build-source step will be skipped.
type: string
default: ""
- name: GIT_URL
description: String to determine whether we're using gitlab or github
type: string
default: "github"
- name: GIT_SSL_VERIFICATION
description: Whether to disable ssl verification
type: string
default: "false"
- name: GIT_REUSE_REPOSITORY
description: Whether to reuse existing git repository or create new one
type: string
default: "false"
- name: SCM_URL
description: Reference to the git repository
type: string
- name: SCM_HASH
description: Git hash
type: string
- 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
steps:
- name: create-pre-build-source
image: $(params.JVM_BUILD_SERVICE_REQPROCESSOR_IMAGE)
securityContext:
runAsUser: 0
computeResources:
limits:
cpu: 300m
memory: 512Mi
requests:
cpu: 10m
memory: 512Mi
env:
- name: GIT_DEPLOY_TOKEN
valueFrom:
secretKeyRef:
optional: true
name: jvm-build-git-repo-secrets
key: gitdeploytoken
args:
- deploy-pre-build-source
- --source-path=$(workspaces.source.path)/source
- --task-run-name=$(context.taskRun.name)
- --scm-uri=$(params.SCM_URL)
- --scm-commit=$(params.SCM_HASH)
- --image-id=$(params.NAME)
- --git-identity=$(params.GIT_IDENTITY)
- --git-url=$(params.GIT_URL)
- --git-disable-ssl-verification=$(params.GIT_SSL_VERIFICATION)
- --git-reuse-repository=$(params.GIT_REUSE_REPOSITORY)
133 changes: 0 additions & 133 deletions deploy/tasks/pre-build-jbs.yaml

This file was deleted.

19 changes: 8 additions & 11 deletions deploy/tasks/pre-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,24 @@ metadata:
build.appstudio.redhat.com/build_type: docker
spec:
description: |-
Sets up pre-build running the preprocessor, pushing the source and creating the OCI image.
Sets up pre-build running the preprocessor creating the OCI image.
params:
- name: IMAGE_URL
description: URL of the OCI image to use.
type: string
- name: NAME
description: Name of the pipeline run (i.e. unique dependency build name)
type: string
- name: RECIPE_IMAGE
description: The image from the build recipe to use
- name: BUILD_TOOL
description: The build tool to use (ant, gradle, maven, sbt).
- name: BUILD_TOOL_VERSION
description: The build tool version to use (e.g. 3.9.5)
- name: JAVA_VERSION
description: Java version to use (7, 8, 9, 11, 17, 21, 22, 23)
- name: BUILD_SCRIPT
description: The build script to embed with the Containerfile
- name: JAVA_VERSION
description: Java version to use (7, 8, 9, 11, 17, 21, 22, 23)
- name: IMAGE_URL
description: URL of the OCI image to use.
type: string
- name: JVM_BUILD_SERVICE_REQPROCESSOR_IMAGE
description: Name of the processor image. Useful to override for development.
type: string
- name: RECIPE_IMAGE
description: The image from the build recipe to use
results:
- name: PRE_BUILD_IMAGE_DIGEST
description: Digest of the image just built
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
* We keep all the options the same between maven, gradle, sbt and ant for now to keep the pipeline setup simpler.
* Some of these may be ignored by different processors
*/
public abstract class AbstractPreprocessor implements Runnable {
@CommandLine.Command(name = "prepare")
public class AbstractPreprocessor implements Runnable {

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

@CommandLine.Option(names = "--type")
protected ToolType type;

protected enum ToolType {
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/jvmbuildservice/v1alpha1/systemconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ type SystemConfigList struct {

const (
KonfluxGitDefinition = "https://raw.githubusercontent.com/konflux-ci/build-definitions/refs/heads/main/task/git-clone/0.1/git-clone.yaml"
KonfluxPreBuildDefinitions = "https://raw.githubusercontent.com/redhat-appstudio/jvm-build-service/main/deploy/tasks/pre-build.yaml"
KonfluxPreBuildGitDefinitions = "https://raw.githubusercontent.com/redhat-appstudio/jvm-build-service/main/deploy/tasks/pre-build-jbs.yaml"
KonfluxPreBuildDefinitions = "https://raw.githubusercontent.com/rnc/jvm-build-service/BR1/deploy/tasks/pre-build.yaml"
KonfluxPreBuildGitDefinitions = "https://raw.githubusercontent.com/rnc/jvm-build-service/BR1/deploy/tasks/pre-build-git.yaml"
KonfluxBuildDefinitions = "https://raw.githubusercontent.com/redhat-appstudio/jvm-build-service/main/deploy/tasks/buildah-oci-ta.yaml"
KonfluxMavenDeployDefinitions = "https://raw.githubusercontent.com/redhat-appstudio/jvm-build-service/main/deploy/tasks/maven-deployment.yaml"
)
Loading

0 comments on commit ab9366a

Please sign in to comment.