Skip to content

Commit 1f2f081

Browse files
committed
docs: translate github-dtm-apps and tools
Signed-off-by: Daniel Hu <[email protected]>
1 parent 2e42e2c commit 1f2f081

File tree

3 files changed

+183
-4
lines changed

3 files changed

+183
-4
lines changed
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+
(省略了动图和视频等)

0 commit comments

Comments
 (0)