Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 2. Installing and configuring Pipelines as Code
You can install Pipelines as Code as a part of Red Hat OpenShift Pipelines installation.
2.1. Installing Pipelines as Code on an OpenShift Container Platform Copier lienLien copié sur presse-papiers!
When you install the Red Hat OpenShift Pipelines Operator, the system installs Pipelines as Code in the openshift-pipelines namespace. For more details, see Installing OpenShift Pipelines in the Additional resources section.
To disable the default installation of Pipelines as Code with the Operator, set the value of the enable parameter to false in the TektonConfig custom resource.
apiVersion: operator.tekton.dev/v1alpha1
kind: TektonConfig
metadata:
name: config
spec:
platforms:
openshift:
pipelinesAsCode:
enable: false
settings:
application-name: Pipelines as Code CI
auto-configure-new-github-repo: "false"
bitbucket-cloud-check-source-ip: "true"
hub-catalog-name: tekton
hub-url: https://api.hub.tekton.dev/v1
remote-tasks: "true"
secret-auto-create: "true"
# ...
Optionally, you can run the following command:
$ oc patch tektonconfig config --type="merge" -p '{"spec": {"platforms": {"openshift":{"pipelinesAsCode": {"enable": false}}}}}'
To enable the default installation of Pipelines as Code with the Red Hat OpenShift Pipelines Operator, set the value of the enable parameter to true in the TektonConfig custom resource:
apiVersion: operator.tekton.dev/v1alpha1
kind: TektonConfig
metadata:
name: config
spec:
platforms:
openshift:
pipelinesAsCode:
enable: true
settings:
application-name: Pipelines as Code CI
auto-configure-new-github-repo: "false"
bitbucket-cloud-check-source-ip: "true"
hub-catalog-name: tekton
hub-url: https://api.hub.tekton.dev/v1
remote-tasks: "true"
secret-auto-create: "true"
# ...
Optionally, you can run the following command:
$ oc patch tektonconfig config --type="merge" -p '{"spec": {"platforms": {"openshift":{"pipelinesAsCode": {"enable": true}}}}}'
2.2. Installing Pipelines as Code CLI Copier lienLien copié sur presse-papiers!
Cluster administrators can use the tkn pac and opc CLI tools on local machines or as containers for testing. Installing the tkn CLI for Red Hat OpenShift Pipelines automatically installs the tkn pac and opc CLI tools.
You can install the tkn pac and opc version 1.21.0 binaries for the supported platforms:
2.3. Customizing Pipelines as Code configuration Copier lienLien copié sur presse-papiers!
To customize Pipelines as Code, cluster administrators can configure the following parameters in the TektonConfig custom resource, in the platforms.openshift.pipelinesAsCode.settings spec:
| Parameter | Description | Default |
|---|---|---|
|
| The name of the application. For example, the name displayed in the GitHub Checks labels. |
|
|
| When enabled, Pipelines as Code automatically creates a secret by using the token from the GitHub application. You can use this secret with private repositories. |
|
|
| When enabled, allows remote tasks from pipeline run annotations. |
|
|
| The base URL for the Artifact Hub. | |
|
| The Tekton Hub catalog name. |
|
|
|
The URL of the Tekton Hub dashboard. Pipelines as Code uses this URL to generate a | NA |
|
| When enabled, secures the service requests by querying IP ranges for a public Bitbucket. Changing this value might create a security risk. |
|
|
| Additional IP ranges or networks, separated by commas. | NA |
|
|
A maximum limit for the | NA |
|
|
A default limit for the | NA |
|
| Configures new GitHub repositories automatically. Pipelines as Code sets up a namespace and creates a custom resource for your repository. This parameter is only supported with GitHub applications. |
|
|
|
Configures a template to automatically generate the namespace for your new repository, if you enable |
|
|
|
Configures a template to automatically generate the name for your new |
|
|
| Enables or disables log snippets for failed tasks in a pipeline. Disable this parameter to prevent data leakage. Snippets are truncated to 65,000 characters. |
|
|
| Configures the number of lines displayed in error log snippets. |
|
|
| Enables or disables inspecting container logs for error messages and exposing them as pull request annotations. Applies only with the GitHub app. |
|
|
|
The maximum number of lines inspected in the container logs to search for error messages. Set to | 50 |
|
|
When |
|
|
| Additional repositories for scoping the generated GitHub access token. | |
|
|
Cancels in-progress pipeline runs when a user pushes a new commit to a pull request. Pipelines as Code cancels the old run only after the new one starts. The |
|
|
|
Cancels in-progress pipeline runs when a user pushes a new commit. Pipelines as Code cancels the old run only after the new one starts. The |
|
2.4. Configuring additional Pipelines as Code controllers to support additional GitHub apps Copier lienLien copié sur presse-papiers!
By default, you can configure Pipelines as Code to interact with one GitHub app. In some cases you might need to use more than one GitHub app. For example, you might use different GitHub accounts or different GitHub instances such as GitHub Enterprise or GitHub SaaS. To use more than one GitHub app, you must configure an additional Pipelines as Code controller for every additional GitHub app.
Procedure
In the
TektonConfigcustom resource, add theadditionalPACControllerssection to theplatforms.openshift.pipelinesAsCodespec, as in the following example:Example
additionalPACControllerssectionapiVersion: operator.tekton.dev/v1 kind: TektonConfig metadata: name: config spec: platforms: openshift: pipelinesAsCode: additionalPACControllers: pac_controller_2: enable: true secretName: pac_secret_2 settings: # ...pac_controller_2- The name of the controller. This name must be unique and not exceed 25 characters in length.
enable-
This parameter is optional. Set this parameter to
trueto enable the additional controller or tofalseto disable the additional controller. The default value istrue. secretName- Set this parameter to the name of a secret that you must create for the GitHub app.
settings-
Optional. Use the
settingsblock to configure any Pipelines as Code settings for the additional controller when the settings must be different from the main Pipelines as Code controller.
-
Optional: If you want to use more than two GitHub apps, create additional sections under the
pipelinesAsCode.additionalPACControllersspec to configure a Pipelines as Code controller for every GitHub instance. Use a unique name for every controller.