-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[KOGITO-7278] [KSW-Guides] Building Workflow Images with Tekton Pipel…
…ines Signed-off-by: desmax74 <[email protected]>
- Loading branch information
Showing
3 changed files
with
150 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
142 changes: 0 additions & 142 deletions
142
...rkflow/modules/ROOT/pages/cloud/operator/build-workflow-images-with-tekton.adoc
This file was deleted.
Oops, something went wrong.
143 changes: 142 additions & 1 deletion
143
...orkflow/modules/ROOT/pages/cloud/quarkus/build-workflow-images-with-tekton.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,142 @@ | ||
//= Building Workflow Images with Tekton Pipelines | ||
= Building Workflows Images with Tekton | ||
:compat-mode!: | ||
// Metadata: | ||
:description: Building Workflow Images with Tekton | ||
:keywords: kogito, workflow, serverless, operator, kubernetes, minikube, openshift, containers, tekton, pipelines | ||
|
||
This document describes how to build a Workflow Application on a Kubernetes cluster using the Tekton pipeline. | ||
|
||
|
||
.Prerequisites | ||
You have a git repo containing your workflow and the dockerfile to build the workflow as a docker/podman image. | ||
|
||
[NOTE] | ||
==== | ||
If you are using Openshift you can install the Red Hat Pipeline Operator, if you are using Minikube you can follow this link:https://github.com/tektoncd/pipeline/blob/main/docs/developers/local-setup.md#using-minikube[tekton guide for Minikube] | ||
If using Kind you can follow this link:https://github.com/tektoncd/plumbing/tree/main/hack[Tekton guide for Kind] on plain kubernetes cluster you can follow this link:https://tekton.dev/docs/pipelines/install/[Tekton guide for kubernetes] | ||
==== | ||
|
||
|
||
== Create The pipeline | ||
In the namespace `kogito-serverless-operator-system` where is deployed the Kogito Serverless Operator in the pipelines menu open the item Pipeline and go inthe create, copy the following yaml. | ||
It contains a pipeline to clone your image workflow repo, build the image anbd push to the local image registry. | ||
|
||
|
||
---- | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Pipeline | ||
metadata: | ||
name: custom-workflow-image-pipeline | ||
namespace: kogito-serverless-operator-system | ||
spec: | ||
params: | ||
- description: name of the deployment to be patched | ||
name: deployment-name | ||
type: string | ||
- description: url of the git repo for the code of deployment | ||
name: git-url | ||
type: string | ||
- default: pipelines-1.9 | ||
description: revision to be used from repo of the code for deployment | ||
name: git-revision | ||
type: string | ||
- description: image to be built from the code | ||
name: IMAGE | ||
type: string | ||
tasks: | ||
- name: fetch-repository | ||
params: | ||
- name: url | ||
value: $(params.git-url) | ||
- name: subdirectory | ||
value: '' | ||
- name: deleteExisting | ||
value: 'true' | ||
- name: revision | ||
value: $(params.git-revision) | ||
taskRef: | ||
kind: ClusterTask | ||
name: git-clone | ||
workspaces: | ||
- name: output | ||
workspace: shared-workspace | ||
- name: build-image | ||
params: | ||
- name: IMAGE | ||
value: $(params.IMAGE) | ||
- name: TLSVERIFY | ||
value: 'false' | ||
runAfter: | ||
- fetch-repository | ||
taskRef: | ||
kind: ClusterTask | ||
name: buildah | ||
workspaces: | ||
- name: source | ||
workspace: shared-workspace | ||
workspaces: | ||
- name: shared-workspace | ||
---- | ||
|
||
== Create The PipelineRun to execute the pipeline | ||
|
||
The next step is to create a pipeline run with the details of your git repo and the name of the image desidered | ||
|
||
in the Pipeline menu, in the item PipelineRun copy the following yaml replacing the placeholder with your values | ||
i.e. `image registry available at image-registry.openshift-image-registry.svc:5000/` | ||
|
||
---- | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: PipelineRun | ||
metadata: | ||
generateName: custom-workflow-image-pipeline-run | ||
namespace: kogito-serverless-operator-system | ||
spec: | ||
workspaces: | ||
- name: shared-workspace | ||
volumeClaimTemplate: | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 500Mi | ||
params: | ||
- name: deployment-name | ||
value: <your-image-name> | ||
- name: git-url | ||
value: https://<your repo>.git | ||
- name: git-revision | ||
value: "main" | ||
- name: IMAGE | ||
value: "image-registry.openshift-image-registry.svc:5000/kogito-serverless-operator-system/<your-image-name>:latest" | ||
pipelineRef: | ||
name: custom-workflow-image-pipeline | ||
---- | ||
You can check the execution of the pipeline in the UI, | ||
at the end your image will be available at: | ||
image-registry.openshift-image-registry.svc:5000/kogito-serverless-operator-system/<your-image-name>:latest | ||
|
||
|
||
== Create The PipelineRun with Tkn cli | ||
|
||
If you have installed the Tekton cli you can run the pipeline with the following command: | ||
---- | ||
tkn pipeline start kogito-serverless-operator-pipeline \ | ||
-w name=shared-workspace,volumeClaimTemplateFile=https://raw.githubusercontent.com/kiegroup/kogito-serverless-operator/main/tekton/volume/persistent_volume.yaml \ | ||
-p deployment-name=<your-image-name> \ | ||
-p git-url=https://<your repo>.git \ | ||
-p git-revision=main \ | ||
-p IMAGE='image-registry.openshift-image-registry.svc:5000/kogito-serverless-operator-system/<your-image-name>:latest' \ | ||
--use-param-defaults | ||
---- | ||
|
||
This command returns an id to check the execution with the cli in this way | ||
---- | ||
tkn pipelinerun logs custom-workflow-image-pipeline-run-<id> -f -n <your-namespace> | ||
---- | ||
|
||
At the end your image will be cluster's internal registry, like this example: | ||
---- | ||
image-registry.openshift-image-registry.svc:5000/kogito-serverless-operator-system/<your-image-name>:latest | ||
---- |