Skip to content

Commit 3f519e4

Browse files
committed
move private repo deploy instructions from blog post
1 parent effaf02 commit 3f519e4

2 files changed

Lines changed: 107 additions & 85 deletions

File tree

content/blog/2023-12-20-private-repos.md

Lines changed: 2 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -16,89 +16,6 @@
1616
- repository access
1717
---
1818

19-
We're excited to announce that support for private repositories is now available. This feature requires VP operator version 0.0.36 or higher with the latest common/ clustergroup 0.8.2 chart. With this update, you can deploy patterns from git repositories that are either password-protected or secured with an SSH key.
19+
We're excited to announce that support for private repositories is now available. You can deploy patterns from git repositories that are either password-protected or secured with an SSH key.
2020

21-
## Setting up a private repository with SSH
22-
23-
To deploy a pattern from a private repository, follow these steps:
24-
25-
### Create a secret for repository access
26-
27-
Generate a secret containing the credentials for accessing your repository. This secret should be formatted according to [ArgoCD's declarative setup guidelines](https://argo-cd.readthedocs.io/en/stable/operator-manual/declarative-setup/#repositories). For example:
28-
29-
```yaml
30-
apiVersion: v1
31-
kind: Secret
32-
metadata:
33-
name: private-repo
34-
namespace: openshift-operators
35-
labels:
36-
argocd.argoproj.io/secret-type: repository
37-
stringData:
38-
type: git
39-
url: git@github.com:mbaldessari/mcg-private.git
40-
sshPrivateKey: |
41-
-----BEGIN OPENSSH PRIVATE KEY-----
42-
a3...
43-
...
44-
...
45-
-----END OPENSSH PRIVATE KEY-----
46-
```
47-
48-
### Deploy the pattern with the secret
49-
50-
Point your pattern's Custom Resource to the secret you created. Ensure that the `tokenSecret` and `tokenSecretNamespace` fields reference your new secret:
51-
52-
```yaml
53-
apiVersion: gitops.hybrid-cloud-patterns.io/v1alpha1
54-
kind: Pattern
55-
metadata:
56-
name: pattern-sample
57-
namespace: patterns-operator
58-
spec:
59-
clusterGroupName: hub
60-
gitSpec:
61-
targetRepo: git@github.com:mbaldessari/mcg-private.git
62-
targetRevision: private-repo
63-
tokenSecret: private-repo
64-
tokenSecretNamespace: openshift-operators
65-
```
66-
67-
This ensures that the pattern framework manages the necessary configurations, allowing all Argo instances to access the private repository.
68-
69-
Alternatively, you can do this entirely via the CLI:
70-
71-
```bash
72-
./pattern.sh make TOKEN_SECRET=private-repo TOKEN_NAMESPACE=openshift-operators install
73-
```
74-
75-
This command assumes that the `private-repo` secret exists and that the `origin` remote of the repository points to `git@github.com:mbaldessari/mcg-private.git` as specified in the secret.
76-
77-
## Using a GitLab private repository with a PAT
78-
79-
First, make sure your PAT has at least Read and Download permissions for your private repository.
80-
81-
As with the SSH example above, create a secret before running the install:
82-
83-
```yaml
84-
apiVersion: v1
85-
kind: Secret
86-
metadata:
87-
name: private-repo
88-
namespace: openshift-operators
89-
labels:
90-
argocd.argoproj.io/secret-type: repository
91-
stringData:
92-
type: git
93-
url: https://gitlab.com/dminnear-rh/mcg-private.git
94-
username: oauth2
95-
password: glpat-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
96-
```
97-
98-
Note that the username must be `oauth2`, not your GitLab handle.
99-
100-
Then reference the secret in the install:
101-
102-
```bash
103-
./pattern.sh make TOKEN_SECRET=private-repo TOKEN_NAMESPACE=openshift-operators install
104-
```
21+
For setup instructions, see [Installing Patterns in Private Repos](/learn/private-repos/).

content/learn/private-repos.adoc

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
---
2+
menu:
3+
learn:
4+
parent: Patterns quick start
5+
title: Installing Patterns in Private Repos
6+
weight: 51
7+
aliases: /learn/private-repos/
8+
---
9+
10+
:toc:
11+
:_content-type: ASSEMBLY
12+
include::modules/comm-attributes.adoc[]
13+
14+
[id="private-repos"]
15+
== Deploying patterns from private repositories
16+
17+
You can deploy patterns from git repositories that are either password-protected or secured with an SSH key.
18+
19+
== Using an SSH key
20+
21+
To deploy a pattern from an SSH-secured private repository, create a secret for repository access and then reference it in your pattern's Custom Resource.
22+
23+
=== Create a secret for repository access
24+
25+
Generate a secret containing the credentials for accessing your repository. This secret should be formatted according to link:https://argo-cd.readthedocs.io/en/stable/operator-manual/declarative-setup/#repositories[ArgoCD's declarative setup guidelines].
26+
27+
[source,yaml]
28+
----
29+
apiVersion: v1
30+
kind: Secret
31+
metadata:
32+
name: private-repo
33+
namespace: openshift-operators
34+
labels:
35+
argocd.argoproj.io/secret-type: repository
36+
stringData:
37+
type: git
38+
url: git@github.com:mbaldessari/mcg-private.git
39+
sshPrivateKey: |
40+
-----BEGIN OPENSSH PRIVATE KEY-----
41+
a3...
42+
...
43+
...
44+
-----END OPENSSH PRIVATE KEY-----
45+
----
46+
47+
=== Deploy the pattern with the secret
48+
49+
Reference the secret you created by passing `TOKEN_SECRET` and `TOKEN_NAMESPACE` to the install command:
50+
51+
[source,terminal]
52+
----
53+
./pattern.sh make TOKEN_SECRET=private-repo TOKEN_NAMESPACE=openshift-operators install
54+
----
55+
56+
This command assumes that the `private-repo` secret exists and that the `origin` remote of the repository points to `git@github.com:mbaldessari/mcg-private.git` as specified in the secret. The install sets the `tokenSecret` and `tokenSecretNamespace` fields on the pattern's Custom Resource, which ensures that all Argo instances can access the private repository.
57+
58+
If you need to create the pattern CR manually instead, set those fields directly:
59+
60+
[source,yaml]
61+
----
62+
apiVersion: gitops.hybrid-cloud-patterns.io/v1alpha1
63+
kind: Pattern
64+
metadata:
65+
name: pattern-sample
66+
namespace: patterns-operator
67+
spec:
68+
clusterGroupName: hub
69+
gitSpec:
70+
targetRepo: git@github.com:mbaldessari/mcg-private.git
71+
targetRevision: private-repo
72+
tokenSecret: private-repo
73+
tokenSecretNamespace: openshift-operators
74+
----
75+
76+
== Using a GitLab private repository with a PAT
77+
78+
First, make sure your PAT has at least Read and Download permissions for your private repository.
79+
80+
As with the SSH example above, create a secret before running the install:
81+
82+
[source,yaml]
83+
----
84+
apiVersion: v1
85+
kind: Secret
86+
metadata:
87+
name: private-repo
88+
namespace: openshift-operators
89+
labels:
90+
argocd.argoproj.io/secret-type: repository
91+
stringData:
92+
type: git
93+
url: https://gitlab.com/dminnear-rh/mcg-private.git
94+
username: oauth2
95+
password: glpat-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
96+
----
97+
98+
NOTE: The username must be `oauth2`, not your GitLab handle.
99+
100+
Then reference the secret in the install:
101+
102+
[source,terminal]
103+
----
104+
./pattern.sh make TOKEN_SECRET=private-repo TOKEN_NAMESPACE=openshift-operators install
105+
----

0 commit comments

Comments
 (0)