Skip to content

Commit 02ceb69

Browse files
authored
Merge pull request #84201 from eromanova97/RHDEVDOCS-5986
RHDEVDOCS-5986: Multiple authentication support in Git resolver
2 parents 7042f82 + b649a3e commit 02ceb69

4 files changed

+112
-1
lines changed

create/remote-pipelines-tasks-resolvers.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ include::modules/op-resolver-git-anon.adoc[leveloffset=+2]
6060
You can specify a remote pipeline, task, or `StepAction` definition from a Git repository by using the Git resolver. The repository must contain a YAML file that defines the pipeline or task. You can securely access repositories by using an authenticated API, which supports user authentication.
6161

6262
include::modules/op-resolver-git-config-scm.adoc[leveloffset=+2]
63+
include::modules/op-resolver-git-config-multiple-providers.adoc[leveloffset=+2]
6364
include::modules/op-resolver-git-scm.adoc[leveloffset=+2]
65+
include::modules/op-resolver-git-specify-multiple-providers.adoc[leveloffset=+2]
6466
include::modules/op-resolver-git-override-scm.adoc[leveloffset=+2]
6567

6668
[id="resolver-http_{context}"]
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// This module is included in the following assemblies:
2+
// * create/remote-pipelines-tasks-resolvers.adoc
3+
// * openshift_pipelines/remote-pipelines-tasks-resolvers.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="op-resolver-git-config-multiple-providers_{context}"]
7+
= Configuring multiple Git providers
8+
9+
You can configure multiple Git providers, or you can add multiple configurations for the same Git provider, to use in different task runs and pipeline runs.
10+
11+
Add details in the `TektonConfig` custom resource (CR) with your unique identifier key prefix.
12+
13+
.Procedure
14+
15+
. Edit the `TektonConfig` CR by running the following command:
16+
+
17+
[source,terminal]
18+
----
19+
$ oc edit TektonConfig config
20+
----
21+
22+
. In the `TektonConfig` CR, edit the `pipeline.git-resolver-config` spec:
23+
+
24+
[source,yaml]
25+
----
26+
apiVersion: operator.tekton.dev/v1alpha1
27+
kind: TektonConfig
28+
metadata:
29+
name: config
30+
spec:
31+
# ...
32+
pipeline:
33+
git-resolver-config:
34+
# configuration 1 # <1>
35+
fetch-timeout: "1m"
36+
default-url: "https://github.com/tektoncd/catalog.git"
37+
default-revision: "main"
38+
scm-type: "github"
39+
server-url: ""
40+
api-token-secret-name: ""
41+
api-token-secret-key: ""
42+
api-token-secret-namespace: "default"
43+
default-org: ""
44+
# configuration 2 # <2>
45+
test1.fetch-timeout: "5m"
46+
test1.default-url: ""
47+
test1.default-revision: "stable"
48+
test1.scm-type: "github"
49+
test1.server-url: "api.internal-github.com"
50+
test1.api-token-secret-name: "test1-secret"
51+
test1.api-token-secret-key: "token"
52+
test1.api-token-secret-namespace: "test1"
53+
test1.default-org: "tektoncd"
54+
# configuration 3 # <3>
55+
test2.fetch-timeout: "10m"
56+
test2.default-url: ""
57+
test2.default-revision: "stable"
58+
test2.scm-type: "gitlab"
59+
test2.server-url: "api.internal-gitlab.com"
60+
test2.api-token-secret-name: "test2-secret"
61+
test2.api-token-secret-key: "pat"
62+
test2.api-token-secret-namespace: "test2"
63+
test2.default-org: "tektoncd-infra"
64+
# ...
65+
----
66+
<1> The default configuration to use if no `configKey` key is provided or the key is provided with the `default` value.
67+
<2> The configuration used if the `configKey` key is passed with the `test1` value.
68+
<3> The configuration used if the `configKey` key is passed with the `test2` value.
69+
+
70+
[WARNING]
71+
====
72+
`configKey` values with the `.` symbol are not supported. If you try to pass a `configKey` value that contains the `.` symbol, the `TaskRun` or `PipelineRun` resource where you passed the value fails to run.
73+
====

modules/op-resolver-git-override-scm.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
:_mod-docs-content-type: REFERENCE
66
= Specifying a remote pipeline or task by using the Git resolver with the authenticated SCM API overriding the Git resolver configuration
77

8-
When creating a pipeline run, you can specify a remote pipeline from a Git repository by using the authenticated SCM API. When creating a pipeline or a task run, you can specify a remote task from a Git repository. You can override the initial configuration settings in specific pipeline runs or tasks to customize the behavior according to different use cases.
8+
You can override the initial configuration settings in specific pipeline runs or tasks to customize the behavior according to different use cases. You can use this method to access an authenticated provider that is not configured in the `TektonConfig` custom resource (CR).
99

1010
The following example task run references a remote task from a Git repository that overrides the previous resolver configuration:
1111

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// This module is included in the following assemblies:
2+
// * create/remote-pipelines-tasks-resolvers.adoc
3+
// * openshift_pipelines/remote-pipelines-tasks-resolvers.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="op-resolver-git-specify-multiple-providers_{context}"]
7+
= Specifying multiple Git providers
8+
9+
You can specify multiple Git providers by passing the unique `configKey` parameter when creating `TaskRun` and `PipelineRun` resources.
10+
11+
If no `configKey` parameter is passed, the default configuration is used. You can also specify default configuration by setting the `configKey` value to `default`.
12+
13+
[WARNING]
14+
====
15+
`configKey` values with the `.` symbol are not supported. If you try to pass a `configKey` value that contains the `.` symbol, the `TaskRun` or `PipelineRun` resource where you passed the value fails to run.
16+
====
17+
18+
.Prerequisites
19+
20+
* Configure multiple Git providers through the `Tektonconfig` custom resource. For more information, see "Configuring multiple Git providers".
21+
22+
.Procedure
23+
24+
* To specify a Git provider, use the following reference format in the `pipelineRef` and `taskRef` spec:
25+
+
26+
[source,yaml]
27+
----
28+
# ...
29+
resolver: git
30+
params:
31+
# ...
32+
- name: configKey
33+
value: <your_unique_key> # <1>
34+
# ...
35+
----
36+
<1> Your unique key that matches one of the configuration keys, for example, `test1`.

0 commit comments

Comments
 (0)