Build and Deploy
Get a insight how the solution gets tested, built and deployed and the configuration option of the pipeline.
OpenShift Pipelines (based on tekton) is used as technology for Solution Pipelines. The k5-project-operator will deploy the Pipeline Manager and create the needed Pipeline definitions in a new envoy during creating or updating the envoy. The Pipeline Manager running in the envoy is used by the Solution Designer for creating new Solution Pipelines and trigger them. If a new Solution Pipeline is created the Pipeline Manager creates a new Pipeline and additional needed Pipeline Resources to run the Pipeline for a specific solution. The Solution Pipeline will create all needed files, docker images, helm charts to deploy, test and run a solution into the Envoy. Every Solution Pipeline is responsible for deploying one solution into its Envoy.
Types of Pipelines
There are two types of Pipelines:
Build and Deploy Pipeline
The Build and Deploy Pipeline will first compile and build the solution (docker images and helm chart) from the configured git source and then deploy the solution into the defined target project.
Deploy Pipeline
The Deploy Pipeline uses an already existing image created in an earlier stage and deploys it to its defined target project. That means that one or more Deploy Pipelines can use the result of a Build and Deploy Pipeline or an another upstream Deploy Pipeline. The Deploy Pipeline starts automatically whenever the related image in the source project has changed.
Enable Deploy Pipeline to get images from an source project
For enabling a Deploy Pipeline (e.g. test-stage
) to get and use the
created solution images from a specific source project (e.g. dev-stage
)
the used service account (pipline
) for running the pipelines needs
permissions for pulling imagestreams
from the source project (e.g. where
the Build and Deploy Pipeline is configured). The following templates can be used for that:
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: pipeline-get-imagestreams
namespace: dev-stage
rules:
- apiGroups:
- ""
- image.openshift.io
resources:
- imagestreams
- imagestreams/layers
verbs:
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: pipeline-get-imagestreams
namespace: dev-stage
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: pipeline-get-imagestreams
subjects:
- kind: ServiceAccount
name: pipeline
namespace: test-stage
Enable Pipeline Manager to watch for imagestream changes for an upstream Solution Envoy
For enabling the Pipeline Manager (e.g. of test-envoy
) to watch for changes of the solution images from another Solution Envoy (e.g. dev-envoy
)
(project) the Pipeline Manager service account (k5-admin-sa
)
imagestreams
of the upstream Solution Envoy. That is needed if the automated trigger of Deploy Pipelines should be used.
The following templates can be used for that:
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: pm-watch-imagestreams
namespace: dev-stage
rules:
- apiGroups:
- ""
- image.openshift.io
resources:
- imagestreams
- imagestreams/layers
verbs:
- get
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: pm-watch-imagestreams
namespace: dev-stage
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: pm-watch-imagestreams
subjects:
- kind: ServiceAccount
name: k5-admin-sa
namespace: test-stage
General information
The creation, triggering and deletion of a new Pipeline can be done in the Solution Desinger. The creation of a new Pipeline will also trigger the first execution/run of the Pipeline. All created Pipelines can then be retriggered in the Solution Desinger manually. Use the 'Run' button in the Overview CI/CD page in the Solution Designer to start a (build and) deployment of your solution.
Important: