mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 21:46:22 +01:00
119 lines
3.9 KiB
Plaintext
119 lines
3.9 KiB
Plaintext
// This module is included in the following assembly:
|
|
//
|
|
// *cicd/pipelines/using-pipelines-as-code.adoc
|
|
|
|
:_content-type: REFERENCE
|
|
[id="pipelines-as-code-command-reference_{context}"]
|
|
= {pac} command reference
|
|
|
|
[role="_abstract"]
|
|
The `tkn-pac` CLI tool offers the following capabilities:
|
|
|
|
* Bootstrap {pac} installation and configuration.
|
|
* Create a new {pac} repository.
|
|
* List all {pac} repositories.
|
|
* Describe a {pac} repository and the associated runs.
|
|
* Generate a simple pipeline run to get started.
|
|
* Resolve a pipeline run as if it was executed by {pac}.
|
|
|
|
[TIP]
|
|
====
|
|
You can use the commands corresponding to the capabilities for testing and experimentation, so that you don't have to make changes to the Git repository containing the application source code.
|
|
====
|
|
|
|
== Basic syntax
|
|
|
|
[source,terminal]
|
|
----
|
|
$ tkn pac [command or options] [arguments]
|
|
----
|
|
|
|
== Global options
|
|
|
|
[source,terminal]
|
|
----
|
|
$ tkn pac --help
|
|
----
|
|
|
|
== Utility commands
|
|
|
|
=== bootstrap
|
|
|
|
.Bootstrapping {pac} installation and configuration
|
|
[options="header"]
|
|
|===
|
|
|
|
| Command | Description
|
|
|
|
| `tkn pac bootstrap` | Installs and configures {pac} for Git repository hosting service providers, such as GitHub and GitHub Enterprise.
|
|
|
|
| `tkn pac bootstrap --nightly` | Installs the nightly build of {pac}.
|
|
|
|
| `tkn pac bootstrap --route-url <public_url_to_ingress_spec>` | Overrides the OpenShift route URL.
|
|
|
|
By default, `tkn pac bootstrap` detects the OpenShift route, which is automatically associated with the {pac} controller service.
|
|
|
|
If you do not have an {product-title} cluster, it asks you for the public URL that points to the ingress endpoint.
|
|
|
|
| `tkn pac bootstrap github-app` | Create a GitHub application and secrets in the `pipelines-as-code` namespace.
|
|
|
|
|===
|
|
|
|
=== repository
|
|
|
|
.Managing {pac} repositories
|
|
[options="header"]
|
|
|===
|
|
|
|
| Command | Description
|
|
|
|
| `tkn pac create repository` | Creates a new {pac} repository and a namespace based on the pipeline run template.
|
|
|
|
| `tkn pac list` | Lists all the {pac} repositories and displays the last status of the associated runs.
|
|
|
|
| `tkn pac repo describe` | Describes a {pac} repository and the associated runs.
|
|
|
|
|===
|
|
|
|
=== generate
|
|
|
|
.Generating pipeline runs using Pipelines as Code
|
|
[options="header"]
|
|
|===
|
|
|
|
| Command | Description
|
|
|
|
| `tkn pac generate` | Generates a simple pipeline run.
|
|
|
|
When executed from the directory containing the source code, it automatically detects current Git information.
|
|
|
|
In addition, it uses basic language detection capability and adds extra tasks depending on the language.
|
|
|
|
For example, if it detects a `setup.py` file at the repository root, the link:https://hub.tekton.dev/tekton/task/pylint[pylint task] is automatically added to the generated pipeline run.
|
|
|
|
|===
|
|
|
|
=== resolve
|
|
|
|
.Resolving and executing pipeline runs using {pac}
|
|
[options="header"]
|
|
|===
|
|
|
|
| Command | Description
|
|
|
|
| `tkn pac resolve` | Executes a pipeline run as if it is owned by the {pac} on service.
|
|
|
|
| `tkn pac resolve -f .tekton/pull-request.yaml \| oc apply -f -` | Displays the status of a live pipeline run that uses the template in `.tekton/pull-request.yaml`.
|
|
|
|
Combined with a Kubernetes installation running on your local machine, you can observe the pipeline run without generating a new commit.
|
|
|
|
If you run the command from a source code repository, it attempts to detect the current Git information and automatically resolve parameters such as current revision or branch.
|
|
|
|
| `tkn pac resolve -f .tekton/pr.yaml -p revision=main -p repo_name=<repository_name>` | Executes a pipeline run by overriding default parameter values derived from the Git repository.
|
|
|
|
The `-f` option can also accept a directory path and apply the `tkn pac resolve` command on all `.yaml` or `.yml` files in that directory. You can also use the `-f` flag multiple times in the same command.
|
|
|
|
You can override the default information gathered from the Git repository by specifying parameter values using the `-p` option. For example, you can use a Git branch as a revision and a different repository name.
|
|
|
|
|===
|