Skip to content

Commit 7644fcb

Browse files
authored
Merge pull request #1414 from merico-dev/docs-ht
docs: translate github-dtm-apps and tools
2 parents ff9ab85 + ecd2655 commit 7644fcb

File tree

5 files changed

+189
-12
lines changed

5 files changed

+189
-12
lines changed

docs/plugins/trello.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,3 @@ This plugin has four outputs:
3838
- `todoListId`
3939
- `doingListId`
4040
- `doneListId`
41-
42-
which can be used by the `trello-github-integ` plugin. Refer to the [`trello-github-integ` plugin doc](./trello-github-integ.md) for more details.
Lines changed: 71 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,72 @@
1-
# GitHub + GitHub Actions with DTM Apps
1+
# 用 DTM Apps 实现基于 GitHub,Argo CD 和 GitHub Actions 的 CICD 流程
22

3-
TODO
3+
## 环境变量
4+
5+
你需要先设置如下环境变量:
6+
7+
```bash
8+
export GITHUB_TOKEN="YOUR_GITHUB_TOKEN_HERE"
9+
export IMAGE_REPO_PASSWORD="YOUR_DOCKERHUB_TOKEN_HERE"
10+
```
11+
12+
---
13+
14+
## 配置文件
15+
16+
```yaml
17+
config:
18+
state:
19+
backend: local
20+
options:
21+
stateFile: devstream.state
22+
23+
vars:
24+
GITHUB_USER: YOUR_GITHUB_USER
25+
DOCKERHUB_USER: YOUR_DOCKERHUB_USER
26+
27+
tools:
28+
- name: helm-installer
29+
instanceID: argocd
30+
31+
apps:
32+
- name: myapp1
33+
spec:
34+
language: python
35+
framework: django
36+
repo:
37+
url: github.com/[[ GITHUB_USER ]]/myapp1
38+
token: [[ env GITHUB_TOKEN ]]
39+
repoTemplate:
40+
url: github.com/devstream-io/dtm-repo-scaffolding-python-flask
41+
ci:
42+
- type: github-actions
43+
options:
44+
imageRepo:
45+
user: [[ DOCKERHUB_USER ]]
46+
password: [[ env IMAGE_REPO_PASSWORD ]]
47+
cd:
48+
- type: argocdapp
49+
```
50+
51+
你需要相应更新上述配置文件里的 "YOUR_GITHUB_USER" 和 "YOUR_DOCKERHUB_USER"。
52+
53+
---
54+
55+
## 运行
56+
57+
首先需要初始化:
58+
59+
```bash
60+
# this downloads the required plugins, according to the config file, automatically.
61+
dtm init -f config.yaml
62+
```
63+
64+
<script id="asciicast-EMzx8lzZq5AJpAMoJY23fh8A3" src="https://asciinema.org/a/EMzx8lzZq5AJpAMoJY23fh8A3.js" async></script>
65+
66+
然后运行如下命令让配置生效:
67+
68+
```bash
69+
dtm apply -f config.yaml -y
70+
```
71+
72+
<script id="asciicast-z1XlVm9kGjzArV9aNERD7acfH" src="https://asciinema.org/a/z1XlVm9kGjzArV9aNERD7acfH.js" async></script>

docs/use-cases/gitops-python-flask/3-github-dtm-tools.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ DevStream has two abstractions: [Tools](../../core-concepts/tools.md) and [Apps]
44

55
[The previous use case](./2-github-dtm-apps.md) uses "Apps". We can also achieve the same result with "Tools", and here's how:
66

7+
## ENV Vars
8+
9+
The following environment variables are required for this to work:
10+
11+
```bash
12+
export GITHUB_TOKEN="YOUR_GITHUB_TOKEN_HERE"
13+
export IMAGE_REPO_PASSWORD="YOUR_DOCKERHUB_TOKEN_HERE"
14+
```
15+
716
---
817

918
## Config File
Lines changed: 103 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,104 @@
1-
# GitHub + GitHub Actions with DTM Tools
1+
# 用 DTM Tools 实现基于 GitHub,Argo CD 和 GitHub Actions 的 CICD 流程
22

3-
TODO
3+
DevStream 抽象了2个概念:[Tools](../../core-concepts/tools.md)[Apps](../../core-concepts/apps.md)
4+
5+
[前一个用户场景](./2-github-dtm-apps.md) 里介绍了 "Apps",你可以用 "Tools" 实现一样的效果。具体方法如下:
6+
7+
## 环境变量
8+
9+
你需要先设置如下环境变量:
10+
11+
```bash
12+
export GITHUB_TOKEN="YOUR_GITHUB_TOKEN_HERE"
13+
export IMAGE_REPO_PASSWORD="YOUR_DOCKERHUB_TOKEN_HERE"
14+
```
15+
16+
---
17+
18+
## 配置文件
19+
20+
```yaml
21+
config:
22+
state:
23+
backend: local
24+
options:
25+
stateFile: devstream.state
26+
27+
vars:
28+
GITHUB_USER: YOUR_GITHUB_USER
29+
DOCKERHUB_USER: YOUR_DOCKERHUB_USER
30+
31+
tools:
32+
- name: repo-scaffolding
33+
instanceID: myapp1
34+
options:
35+
destinationRepo:
36+
owner: [[ GITHUB_USER ]]
37+
name: myapp1
38+
branch: main
39+
scmType: github
40+
token: [[ env GITHUB_TOKEN ]]
41+
sourceRepo:
42+
org: devstream-io
43+
name: dtm-repo-scaffolding-python-flask
44+
scmType: github
45+
- name: github-actions
46+
instanceID: flask
47+
dependsOn: [ repo-scaffolding.myapp1 ]
48+
options:
49+
scm:
50+
owner: [[ GITHUB_USER ]]
51+
name: myapp1
52+
scmType: github
53+
token: [[ env GITHUB_TOKEN ]]
54+
pipeline:
55+
configLocation: https://raw.githubusercontent.com/devstream-io/dtm-pipeline-templates/main/github-actions/workflows/main.yml
56+
language:
57+
name: python
58+
framework: flask
59+
imageRepo:
60+
user: [[ DOCKERHUB_USER ]]
61+
password: [[ env IMAGE_REPO_PASSWORD ]]
62+
- name: helm-installer
63+
instanceID: argocd
64+
- name: argocdapp
65+
instanceID: default
66+
dependsOn: [ "helm-installer.argocd", "github-actions.flask" ]
67+
options:
68+
app:
69+
name: myapp1
70+
namespace: argocd
71+
destination:
72+
server: https://kubernetes.default.svc
73+
namespace: default
74+
source:
75+
valuefile: values.yaml
76+
path: helm/myapp1
77+
repoURL: ${{repo-scaffolding.myapp1.outputs.repoURL}}
78+
token: [[ env GITHUB_TOKEN ]]
79+
imageRepo:
80+
user: [[ DOCKERHUB_USER ]]
81+
```
82+
83+
你需要相应更新上述配置文件里的 "YOUR_GITHUB_USER" 和 "YOUR_DOCKERHUB_USER"。
84+
85+
---
86+
87+
## 运行
88+
89+
首先需要初始化:
90+
91+
```bash
92+
# this downloads the required plugins, according to the config file, automatically.
93+
dtm init -f config.yaml
94+
```
95+
96+
<script id="asciicast-EMzx8lzZq5AJpAMoJY23fh8A3" src="https://asciinema.org/a/EMzx8lzZq5AJpAMoJY23fh8A3.js" async></script>
97+
98+
然后运行如下命令让配置生效:
99+
100+
```bash
101+
dtm apply -f config.yaml -y
102+
```
103+
104+
(省略了动图和视频等)

docs/use-cases/gitops-python-flask/4-gitlab-dtm-apps.zh.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626

2727
DevStream 将使用下面的插件来实现[第 0 节](#)中描述的目标:
2828

29-
1. [gitlab-ce-docker](../plugins/gitlab-ce-docker.md):用于在 Docker 中安装 GitLab;
30-
2. [repo-scaffolding](../plugins/repo-scaffolding.md): 用于在 GitLab 上创建一个 Python Web 应用程序仓库;
31-
3. [gitlab-ci](../plugins/gitlab-ci.md):用于为我们创建的仓库设置基本的 CI 流水线;
32-
4. [helm-installer](../plugins/helm-installer/helm-installer.md): 用于在 Kubernetes 集群中安装 Argo CD;
33-
5. [argocdapp](../plugins/argocdapp.md): 用于创建一个 Argo CD 应用程序,来部署第 1 步中生成的 Web 应用程序。
29+
1. [gitlab-ce-docker](../../plugins/gitlab-ce-docker.md):用于在 Docker 中安装 GitLab;
30+
2. [repo-scaffolding](../../plugins/repo-scaffolding.md): 用于在 GitLab 上创建一个 Python Web 应用程序仓库;
31+
3. [gitlab-ci](../../plugins/gitlab-ci.md):用于为我们创建的仓库设置基本的 CI 流水线;
32+
4. [helm-installer](../../plugins/helm-installer/helm-installer.md): 用于在 Kubernetes 集群中安装 Argo CD;
33+
5. [argocdapp](../../plugins/argocdapp.md): 用于创建一个 Argo CD 应用程序,来部署第 1 步中生成的 Web 应用程序。
3434

3535
我们将分成两个步骤来完成这些目标:
3636

@@ -58,7 +58,7 @@ sh -c "$(curl -fsSL https://download.devstream.io/download.sh)
5858
5959
> 可选:你可以把 `dtm` 移动到 $PATH 环境变量中的某个目录下。例如:`mv dtm /usr/local/bin/`。这样,你就可以直接运行 `dtm` 而不需要再加上 `./` 前缀了。
6060
>
61-
> 更多安装方式详见[安装 dtm](../install.zh.md)。
61+
> 更多安装方式详见[安装 dtm](../../install.zh.md)。
6262
6363
## 2 安装 GitLab 和 Argo CD
6464

0 commit comments

Comments
 (0)