This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.4.4. Assembling a Pipeline
A Pipeline represents a CI/CD flow and is defined by the Tasks to be executed. It is designed to be generic and reusable in multiple applications and environments.
A Pipeline specifies how the Tasks interact with each other and their order of execution using the from and runAfter parameters. It uses the workspaces field to specify one or more volumes that each Task in the Pipeline requires during execution.
In this section, you will create a Pipeline that takes the source code of the application from GitHub and then builds and deploys it on OpenShift Container Platform.
The Pipeline performs the following tasks for the back-end application vote-api and front-end application vote-ui:
-
Clones the source code of the application from the Git repository by referring to the
git-urlandgit-revisionparameters. -
Builds the container image using the
buildahClusterTask. -
Pushes the image to the internal image registry by referring to the
imageparameter. -
Deploys the new image on OpenShift Container Platform by using the
apply-manifestsandupdate-deploymentTasks.
Procedure
Copy the contents of the following sample Pipeline YAML file and save it:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The Pipeline definition abstracts away the specifics of the Git source repository and image registries. These details are added as
paramswhen a Pipeline is triggered and executed.Create the Pipeline:
oc create -f <pipeline-yaml-file-name.yaml>
$ oc create -f <pipeline-yaml-file-name.yaml>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Alternatively, you can also execute the YAML file directly from the Git repository:
oc create -f https://raw.githubusercontent.com/openshift/pipelines-tutorial/release-tech-preview-2/01_pipeline/04_pipeline.yaml
$ oc create -f https://raw.githubusercontent.com/openshift/pipelines-tutorial/release-tech-preview-2/01_pipeline/04_pipeline.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Use the
tkn pipeline listcommand to verify that the Pipeline is added to the application:tkn pipeline list
$ tkn pipeline listCopy to Clipboard Copied! Toggle word wrap Toggle overflow The output verifies that the
build-and-deployPipeline was created:NAME AGE LAST RUN STARTED DURATION STATUS build-and-deploy 1 minute ago --- --- --- ---
NAME AGE LAST RUN STARTED DURATION STATUS build-and-deploy 1 minute ago --- --- --- ---Copy to Clipboard Copied! Toggle word wrap Toggle overflow