Skip to content

Commit e3e70ed

Browse files
authored
Merge pull request #407 from zong-zhe/add-private-repo
feat: add doc for integration with private git repo or oci registry
2 parents c0743db + d711173 commit e3e70ed

File tree

8 files changed

+515
-0
lines changed

8 files changed

+515
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Integrate Private Git Repo and OCI Registry
2+
3+
KCL package management tool supports saving and sharing KCL modules through the OCI registry and Git repository. This section will introduce how to integrate the KCL package management tool with the private OCI registry and Git repository.
4+
5+
## Private Git Repository
6+
7+
KCL package management tool depends on the Git tool in the local environment to interact with the Git repository. Therefore, before using the KCL package management tool, ensure the Git tool is installed in the local environment and the Git command can be found in the environment variable $PATH.
8+
9+
More Details - [How to Install Git Tool](https://git-scm.com/downloads)
10+
11+
KCL package management tool shares the same login credentials with the Git tool in the local environment. When you use the KCL package management tool to interact with a private Git repository, you need to check whether the Git tool can interact with the private Git repository normally. If you can successfully download the private Git repository using the `git clone` command, you can directly use the KCL package management tool without any login operation.
12+
13+
More Details - [Download Private Repository Using Git](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository)
14+
15+
## Private OCI Registry
16+
17+
The KCL package management tool supports saving and sharing KCL packages through private OCI Registries. mainly including two parts.
18+
19+
1. Login to the private OCI Registry using the `kcl registry login` command.
20+
21+
More Details - [kcl registry login Login OCI Registry](https://www.kcl-lang.io/docs/tools/cli/package-management/command-reference/login)
22+
23+
2. Replace the OCI Registry used by the KCL package management tool. The KCL package management tool supports specifying the OCI registry used to download KCL packages in three ways.
24+
25+
- Use the OCI Url to specify the OCI registry in the command line or `kcl.mod`.
26+
27+
You can specify the OCI Registry as `ghcr.io` by the following command.
28+
29+
```shell
30+
kcl mod add oci://ghcr.io/kcl-lang/helloworld --tag 0.1.0
31+
```
32+
33+
Or add the following content to the `kcl.mod` file to specify the OCI Registry as `ghcr.io`.
34+
35+
```toml
36+
helloworld = { oci = "oci://ghcr.io/kcl-lang/helloworld", tag = "0.1.0" }
37+
```
38+
39+
- By environment variable
40+
41+
You can adjust the configuration of the OCI Registry by setting the three environment variables `KPM_REG`, `KPM_REGO`, and `OCI_REG_PLAIN_HTTP`.
42+
43+
```shell
44+
# set default registry
45+
export KPM_REG="ghcr.io"
46+
# set default repository
47+
export KPM_REPO="kcl-lang"
48+
# set support for 'http'
49+
export OCI_REG_PLAIN_HTTP=off
50+
```
51+
52+
- By configuration file
53+
54+
The configuration file of the KCL package management tool is located at `$KCL_PKG_PATH/.kpm/config/kpm.json`, if the environment variable `KCL_PKG_PATH` is not set, it is saved by default in `$HOME/.kcl/kpm/.kpm/config/kpm.json`.
55+
56+
The default content of the configuration file is as follows:
57+
58+
```json
59+
{
60+
"DefaultOciRegistry": "ghcr.io",
61+
"DefaultOciRepo": "kcl-lang",
62+
"DefaultOciPlainHttp": true
63+
}
64+
```
65+
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# 集成私有的 Git Repo 与 OCI registry
2+
3+
KCL 包管理工具支持通过 OCI registry 和 Git 仓库保存和分享 KCL 包。本文将介绍如何使用 KCL 包管理工具与私有 OCI registry 和 Git 仓库集成。
4+
5+
## 私有 Git 仓库
6+
7+
KCL 包管理工具依赖本地环境中的 Git 工具完成与 Git 仓库的交互。因此,在使用 KCL 包管理工具之前,确保本地环境中完成了 Git 工具的安装,并且在环境变量 $PATH 中能够找到 Git 命令。
8+
9+
更多信息 - [如何安装 Git 工具](https://git-scm.com/downloads)
10+
11+
KCL 包管理工具与本地环境中的 Git 工具公用一份登录凭证,当您使用 KCL 包管理工具与私有 Git 仓库交互时,您需要先检查 Git 工具能否正常与私有 Git 仓库交互。如果您使用 `git clone` 命令能够成功下载私有 Git 仓库,您可以直接使用 KCL 包管理工具而不需要进行任何登录操作。
12+
13+
更多信息 - [使用 Git 下载私有仓库](https://docs.github.com/zh/repositories/creating-and-managing-repositories/cloning-a-repository)
14+
15+
## 私有 OCI Registry
16+
17+
关于私有的 OCI Registry, 主要包括两个部分
18+
19+
1. 需要先使用 `kcl registry login` 命令登录私有 Registry。
20+
21+
更多信息 - [kcl registry login 登录 OCI registry](https://www.kcl-lang.io/zh-CN/docs/tools/cli/package-management/command-reference/login)
22+
23+
2. 更换 KCL 包管理工具使用的 OCI Registry,KCL 包管理工具支持通过三种方式指定下载 KCL 包时使用的 OCI registry.
24+
25+
- 命令行或者 kcl.mod 中使用 OCI Url 指定使用的 OCI registry
26+
27+
你可以通过以下命令行,指定 OCI Registry 为`ghcr.io`
28+
29+
```shell
30+
kcl mod add oci://ghcr.io/kcl-lang/helloworld --tag 0.1.0
31+
```
32+
33+
或者在 `kcl.mod` 文件中添加如下内容,指定 OCI Registry 为`ghcr.io`
34+
35+
```toml
36+
helloworld = { oci = "oci://ghcr.io/kcl-lang/helloworld", tag = "0.1.0" }
37+
```
38+
39+
- 通过环境变量
40+
41+
你可以通过设置三个环境变量 KPM_REG、KPM_REGO 和 OCI_REG_PLAIN_HTTP 来调整配置。
42+
43+
```shell
44+
# 设置默认仓库地址
45+
export KPM_REG="ghcr.io"
46+
# 设置默认仓库
47+
export KPM_REPO="kcl-lang"
48+
# 设置支持 'http'
49+
export OCI_REG_PLAIN_HTTP=off
50+
```
51+
52+
- 通过配置文件
53+
54+
KCL 包管理工具的配置文件位于 `$KCL_PKG_PATH/.kpm/config/kpm.json`,如果环境变量 `KCL_PKG_PATH` 没有设置,它默认保存在 `$HOME/.kcl/kpm/.kpm/config/kpm.json`
55+
56+
配置文件的默认内容如下:
57+
58+
```json
59+
{
60+
"DefaultOciRegistry": "ghcr.io",
61+
"DefaultOciRepo": "kcl-lang",
62+
"DefaultOciPlainHttp": true
63+
}
64+
```
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# 集成私有的 Git Repo 与 OCI registry
2+
3+
KCL 包管理工具支持通过 OCI registry 和 Git 仓库保存和分享 KCL 包。本文将介绍如何使用 KCL 包管理工具与私有 OCI registry 和 Git 仓库集成。
4+
5+
## 私有 Git 仓库
6+
7+
KCL 包管理工具依赖本地环境中的 Git 工具完成与 Git 仓库的交互。因此,在使用 KCL 包管理工具之前,确保本地环境中完成了 Git 工具的安装,并且在环境变量 $PATH 中能够找到 Git 命令。
8+
9+
更多信息 - [如何安装 Git 工具](https://git-scm.com/downloads)
10+
11+
KCL 包管理工具与本地环境中的 Git 工具公用一份登录凭证,当您使用 KCL 包管理工具与私有 Git 仓库交互时,您需要先检查 Git 工具能否正常与私有 Git 仓库交互。如果您使用 `git clone` 命令能够成功下载私有 Git 仓库,您可以直接使用 KCL 包管理工具而不需要进行任何登录操作。
12+
13+
更多信息 - [使用 Git 下载私有仓库](https://docs.github.com/zh/repositories/creating-and-managing-repositories/cloning-a-repository)
14+
15+
## 私有 OCI Registry
16+
17+
关于私有的 OCI Registry, 主要包括两个部分
18+
19+
1. 需要先使用 `kcl registry login` 命令登录私有 Registry。
20+
21+
更多信息 - [kcl registry login 登录 OCI registry](https://www.kcl-lang.io/zh-CN/docs/tools/cli/package-management/command-reference/login)
22+
23+
2. 更换 KCL 包管理工具使用的 OCI Registry,KCL 包管理工具支持通过三种方式指定下载 KCL 包时使用的 OCI registry.
24+
25+
- 命令行或者 kcl.mod 中使用 OCI Url 指定使用的 OCI registry
26+
27+
你可以通过以下命令行,指定 OCI Registry 为`ghcr.io`
28+
29+
```shell
30+
kcl mod add oci://ghcr.io/kcl-lang/helloworld --tag 0.1.0
31+
```
32+
33+
或者在 `kcl.mod` 文件中添加如下内容,指定 OCI Registry 为`ghcr.io`
34+
35+
```toml
36+
helloworld = { oci = "oci://ghcr.io/kcl-lang/helloworld", tag = "0.1.0" }
37+
```
38+
39+
- 通过环境变量
40+
41+
你可以通过设置三个环境变量 KPM_REG、KPM_REGO 和 OCI_REG_PLAIN_HTTP 来调整配置。
42+
43+
```shell
44+
# 设置默认仓库地址
45+
export KPM_REG="ghcr.io"
46+
# 设置默认仓库
47+
export KPM_REPO="kcl-lang"
48+
# 设置支持 'http'
49+
export OCI_REG_PLAIN_HTTP=off
50+
```
51+
52+
- 通过配置文件
53+
54+
KCL 包管理工具的配置文件位于 `$KCL_PKG_PATH/.kpm/config/kpm.json`,如果环境变量 `KCL_PKG_PATH` 没有设置,它默认保存在 `$HOME/.kcl/kpm/.kpm/config/kpm.json`
55+
56+
配置文件的默认内容如下:
57+
58+
```json
59+
{
60+
"DefaultOciRegistry": "ghcr.io",
61+
"DefaultOciRepo": "kcl-lang",
62+
"DefaultOciPlainHttp": true
63+
}
64+
```
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# 集成私有的 Git Repo 与 OCI registry
2+
3+
KCL 包管理工具支持通过 OCI registry 和 Git 仓库保存和分享 KCL 包。本文将介绍如何使用 KCL 包管理工具与私有 OCI registry 和 Git 仓库集成。
4+
5+
## 私有 Git 仓库
6+
7+
KCL 包管理工具依赖本地环境中的 Git 工具完成与 Git 仓库的交互。因此,在使用 KCL 包管理工具之前,确保本地环境中完成了 Git 工具的安装,并且在环境变量 $PATH 中能够找到 Git 命令。
8+
9+
更多信息 - [如何安装 Git 工具](https://git-scm.com/downloads)
10+
11+
KCL 包管理工具与本地环境中的 Git 工具公用一份登录凭证,当您使用 KCL 包管理工具与私有 Git 仓库交互时,您需要先检查 Git 工具能否正常与私有 Git 仓库交互。如果您使用 `git clone` 命令能够成功下载私有 Git 仓库,您可以直接使用 KCL 包管理工具而不需要进行任何登录操作。
12+
13+
更多信息 - [使用 Git 下载私有仓库](https://docs.github.com/zh/repositories/creating-and-managing-repositories/cloning-a-repository)
14+
15+
## 私有 OCI Registry
16+
17+
关于私有的 OCI Registry, 主要包括两个部分
18+
19+
1. 需要先使用 `kcl registry login` 命令登录私有 Registry。
20+
21+
更多信息 - [kcl registry login 登录 OCI registry](https://www.kcl-lang.io/zh-CN/docs/tools/cli/package-management/command-reference/login)
22+
23+
2. 更换 KCL 包管理工具使用的 OCI Registry,KCL 包管理工具支持通过三种方式指定下载 KCL 包时使用的 OCI registry.
24+
25+
- 命令行或者 kcl.mod 中使用 OCI Url 指定使用的 OCI registry
26+
27+
你可以通过以下命令行,指定 OCI Registry 为`ghcr.io`
28+
29+
```shell
30+
kcl mod add oci://ghcr.io/kcl-lang/helloworld --tag 0.1.0
31+
```
32+
33+
或者在 `kcl.mod` 文件中添加如下内容,指定 OCI Registry 为`ghcr.io`
34+
35+
```toml
36+
helloworld = { oci = "oci://ghcr.io/kcl-lang/helloworld", tag = "0.1.0" }
37+
```
38+
39+
- 通过环境变量
40+
41+
你可以通过设置三个环境变量 KPM_REG、KPM_REGO 和 OCI_REG_PLAIN_HTTP 来调整配置。
42+
43+
```shell
44+
# 设置默认仓库地址
45+
export KPM_REG="ghcr.io"
46+
# 设置默认仓库
47+
export KPM_REPO="kcl-lang"
48+
# 设置支持 'http'
49+
export OCI_REG_PLAIN_HTTP=off
50+
```
51+
52+
- 通过配置文件
53+
54+
KCL 包管理工具的配置文件位于 `$KCL_PKG_PATH/.kpm/config/kpm.json`,如果环境变量 `KCL_PKG_PATH` 没有设置,它默认保存在 `$HOME/.kcl/kpm/.kpm/config/kpm.json`
55+
56+
配置文件的默认内容如下:
57+
58+
```json
59+
{
60+
"DefaultOciRegistry": "ghcr.io",
61+
"DefaultOciRepo": "kcl-lang",
62+
"DefaultOciPlainHttp": true
63+
}
64+
```
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# 集成私有的 Git Repo 与 OCI registry
2+
3+
KCL 包管理工具支持通过 OCI registry 和 Git 仓库保存和分享 KCL 包。本文将介绍如何使用 KCL 包管理工具与私有 OCI registry 和 Git 仓库集成。
4+
5+
## 私有 Git 仓库
6+
7+
KCL 包管理工具依赖本地环境中的 Git 工具完成与 Git 仓库的交互。因此,在使用 KCL 包管理工具之前,确保本地环境中完成了 Git 工具的安装,并且在环境变量 $PATH 中能够找到 Git 命令。
8+
9+
更多信息 - [如何安装 Git 工具](https://git-scm.com/downloads)
10+
11+
KCL 包管理工具与本地环境中的 Git 工具公用一份登录凭证,当您使用 KCL 包管理工具与私有 Git 仓库交互时,您需要先检查 Git 工具能否正常与私有 Git 仓库交互。如果您使用 `git clone` 命令能够成功下载私有 Git 仓库,您可以直接使用 KCL 包管理工具而不需要进行任何登录操作。
12+
13+
更多信息 - [使用 Git 下载私有仓库](https://docs.github.com/zh/repositories/creating-and-managing-repositories/cloning-a-repository)
14+
15+
## 私有 OCI Registry
16+
17+
关于私有的 OCI Registry, 主要包括两个部分
18+
19+
1. 需要先使用 `kcl registry login` 命令登录私有 Registry。
20+
21+
更多信息 - [kcl registry login 登录 OCI registry](https://www.kcl-lang.io/zh-CN/docs/tools/cli/package-management/command-reference/login)
22+
23+
2. 更换 KCL 包管理工具使用的 OCI Registry,KCL 包管理工具支持通过三种方式指定下载 KCL 包时使用的 OCI registry.
24+
25+
- 命令行或者 kcl.mod 中使用 OCI Url 指定使用的 OCI registry
26+
27+
你可以通过以下命令行,指定 OCI Registry 为`ghcr.io`
28+
29+
```shell
30+
kcl mod add oci://ghcr.io/kcl-lang/helloworld --tag 0.1.0
31+
```
32+
33+
或者在 `kcl.mod` 文件中添加如下内容,指定 OCI Registry 为`ghcr.io`
34+
35+
```toml
36+
helloworld = { oci = "oci://ghcr.io/kcl-lang/helloworld", tag = "0.1.0" }
37+
```
38+
39+
- 通过环境变量
40+
41+
你可以通过设置三个环境变量 KPM_REG、KPM_REGO 和 OCI_REG_PLAIN_HTTP 来调整配置。
42+
43+
```shell
44+
# 设置默认仓库地址
45+
export KPM_REG="ghcr.io"
46+
# 设置默认仓库
47+
export KPM_REPO="kcl-lang"
48+
# 设置支持 'http'
49+
export OCI_REG_PLAIN_HTTP=off
50+
```
51+
52+
- 通过配置文件
53+
54+
KCL 包管理工具的配置文件位于 `$KCL_PKG_PATH/.kpm/config/kpm.json`,如果环境变量 `KCL_PKG_PATH` 没有设置,它默认保存在 `$HOME/.kcl/kpm/.kpm/config/kpm.json`
55+
56+
配置文件的默认内容如下:
57+
58+
```json
59+
{
60+
"DefaultOciRegistry": "ghcr.io",
61+
"DefaultOciRepo": "kcl-lang",
62+
"DefaultOciPlainHttp": true
63+
}
64+
```
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Integrate Private Git Repo and OCI Registry
2+
3+
KCL package management tool supports saving and sharing KCL modules through the OCI registry and Git repository. This section will introduce how to integrate the KCL package management tool with the private OCI registry and Git repository.
4+
5+
## Private Git Repository
6+
7+
KCL package management tool depends on the Git tool in the local environment to interact with the Git repository. Therefore, before using the KCL package management tool, ensure the Git tool is installed in the local environment and the Git command can be found in the environment variable $PATH.
8+
9+
More Details - [How to Install Git Tool](https://git-scm.com/downloads)
10+
11+
KCL package management tool shares the same login credentials with the Git tool in the local environment. When you use the KCL package management tool to interact with a private Git repository, you need to check whether the Git tool can interact with the private Git repository normally. If you can successfully download the private Git repository using the `git clone` command, you can directly use the KCL package management tool without any login operation.
12+
13+
More Details - [Download Private Repository Using Git](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository)
14+
15+
## Private OCI Registry
16+
17+
The KCL package management tool supports saving and sharing KCL packages through private OCI Registries. mainly including two parts.
18+
19+
1. Login to the private OCI Registry using the `kcl registry login` command.
20+
21+
More Details - [kcl registry login Login OCI Registry](https://www.kcl-lang.io/docs/tools/cli/package-management/command-reference/login)
22+
23+
2. Replace the OCI Registry used by the KCL package management tool. The KCL package management tool supports specifying the OCI registry used to download KCL packages in three ways.
24+
25+
- Use the OCI Url to specify the OCI registry in the command line or `kcl.mod`.
26+
27+
You can specify the OCI Registry as `ghcr.io` by the following command.
28+
29+
```shell
30+
kcl mod add oci://ghcr.io/kcl-lang/helloworld --tag 0.1.0
31+
```
32+
33+
Or add the following content to the `kcl.mod` file to specify the OCI Registry as `ghcr.io`.
34+
35+
```toml
36+
helloworld = { oci = "oci://ghcr.io/kcl-lang/helloworld", tag = "0.1.0" }
37+
```
38+
39+
- By environment variable
40+
41+
You can adjust the configuration of the OCI Registry by setting the three environment variables `KPM_REG`, `KPM_REGO`, and `OCI_REG_PLAIN_HTTP`.
42+
43+
```shell
44+
# set default registry
45+
export KPM_REG="ghcr.io"
46+
# set default repository
47+
export KPM_REPO="kcl-lang"
48+
# set support for 'http'
49+
export OCI_REG_PLAIN_HTTP=off
50+
```
51+
52+
- By configuration file
53+
54+
The configuration file of the KCL package management tool is located at `$KCL_PKG_PATH/.kpm/config/kpm.json`, if the environment variable `KCL_PKG_PATH` is not set, it is saved by default in `$HOME/.kcl/kpm/.kpm/config/kpm.json`.
55+
56+
The default content of the configuration file is as follows:
57+
58+
```json
59+
{
60+
"DefaultOciRegistry": "ghcr.io",
61+
"DefaultOciRepo": "kcl-lang",
62+
"DefaultOciPlainHttp": true
63+
}
64+
```

0 commit comments

Comments
 (0)