Skip to content

Commit 8ef126a

Browse files
authored
Merge pull request #1347 from merico-dev/refactor-gitlab-ci-language-plugins
refactor: gitlab ci use same plugin
2 parents 5ce69a2 + 792fa27 commit 8ef126a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+207
-1080
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,8 @@ testbin/
5252
# terraform
5353
.terraform
5454

55+
# test
56+
cov
57+
5558
# md
5659
README_when_create_plugin.md
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,35 @@ package main
22

33
import (
44
"github.com/devstream-io/devstream/internal/pkg/configmanager"
5-
"github.com/devstream-io/devstream/internal/pkg/plugin/gitlabci/java"
5+
"github.com/devstream-io/devstream/internal/pkg/plugin/gitlabci"
66
"github.com/devstream-io/devstream/internal/pkg/statemanager"
77
"github.com/devstream-io/devstream/pkg/util/log"
88
)
99

1010
// NAME is the name of this DevStream plugin.
11-
const NAME = "gitlabci-java"
11+
const NAME = "gitlab-ci"
1212

1313
// Plugin is the type used by DevStream core. It's a string.
1414
type Plugin string
1515

16-
// Create implements the create of gitlabci-java.
16+
// Create implements the create of gitlab-ci.
1717
func (p Plugin) Create(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
18-
return java.Create(options)
18+
return gitlabci.Create(options)
1919
}
2020

21-
// Update implements the update of gitlabci-java.
21+
// Update implements the update of gitlab-ci.
2222
func (p Plugin) Update(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
23-
return java.Update(options)
23+
return gitlabci.Update(options)
2424
}
2525

26-
// Delete implements the delete of gitlabci-java.
26+
// Delete implements the delete of gitlab-ci.
2727
func (p Plugin) Delete(options configmanager.RawOptions) (bool, error) {
28-
return java.Delete(options)
28+
return gitlabci.Delete(options)
2929
}
3030

31-
// Read implements the read of gitlabci-java.
31+
// Read implements the read of gitlab-ci.
3232
func (p Plugin) Read(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
33-
return java.Read(options)
33+
return gitlabci.Read(options)
3434
}
3535

3636
// DevStreamPlugin is the exported variable used by the DevStream core.

cmd/plugin/gitlabci-generic/main.go

Lines changed: 0 additions & 41 deletions
This file was deleted.

cmd/plugin/gitlabci-golang/main.go

Lines changed: 0 additions & 41 deletions
This file was deleted.

docs/plugins/github-actions.zh.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@ _该插件运行依赖以下环境变量:_
1212

1313
- [创建个人访问 token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)
1414

15-
_如果你需要推送镜像到仓库,请配置以下环境变量:_
16-
17-
- IMAGE_REPO_PASSWORD: 该变量表示登陆仓库的密码
18-
1915
下面的内容是一个示例配置文件用于创建 Github Workflows:
2016

2117
``` yaml
2218
--8<-- "github-actions.yaml"
2319
```
20+
21+
该插件的 `pipeline` 选项具体配置可查询[pipline配置项](pipeline.zh.md)
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# gitlabci-generic Plugin
1+
# gitlab-ci Plugin
22

3-
This plugin creates Golang GitLab CI workflow.
3+
This plugin creates GitLab CI workflow.
44

55
It downloads a template of your choice, render it with provided parameters, and creates a GitLab CI file to your repo.
66

@@ -21,9 +21,9 @@ For more information on the main config, the tool file and the var file of DevSt
2121
Plugin config example:
2222

2323
```yaml
24-
--8<-- "gitlabci-generic.yaml"
24+
--8<-- "gitlab-ci.yaml"
2525
```
2626

27-
Or, run `dtm show config --plugin=gitlabci-generic` to get the default config.
27+
Or, run `dtm show config --plugin=gitlab-ci` to get the default config.
2828

2929
All parameters are mandatory.

docs/plugins/gitlab-ci.zh.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# gitlab-ci 插件
2+
3+
_该插件用于在使用 gitlab 的项目仓库中创建 Gitlab CI 并运行对应项目的 gitlab runner_
4+
5+
## 用例
6+
7+
_该插件运行依赖以下环境变量:_
8+
9+
- GITLAB_TOKEN
10+
11+
请在使用插件前配置该环境变量。如果你不知道如何创建这个 TOKEN,可以查看以下文档:
12+
13+
- 如果你使用的是官方提供的仓库(非自搭建的 `Gitlab`),可以查看该[链接](https://gitlab.com/-/profile/personal_access_tokens?name=DevStream+Access+token&scopes=api) 来创建一个用于 Devstream 的 token。
14+
- 如果你使用自搭建的 `Gitlab` 仓库,可以查看该[链接](https://gitlab.com/-/profile/personal_access_tokens?name=DevStream+Access+token&scopes=api)来创建一个用于 Devstream 的 token。
15+
16+
### 配置项
17+
下面的内容是一个示例配置文件用于创建 Gitlab CI:
18+
19+
``` yaml
20+
--8<-- "gitlab-ci.yaml"
21+
```
22+
23+
该插件的 `pipeline` 选项具体配置可查询[pipline配置项](pipeline.zh.md)

docs/plugins/gitlabci-generic.zh.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/plugins/gitlabci-golang.md

Lines changed: 0 additions & 25 deletions
This file was deleted.

docs/plugins/gitlabci-golang.zh.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)