Skip to content

Commit 626c434

Browse files
committed
fix: gitops and quickstart error
Signed-off-by: Meng JiaFeng <[email protected]>
1 parent d5dab95 commit 626c434

File tree

8 files changed

+68
-212
lines changed

8 files changed

+68
-212
lines changed

docs/best-practices/gitops.md

Lines changed: 4 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -119,65 +119,10 @@ Use "dtm [command] --help" for more information about a command.
119119
120120
## 4 Config File
121121
122-
Create a file named `config.yaml` and paste the following content into it:
123-
124-
```yaml
125-
config:
126-
state:
127-
backend: local
128-
options:
129-
stateFile: devstream.state
130-
vars:
131-
githubUser: IronCore864
132-
dockerUser: ironcore864
133-
app: helloworld
134-
135-
tools:
136-
- name: repo-scaffolding
137-
instanceID: myapp
138-
options:
139-
destinationRepo:
140-
owner: [[ githubUser ]]
141-
name: [[ app ]]
142-
branch: main
143-
scmType: github
144-
sourceRepo:
145-
org: devstream-io
146-
name: dtm-scaffolding-flask
147-
scmType: github
148-
- name: github-actions
149-
instanceID: flask
150-
dependsOn: [ repo-scaffolding.myapp ]
151-
options:
152-
scm:
153-
owner: [[ githubUser ]]
154-
name: [[ app ]]
155-
scmType: github
156-
pipeline:
157-
configLocation: https://raw.githubusercontent.com/devstream-io/ci-template/main/github-actions/workflows/main.yml
158-
language:
159-
name: python
160-
framework: flask
161-
imageRepo:
162-
user: [[ dockerUser ]]
163-
- name: helm-installer
164-
instanceID: argocd
165-
- name: argocdapp
166-
instanceID: default
167-
dependsOn: [ "helm-installer.argocd", "github-actions.flask" ]
168-
options:
169-
app:
170-
name: [[ app ]]
171-
namespace: argocd
172-
destination:
173-
server: https://kubernetes.default.svc
174-
namespace: default
175-
source:
176-
valuefile: values.yaml
177-
path: helm/[[ app ]]
178-
repoURL: ${{repo-scaffolding.myapp.outputs.repoURL}}
179-
imageRepo:
180-
user: [[ dockerUser ]]
122+
Run command below to get a valid `config.yaml` file:
123+
124+
```shell
125+
./dtm show config -t gitops > config.yaml
181126
```
182127
183128
Then modify the `vars` section in the `config.yaml` file accordingly. Please update the values for `githubUser` and `dockerUser` to your real users.

docs/best-practices/gitops.zh.md

Lines changed: 4 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -119,65 +119,10 @@ Use "dtm [command] --help" for more information about a command.
119119
120120
## 4 配置文件
121121
122-
创建一个名为 `config.yaml` 的文件,并把下面的内容粘贴进去:
123-
124-
```yaml
125-
config:
126-
state:
127-
backend: local
128-
options:
129-
stateFile: devstream.state
130-
vars:
131-
githubUser: IronCore864
132-
dockerUser: ironcore864
133-
app: helloworld
134-
135-
tools:
136-
- name: repo-scaffolding
137-
instanceID: myapp
138-
options:
139-
destinationRepo:
140-
owner: [[ githubUser ]]
141-
name: [[ app ]]
142-
branch: main
143-
scmType: github
144-
sourceRepo:
145-
org: devstream-io
146-
name: dtm-scaffolding-flask
147-
scmType: github
148-
- name: github-actions
149-
instanceID: flask
150-
dependsOn: [ repo-scaffolding.myapp ]
151-
options:
152-
scm:
153-
owner: [[ githubUser ]]
154-
name: [[ app ]]
155-
scmType: github
156-
pipeline:
157-
configLocation: https://raw.githubusercontent.com/devstream-io/ci-template/main/github-actions/workflows/main.yml
158-
language:
159-
name: python
160-
framework: flask
161-
imageRepo:
162-
user: [[ dockerUser ]]
163-
- name: helm-installer
164-
instanceID: argocd
165-
- name: argocdapp
166-
instanceID: default
167-
dependsOn: [ "helm-installer.argocd", "github-actions.flask" ]
168-
options:
169-
app:
170-
name: [[ app ]]
171-
namespace: argocd
172-
destination:
173-
server: https://kubernetes.default.svc
174-
namespace: default
175-
source:
176-
valuefile: values.yaml
177-
path: helm/[[ app ]]
178-
repoURL: ${{repo-scaffolding.myapp.outputs.repoURL}}
179-
imageRepo:
180-
user: [[ dockerUser ]]
122+
运行以下命令来生成 gitops 的模板配置文件 `config.yaml`
123+
124+
```shell
125+
./dtm show config -t gitops > config.yaml
181126
```
182127
183128
按需修改 `config.yaml` 文件中的 `vars` 部分。记得修改 `githubUser``dockerUser` 的值为你自己的用户名。

examples/gitops.yaml

Lines changed: 24 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,56 @@
11
config:
2-
state: # state config, backend can be local, s3 or k8s
2+
state:
33
backend: local
44
options:
55
stateFile: devstream.state
6-
76
vars:
8-
defaultBranch: main
9-
githubUsername: daniel-hutao
10-
repoName: dtm-test-go
11-
jiraID: merico
12-
jiraUserEmail: [email protected]
13-
jiraProjectKey: DT
14-
dockerhubUsername: exploitht
15-
argocdNameSpace: argocd
7+
githubUser: GITHUB_USER
8+
dockerUser: DOCKERHUB_USER
9+
app: helloworld
1610

1711
tools:
1812
- name: repo-scaffolding
19-
instanceID: golang-github
13+
instanceID: myapp
2014
options:
2115
destinationRepo:
22-
owner: [[ githubUsername ]]
23-
name: [[ repoName ]]
24-
branch: [[ defaultBranch ]]
16+
owner: [[ githubUser ]]
17+
name: [[ app ]]
18+
branch: main
2519
scmType: github
2620
sourceRepo:
2721
org: devstream-io
28-
name: dtm-scaffolding-golang
22+
name: dtm-repo-scaffolding-python-flask
2923
scmType: github
30-
vars:
31-
imageRepo: "[[ dockerhubUsername ]]/[[ repoName ]]"
32-
- name: jira-github-integ
33-
instanceID: default
34-
dependsOn: [ "repo-scaffolding.golang-github" ]
35-
options:
36-
owner: [[ githubUsername ]]
37-
repo: [[ repoName ]]
38-
jiraBaseUrl: https://[[ jiraID ]].atlassian.net
39-
jiraUserEmail: [[ jiraUserEmail ]]
40-
jiraProjectKey: [[ jiraProjectKey ]]
41-
branch: main
4224
- name: github-actions
43-
instanceID: default
44-
dependsOn: [ "repo-scaffolding.golang-github" ]
25+
instanceID: flask
26+
dependsOn: [ repo-scaffolding.myapp ]
4527
options:
4628
scm:
47-
owner: ${{repo-scaffolding.golang-github.outputs.owner}}
48-
name: ${{repo-scaffolding.golang-github.outputs.repo}}
49-
branch: [[ defaultBranch ]]
29+
owner: [[ githubUser ]]
30+
name: [[ app ]]
5031
scmType: github
5132
pipeline:
52-
configLocation: https://raw.githubusercontent.com/devstream-io/ci-template/main/github-actions/workflows/main.yml
33+
configLocation: https://raw.githubusercontent.com/devstream-io/dtm-pipeline-templates/main/github-actions/workflows/main.yml
5334
language:
54-
name: go
55-
framework: gin
35+
name: python
36+
framework: flask
5637
imageRepo:
57-
user: [[ dockerhubUsername ]]
38+
user: [[ dockerUser ]]
5839
- name: helm-installer
5940
instanceID: argocd
6041
- name: argocdapp
6142
instanceID: default
62-
dependsOn: ["helm-installer.argocd", "repo-scaffolding.golang-github"]
43+
dependsOn: [ "helm-installer.argocd", "github-actions.flask" ]
6344
options:
6445
app:
65-
name: ${{repo-scaffolding.golang-github.outputs.repo}}
66-
namespace: [[ argocdNameSpace ]]
46+
name: [[ app ]]
47+
namespace: argocd
6748
destination:
6849
server: https://kubernetes.default.svc
6950
namespace: default
7051
source:
7152
valuefile: values.yaml
72-
path: helm/${{repo-scaffolding.golang-github.outputs.repo}}
73-
repoURL: ${{repo-scaffolding.golang-github.outputs.repoURL}}
53+
path: helm/[[ app ]]
54+
repoURL: ${{repo-scaffolding.myapp.outputs.repoURL}}
55+
imageRepo:
56+
user: [[ dockerUser ]]

examples/quickstart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ tools:
1919
scmType: github
2020
sourceRepo:
2121
org: devstream-io
22-
name: dtm-scaffolding-gin
22+
name: dtm-repo-scaffolding-golang-gin
2323
scmType: github
2424
- name: github-actions
2525
instanceID: default

internal/pkg/plugin/githubactions/validate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ func validate(options configmanager.RawOptions) (configmanager.RawOptions, error
1919
return nil, err
2020
}
2121
// check repo is valid
22-
if opts.ProjectRepo.RepoType != "github" {
23-
return nil, fmt.Errorf("github action don't support other repo")
22+
if !opts.ProjectRepo.IsGithubRepo() {
23+
return nil, fmt.Errorf("github action only support other repo")
2424
}
2525
return options, nil
2626
}
Lines changed: 24 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,56 @@
11
config:
2-
state: # state config, backend can be local, s3 or k8s
2+
state:
33
backend: local
44
options:
55
stateFile: devstream.state
6-
76
vars:
8-
defaultBranch: main
9-
githubUsername: daniel-hutao
10-
repoName: dtm-test-go
11-
jiraID: merico
12-
jiraUserEmail: [email protected]
13-
jiraProjectKey: DT
14-
dockerhubUsername: exploitht
15-
argocdNameSpace: argocd
7+
githubUser: GITHUB_USER
8+
dockerUser: DOCKERHUB_USER
9+
app: helloworld
1610

1711
tools:
1812
- name: repo-scaffolding
19-
instanceID: golang-github
13+
instanceID: myapp
2014
options:
2115
destinationRepo:
22-
owner: [[ githubUsername ]]
23-
name: [[ repoName ]]
24-
branch: [[ defaultBranch ]]
16+
owner: [[ githubUser ]]
17+
name: [[ app ]]
18+
branch: main
2519
scmType: github
2620
sourceRepo:
2721
org: devstream-io
28-
name: dtm-scaffolding-golang
22+
name: dtm-repo-scaffolding-python-flask
2923
scmType: github
30-
vars:
31-
imageRepo: "[[ dockerhubUsername ]]/[[ repoName ]]"
32-
- name: jira-github-integ
33-
instanceID: default
34-
dependsOn: [ "repo-scaffolding.golang-github" ]
35-
options:
36-
owner: [[ githubUsername ]]
37-
repo: [[ repoName ]]
38-
jiraBaseUrl: https://[[ jiraID ]].atlassian.net
39-
jiraUserEmail: [[ jiraUserEmail ]]
40-
jiraProjectKey: [[ jiraProjectKey ]]
41-
branch: main
4224
- name: github-actions
43-
instanceID: default
44-
dependsOn: [ "repo-scaffolding.golang-github" ]
25+
instanceID: flask
26+
dependsOn: [ repo-scaffolding.myapp ]
4527
options:
4628
scm:
47-
owner: ${{repo-scaffolding.golang-github.outputs.owner}}
48-
name: ${{repo-scaffolding.golang-github.outputs.repo}}
49-
branch: [[ defaultBranch ]]
29+
owner: [[ githubUser ]]
30+
name: [[ app ]]
5031
scmType: github
5132
pipeline:
52-
configLocation: https://raw.githubusercontent.com/devstream-io/ci-template/main/github-actions/workflows/main.yml
33+
configLocation: https://raw.githubusercontent.com/devstream-io/dtm-pipeline-templates/main/github-actions/workflows/main.yml
5334
language:
54-
name: go
55-
framework: gin
35+
name: python
36+
framework: flask
5637
imageRepo:
57-
user: [[ dockerhubUsername ]]
38+
user: [[ dockerUser ]]
5839
- name: helm-installer
5940
instanceID: argocd
6041
- name: argocdapp
6142
instanceID: default
62-
dependsOn: ["helm-installer.argocd", "repo-scaffolding.golang-github"]
43+
dependsOn: [ "helm-installer.argocd", "github-actions.flask" ]
6344
options:
6445
app:
65-
name: ${{repo-scaffolding.golang-github.outputs.repo}}
66-
namespace: [[ argocdNameSpace ]]
46+
name: [[ app ]]
47+
namespace: argocd
6748
destination:
6849
server: https://kubernetes.default.svc
6950
namespace: default
7051
source:
7152
valuefile: values.yaml
72-
path: helm/${{repo-scaffolding.golang-github.outputs.repo}}
73-
repoURL: ${{repo-scaffolding.golang-github.outputs.repoURL}}
53+
path: helm/[[ app ]]
54+
repoURL: ${{repo-scaffolding.myapp.outputs.repoURL}}
55+
imageRepo:
56+
user: [[ dockerUser ]]

internal/pkg/show/config/templates/quickstart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ tools:
1919
scmType: github
2020
sourceRepo:
2121
org: devstream-io
22-
name: dtm-scaffolding-gin
22+
name: dtm-repo-scaffolding-golang-gin
2323
scmType: github
2424
- name: github-actions
2525
instanceID: default

0 commit comments

Comments
 (0)