-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert pre-build task to yaml. #2117
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
--- | ||
apiVersion: tekton.dev/v1 | ||
kind: Task | ||
metadata: | ||
name: pre-build | ||
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 running the preprocessor, pushing the source and 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: GIT_SCRIPT | ||
description: Git clone commands | ||
type: string | ||
- name: GIT_IDENTITY | ||
description: Git username | ||
type: string | ||
- name: GIT_URL | ||
description: URL to determine whether we're using gitlab or github | ||
type: string | ||
- name: GIT_DEPLOY_TOKEN | ||
description: Name of jvm-build-git-repo-secrets secret containing git password/token to use. | ||
type: string | ||
- 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 | ||
- name: SCM_URL | ||
description: Reference to the git repository | ||
type: string | ||
- name: SCM_HASH | ||
description: Git hash | ||
type: string | ||
- name: RECIPE_IMAGE | ||
description: The image from the build recipe to use | ||
- name: BUILD_SCRIPT | ||
description: The build script to embed with the Containerfile | ||
- name: PREPROCESSOR_ARGS | ||
description: The arguments for the build preprocessor | ||
- name: ORAS_OPTIONS | ||
type: string | ||
description: Optional environment variable string for build-trusted-artifacts | ||
default: "" | ||
- name: JVM_BUILD_SERVICE_REQPROCESSOR_IMAGE | ||
description: Name of the processor image. Useful to override for development. | ||
type: string | ||
default: "quay.io/redhat-appstudio/hacbs-jvm-build-request-processor:dev" | ||
results: | ||
- name: PRE_BUILD_IMAGE_DIGEST | ||
description: Digest of the image just built | ||
- 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 | ||
- name: tls | ||
steps: | ||
# Should we use our own git clone task? Or embed (somehow) Konflux's version? | ||
- name: git-clone | ||
image: $(params.RECIPE_IMAGE) | ||
computeResources: | ||
limits: | ||
cpu: 300m | ||
memory: 512Mi | ||
requests: | ||
cpu: 10m | ||
memory: 512Mi | ||
securityContext: | ||
runAsUser: 0 | ||
env: | ||
- name: GIT_TOKEN | ||
valueFrom: | ||
secretKeyRef: | ||
optional: true | ||
name: jvm-build-git-secrets | ||
key: .git-credentials | ||
script: | | ||
$(params.GIT_SCRIPT) | ||
- name: preprocessor | ||
image: $(params.JVM_BUILD_SERVICE_REQPROCESSOR_IMAGE) | ||
securityContext: | ||
runAsUser: 0 | ||
computeResources: | ||
limits: | ||
cpu: 300m | ||
memory: 512Mi | ||
requests: | ||
cpu: 10m | ||
memory: 512Mi | ||
script: | | ||
$(params.BUILD_SCRIPT) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To embed the Containerfile / build-script into the repository currently passing them through from the operator (which is generating them). Eventually I think the preprocessor should generate them (for the following steps ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes I believe it would be cleaner that the preprocessor generates the build script and propagates it as a result to following steps. Can be a subsequent PR. |
||
/opt/jboss/container/java/run/run-java.sh $(params.PREPROCESSOR_ARGS) | ||
- 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: $(params.GIT_DEPLOY_TOKEN) | ||
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) | ||
- name: create-pre-build-image | ||
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:d6f57d97d19008437680190908fe5444cda380f9c77d0e9efde7153720412e05 | ||
script: | | ||
echo "Creating pre-build-image archive" | ||
export ORAS_OPTIONS="$ORAS_OPTIONS --image-spec=v1.0 --artifact-type application/vnd.oci.image.config.v1+json" | ||
create-archive --store $(params.IMAGE_URL) $(results.PRE_BUILD_IMAGE_DIGEST.path)=$(workspaces.source.path)/source | ||
env: | ||
- name: ORAS_OPTIONS | ||
value: $(params.ORAS_OPTIONS) | ||
- name: IMAGE_URL | ||
value: $(params.IMAGE_URL) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently not using Konflux git clone task but the original simple git clone from JBS and passing it through as a script from the operator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The more we use Konflux's tasks the better I think, but not a problem for now to use our own. Can be a subsequent PR.