https://github.com/redhat-developer-demos/tutorials-pipelines
Tekton CD Pipeline Demos
https://github.com/redhat-developer-demos/tutorials-pipelines
demos kubernetes minikube pipelines tekton tektoncd
Last synced: 3 months ago
JSON representation
Tekton CD Pipeline Demos
- Host: GitHub
- URL: https://github.com/redhat-developer-demos/tutorials-pipelines
- Owner: redhat-developer-demos
- Created: 2019-07-14T09:07:24.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-25T03:11:03.000Z (almost 6 years ago)
- Last Synced: 2025-06-10T04:05:22.656Z (4 months ago)
- Topics: demos, kubernetes, minikube, pipelines, tekton, tektoncd
- Language: Java
- Homepage:
- Size: 49.8 KB
- Stars: 14
- Watchers: 1
- Forks: 12
- Open Issues: 2
-
Metadata Files:
- Readme: README.adoc
Awesome Lists containing this project
README
= Istio and Knative Tutorial Pipelines
The https://tekton.dev[Tekton Pipelines] that can be used to deploy:
* https://bit.ly/istio-tutorial[Istio Tutorial] applications to OpenShift/Kubernetes
* https://bit.ly/knative-tutorial[Knative Tutorial] applications to OpenShift/Kubernetes**(WIP)**== Pre-req
An OpenShift4 cluster with following components:
- Istio - To play with servicemesh functionalities
- Knative Serving - To play with severless functionalities
- https://github.com/openshift/pipelines-tutorial#install-openshift-pipelines[Install Tekton Pipelines]
- https://github.com/tektoncd/cli/releases/latest[Tekton CLI]== Create Tutorial Project in OpenShift
[source,bash]
----
oc new-project tutorial && \
! oc create serviceaccount pipeline && \
oc adm policy add-scc-to-user privileged -z pipeline && \
oc adm policy add-role-to-user edit -z pipeline && \
oc adm policy add-scc-to-user privileged -z default && \
oc adm policy add-scc-to-user anyuid -z default && \
oc create -f https://raw.githubusercontent.com/redhat-developer-demos/tutorials-pipelines/pipelines-common/pipeline-role-sa.yaml
-n tutorial && \
oc policy add-role-to-user pipeline-roles -z pipeline --role-namespace=tutorial
----== Deploy Nexus(Optional)
To make maven builds faster, we will deploy Sonatype Nexus
[source,bash]
----
oc new-app sonatype/nexus
----== Tasks
Create the following Tekton tasks which will be used in the `Pipelines`
[source,bash]
----
oc create -n tutorial \
-f https://raw.githubusercontent.com/tektoncd/catalog/master/kn/kn.yamloc create -n tutorial \
-f https://raw.githubusercontent.com/tektoncd/catalog/master/openshift-client/openshift-client-task.yamloc create -n tutorial \
-f https://raw.githubusercontent.com/redhat-developer-demos/knative-tutorial/master/06-pipelines/build-app-task.yaml----
Check the tasks created
[source,bash]
----
tkn task ls
----```
NAME AGE
NAME AGE
build-app 3 seconds ago
kn 5 seconds ago
openshift-client 4 seconds ago
```== Application Deployment
== Download the sources
[source,bash]
----
git clone https://github.com/redhat-developer-demos/tutorials-pipelines
cd tutorials-pipelines
----== Common
[source,bash]
----
oc create -f pipelines-common/resources.yaml \
-f pipelines-common/pipeline-deploy.yaml \ #<1>
-f pipelines-common/pipeline-kn-deploy.yaml #<2>
----<1> Pipeline used for vanilla Kubernetes/OpenShift deployment
<2> Pipeline used for serverless (knative) deployment== Customer
[source,bash]
----
# create customer deployment config
oc create -f customer/app.yaml# start the customer deploy pipeline
tkn pipeline start rhd-tutorial-deploy \
--param="applicationSrcDir=customer" \
--param="deploymentConfig=customer" \
--param="mavenMirrorUrl=http://nexus:8081/nexus/content/groups/public" \
--resource="app-git=git-source" \
--resource="app-image=customer-openshift-image" \
--serviceaccount='pipeline'
----Watch the logs of pipeline run using the command
[source,bash]
----
# get the running pipeline id
tkn pipelinerun ls
# get logs of the pipeline via
tkn pipelinerun logs -a -f
----== Preference
[source,bash]
----
# create preference deployment config
oc create -f preference/app.yaml# start preference deployment pipeline
tkn pipeline start rhd-tutorial-deploy \
--param="applicationSrcDir=preference" \
--param="deploymentConfig=preference" \
--param="mavenMirrorUrl=http://nexus:8081/nexus/content/groups/public" \
--resource="app-git=git-source" \
--resource="app-image=preference-openshift-image" \
--serviceaccount='pipeline'
----Watch the logs of pipeline run using the command
[source,bash]
----
# get the running pipeline id
tkn pipelinerun ls
# get logs of the pipeline via
tkn pipelinerun logs -a -f
----== Recommendation
=== Version 1
==== Vanilla OpenShift/Kubernetes Deployment
[source,bash]
----
oc create -f recommendation/app-v1.yamltkn pipeline start rhd-tutorial-deploy \
--param="applicationSrcDir=recommendation" \
--param="deploymentConfig=recommendation" \
--param="mavenMirrorUrl=http://nexus:8081/nexus/content/groups/public" \
--resource="app-git=git-source" \
--resource="app-image=recommendation-openshift-image-v1" \
--serviceaccount='pipeline'
----==== Knative Service Deployment
[source,bash]
----
tkn pipeline start rhd-tutorial-kn-deploy \
--param="applicationSrcDir=recommendation" \
--param="mavenMirrorUrl=http://nexus:8081/nexus/content/groups/public" \
--resource="app-git=git-source" \
--resource="app-image=recommendation-openshift-image-v1" \
--serviceaccount='pipeline'
----Watch the logs of pipeline run using the command
[source,bash]
----
# get the running pipeline id
tkn pipelinerun ls
# get logs of the pipeline via
tkn pipelinerun logs -a -f
----=== Version 2
==== Vanilla OpenShift/Kubernetes Deployment
[source,bash]
----
oc create -f recommendation/app-v2.yamltkn pipeline start rhd-tutorial-deploy \
--param="applicationSrcDir=recommendation" \
--param="deploymentConfig=recommendation" \
--param="mavenMirrorUrl=http://nexus:8081/nexus/content/groups/public" \
--resource="app-git=git-source-v2" \
--resource="app-image=recommendation-openshift-image-v2" \
--serviceaccount='pipeline'
----==== Knative Service Deployment
[source,bash]
----
tkn pipeline start rhd-tutorial-kn-deploy \
--param="applicationSrcDir=recommendation" \
--param="mavenMirrorUrl=http://nexus.rhd-workshop-infra:8081/nexus/content/groups/public" \
--resource="app-git=git-source-v2" \
--resource="app-image=recommendation-openshift-image-v2" \
--serviceaccount='pipeline'
----Watch the logs of pipeline run using the command
[source,bash]
----
# get the running pipeline id
tkn pipelinerun ls
# get logs of the pipeline via
tkn pipelinerun logs -a -f
----=== Knative
[source,bash]
----
oc create -f greeter/pipeline-deploy.yaml \
-f greeter/pipeline-run.yaml
----Watch the logs of pipeline run using the command
[source,bash]
----
# get the running pipeline id
tkn pipelinerun ls
# get logs of the pipeline via
tkn pipelinerun logs -a -f
----== Cleanup
* Delete all pipeline runs
[source,bash]
----
tkn pipelinerun ls | awk 'NR>1{print $1}' | xargs oc delete pipelinerun
----* Delete all pipelines
[source,bash]
----
oc delete -f pipelines-commons/pipeline-deploy.yaml
----* Delete applications
[source,bash]
----
oc delete -f recommendation/app-v1.yaml \
-f recommendation/app-v2.yaml \
-f preference/app.yaml \
-f customer/app.yaml
----