Skip to content

Commit 54bacbd

Browse files
author
Tiexin Guo
committed
Merge branch 'main' into release-0.6
2 parents 6c08a2c + 3813862 commit 54bacbd

File tree

21 files changed

+138
-25
lines changed

21 files changed

+138
-25
lines changed

Diff for: .github/workflows/automated-release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
- name: upload core
4646
run: bash -e ./hack/release/upload_assets.sh ${{ secrets.GITHUB_TOKEN }} ${{ env.TAG }} ${{ env.GOOS }} ${{ env.GOARCH }}
4747
- name: upload plugin
48-
run: aws s3 cp .devstream/ s3://download.devstream.io/${{ env.TAG }}/ --recursive --acl public-read
48+
run: aws s3 cp .devstream/ s3://download.devstream.io/${{ env.TAG }}/ --recursive --acl public-read
4949

5050
# release for darwin-amd64
5151
build-and-release-on-darwin-amd64:

Diff for: .github/workflows/e2e-test.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,19 @@ jobs:
6363
aws eks update-kubeconfig --region ap-southeast-1 --name dtm-test
6464
- name: copy config files
6565
run: cp ./test/e2e/yaml/e2e-*.yaml ./
66-
- name: apply
66+
- name: apply git-ops
6767
run: ./dtm apply -f e2e-config.yaml -y
68-
- name: apply twice
68+
- name: apply twice git-ops
6969
run: ./dtm apply -f e2e-config.yaml -y
70+
- name: apply trello-github
71+
run: ./dtm apply -f e2e-trello-github-config.yaml -y
72+
- name: apply twice trello-github
73+
run: ./dtm apply -f e2e-trello-github-config.yaml -y
7074
- name: check if pod is ready
7175
run: while [[ $(kubectl get pods -l app=dtm-e2e-go -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" ]]; do echo "pod not ready yet..."; sleep 3; done
7276
timeout-minutes: 10
7377
- name: verify
7478
run: ./dtm verify -f e2e-config.yaml
7579
- name: clean
7680
run: ./dtm delete -f e2e-config.yaml -y
81+

Diff for: Makefile

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ ROOT_DIR := $(abspath $(shell cd $(SELF_DIR) && pwd -P))
2424
endif
2525

2626
ifeq ($(origin VERSION), undefined)
27-
VERSION := $(shell git describe --tags --always --match='v*')
27+
# the VERSION is a number, like 0.6.0
28+
# it doesn't contain the prefix v, not v0.6.0, but 0.6.0
29+
VERSION := $(shell git describe --tags --always --match='v*' | cut -c 2-)
2830
endif
2931

3032
ifeq ($(origin PLUGINS_DIR),undefined)

Diff for: cmd/devstream/list/list.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414

1515
var PluginsName string
1616

17-
// List all of plugins name
17+
// List all plugins name
1818
func List(pluginFilter string) {
1919
listPluginsName := strings.Fields(PluginsName)
2020
r, _ := regexp.Compile(pluginFilter)

Diff for: docs/development/creating-a-plugin.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ DevStream uses [go plugin](https://pkg.go.dev/plugin) to implement custom DevOps
5353

5454
When you execute a command which calls any of the interfaces(`Create`, `Read`, `Update`, `Delete`), devstream's pluginengine will call the [`plugin.Lookup("DevStreamPlugin")` function](https://github.com/devstream-io/devstream/blob/38307894bbc08f691b2c5015366d9e45cc87970c/internal/pkg/pluginengine/plugin_helper.go#L28) to load the plugin, get the variable `DevStreamPlugin` that implements the ` DevStreamPlugin` interface, and then you can call the corresponding plugin logic functions. This is why it is not recommended to modify the `/cmd/plugin/YOUR-PLUGIN-NAME/main.go` file directly.
5555

56-
Note: The `main()` in `/cmd/plugin/YOUR-PLUGIN-NAME/main.go` file will not executed, it is only used to avoid the goclangci-lint error.
56+
Note: The `main()` in `/cmd/plugin/YOUR-PLUGIN-NAME/main.go` file will not be executed, it is only used to avoid the goclangci-lint error.

Diff for: docs/quickstart_en.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ For Linux/Macos users:
1515

1616
## 2 Prepare a Config File
1717

18-
Before you start: for an example of DevStream config, see [examples/tools-quickstart.yaml](./examples/tools-quickstart.yaml). Remember to open this configuration file, modify all FULL_UPPER_CASE_STRINGS (like YOUR_GITHUB_USERNAME, for example) in it to your own. Pay attention to the meaning of each item to ensure that it is what you want. For other plugins, checkout the "Plugins" section in our [doc](https://docs.devstream.io) for detailed usage.
18+
Before you start: for an example of DevStream config, see [examples/tools-quickstart.yaml](https://github.com/devstream-io/devstream/blob/main/examples/tools-quickstart.yaml). Remember to open this configuration file, modify all FULL_UPPER_CASE_STRINGS (like YOUR_GITHUB_USERNAME, for example) in it to your own. Pay attention to the meaning of each item to ensure that it is what you want. For other plugins, checkout the "Plugins" section in our [doc](https://docs.devstream.io) for detailed usage.
1919

2020
Download the [examples/quickstart.yaml](https://raw.githubusercontent.com/devstream-io/devstream/main/examples/quickstart.yaml) and [examples/tools-quickstart.yaml](https://raw.githubusercontent.com/devstream-io/devstream/main/examples/tools-quickstart.yaml) to your working directory and rename `quickstart.yaml` to `config.yaml`:
2121

Diff for: docs/quickstart_zh.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
1313
## 2 准备一个配置文件
1414

15-
开始之前:这是一个DevStream配置的例子:[examples/tools-quickstart.yaml](../examples/tools-quickstart.yaml)。记得打开这个配置文件,把里面所有的 `FULL_UPPER_CASE_STRINGS`(比如说 `YOUR_GITHUB_USERNAME` )修改成你自己的。注意每一项的含义,并确保它是你要的。对于其他插件,请查看我们的 [文档](https://docs.devstream.io) 中的"插件"部分,以了解详细用法。
15+
开始之前:这是一个DevStream配置的例子:[examples/tools-quickstart.yaml](https://github.com/devstream-io/devstream/blob/main/examples/tools-quickstart.yaml) 。记得打开这个配置文件,把里面所有的 `FULL_UPPER_CASE_STRINGS`(比如说 `YOUR_GITHUB_USERNAME` )修改成你自己的。注意每一项的含义,并确保它是你要的。对于其他插件,请查看我们的 [文档](https://docs.devstream.io) 中的"插件"部分,以了解详细用法。
1616

1717
[examples/quickstart.yaml](https://raw.githubusercontent.com/devstream-io/devstream/main/examples/quickstart.yaml)[examples/tools-quickstart.yaml](https://raw.githubusercontent.com/devstream-io/devstream/main/examples/tools-quickstart.yaml) 文件下载到你到工作目录下,然后重命名`quickstart.yaml``config.yaml`
1818

Diff for: hack/release/auto-release-darwin-arm64.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ while getopts "t:" opt; do
1818
done
1919

2020
if [ "${tag}" == "invalid" ]; then
21-
echo "Maybe you forgot to use -t flag. E.g. sh auto-release-darwin-arm64.sh -t v0.6.0"
21+
echo "Maybe you forgot to use -t flag. E.g. sh auto-release-darwin-arm64.sh -t 0.6.0"
2222
exit 1
2323
fi
2424
echo "tag: ${tag}"

Diff for: hack/terraform/bucket-policy.tf

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
resource "aws_s3_bucket_policy" "policy_iterable" {
2+
bucket = "download.devstream.io"
3+
policy = jsonencode({
4+
"Version" : "2012-10-17",
5+
"Statement" : [
6+
{
7+
"Sid" : "PublicReadGetObjectOnlyForCloudFlareIps111",
8+
"Effect" : "Deny",
9+
"Principal" : "*",
10+
"Action" : "s3:GetObject",
11+
"Resource" : [
12+
"arn:aws:s3:::download.devstream.io",
13+
"arn:aws:s3:::download.devstream.io/*"
14+
],
15+
"Condition" : {
16+
"NotIpAddress" : {
17+
"aws:SourceIp" : [
18+
"2400:cb00::/32",
19+
"2606:4700::/32",
20+
"2803:f800::/32",
21+
"2405:b500::/32",
22+
"2405:8100::/32",
23+
"2a06:98c0::/29",
24+
"2c0f:f248::/32",
25+
"173.245.48.0/20",
26+
"103.21.244.0/22",
27+
"103.22.200.0/22",
28+
"103.31.4.0/22",
29+
"141.101.64.0/18",
30+
"108.162.192.0/18",
31+
"190.93.240.0/20",
32+
"188.114.96.0/20",
33+
"197.234.240.0/22",
34+
"198.41.128.0/17",
35+
"162.158.0.0/15",
36+
"104.16.0.0/13",
37+
"104.24.0.0/14",
38+
"172.64.0.0/13",
39+
"131.0.72.0/22"
40+
]
41+
}
42+
}
43+
}
44+
]
45+
})
46+
}

Diff for: hack/terraform/devstream-iam.tf

+2
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ resource "aws_iam_group_policy" "DevStream-Download-Bucket-RW-Policy" {
141141
"Effect": "Allow",
142142
"Action": [
143143
"s3:GetObject",
144+
"s3:GetObjectAcl",
144145
"s3:PutObject",
146+
"s3:PutObjectAcl",
145147
"s3:DeleteObject",
146148
"s3:RestoreObject",
147149
"s3:ListBucket",

Diff for: hack/terraform/github-actions-iam.tf

+33
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,39 @@ resource "aws_iam_user_policy" "githubactions" {
1919
policy = data.aws_iam_policy_document.githubactions.json
2020
}
2121

22+
resource "aws_iam_user_policy" "GitHubActions-Download-Bucket-RW-Policy" {
23+
name = "GitHubActions-Download-Bucket-RW-Policy"
24+
user = aws_iam_user.githubactions.name
25+
26+
policy = jsonencode({
27+
"Version": "2012-10-17",
28+
"Statement": [
29+
{
30+
"Sid": "PermissionForDownloadUploadForTheBucket",
31+
"Effect": "Allow",
32+
"Action": [
33+
"s3:GetObject",
34+
"s3:GetObjectAcl",
35+
"s3:PutObject",
36+
"s3:PutObjectAcl",
37+
"s3:DeleteObject",
38+
"s3:RestoreObject",
39+
"s3:ListBucket",
40+
"s3:GetBucketPolicy",
41+
"s3:ReplicateObject",
42+
"s3:GetBucketWebsite",
43+
"s3:PutBucketWebsite",
44+
"s3:GetBucketCORS",
45+
],
46+
"Resource": [
47+
"arn:aws:s3:::download.devstream.io",
48+
"arn:aws:s3:::download.devstream.io/*"
49+
]
50+
}
51+
]
52+
})
53+
}
54+
2255
resource "aws_iam_access_key" "githubactions" {
2356
user = aws_iam_user.githubactions.name
2457
}

Diff for: internal/pkg/backend/backend.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ const (
1818

1919
// Backend is used to persist data, it can be local file/etcd/s3/...
2020
type Backend interface {
21-
// Read is used to reads data from persistent storage.
21+
// Read is used to read data from persistent storage.
2222
Read() ([]byte, error)
23-
// Write is used to writes data to persistent storage.
23+
// Write is used to write data to persistent storage.
2424
Write(data []byte) error
2525
}
2626

Diff for: internal/pkg/backend/local/local.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func (l *Local) Read() ([]byte, error) {
5252
return data, nil
5353
}
5454

55-
// Write is used to writes the data to local file.
55+
// Write is used to write the data to local file.
5656
func (l *Local) Write(data []byte) error {
5757
l.mu.Lock()
5858
defer l.mu.Unlock()

Diff for: internal/pkg/configloader/validation.go

-4
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,6 @@ func validateDependency(tools []Tool) []error {
8282
func validateConfigFile(c *ConfigFile) []error {
8383
errors := make([]error, 0)
8484

85-
if c.VarFile == "" {
86-
errors = append(errors, fmt.Errorf("variables file is empty"))
87-
}
88-
8985
if c.ToolFile == "" {
9086
errors = append(errors, fmt.Errorf("tool file is empty"))
9187
}

Diff for: internal/pkg/configloader/variables.go

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import (
1212
)
1313

1414
func renderVariables(varFileName string, configFileBytes []byte) ([]byte, error) {
15+
if varFileName == "" {
16+
return configFileBytes, nil
17+
}
1518
// load variables file
1619
variables, err := loadVariablesFilesIntoMap(varFileName)
1720
if err != nil {

Diff for: internal/pkg/plugin/githubactions/golang/jobs.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ const (
99
RegistryHarbor RegistryType = "harbor"
1010
)
1111

12-
// Build is the struct for githubacions job.
12+
// Build is the struct for githubactions job.
1313
type Build struct {
1414
Enable bool
1515
Command string
1616
}
1717

18-
// Test is the struct for githubacions job.
18+
// Test is the struct for githubactions job.
1919
type Test struct {
2020
Enable bool
2121
Command string
2222
Coverage Coverage
2323
}
2424

25-
// Docker is the struct for githubacions job.
25+
// Docker is the struct for githubactions job.
2626
type Docker struct {
2727
Enable bool
2828
Registry Registry
@@ -35,18 +35,18 @@ type Registry struct {
3535
Repository string
3636
}
3737

38-
// Coverage is the struct for githubacions job.
38+
// Coverage is the struct for githubactions job.
3939
type Coverage struct {
4040
Enable bool
4141
Profile string
4242
Output string
4343
}
4444

45-
// Tag is the struct for githubacions job.
45+
// Tag is the struct for githubactions job.
4646
type Tag struct {
4747
}
4848

49-
// Image is the struct for githubacions job.
49+
// Image is the struct for githubactions job.
5050
type Image struct {
5151
}
5252

Diff for: internal/pkg/pluginengine/change.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ const (
3838
)
3939

4040
// GetChangesForApply takes "State Manager" & "Config" then do some calculate and return a Plan.
41-
// All actions should be execute is included in this Plan.changes.
41+
// All actions should be executed is included in this Plan.changes.
4242
func GetChangesForApply(smgr statemanager.Manager, cfg *configloader.Config) ([]*Change, error) {
4343
return getChanges(smgr, cfg, CommandApply, false)
4444
}
4545

4646
// GetChangesForDelete takes "State Manager" & "Config" then do some calculation and return a Plan to delete all plugins in the Config.
47-
// All actions should be execute is included in this Plan.changes.
47+
// All actions should be executed is included in this Plan.changes.
4848
func GetChangesForDelete(smgr statemanager.Manager, cfg *configloader.Config, isForceDelete bool) ([]*Change, error) {
4949
return getChanges(smgr, cfg, CommandDelete, isForceDelete)
5050
}

Diff for: internal/pkg/pluginengine/outputs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func HandleOutputsReferences(smgr statemanager.Manager, options map[string]inter
4343
}
4444

4545
// getToolNamePluginKindAndOutputReferenceKey returns (false, "", "", "") if regex doesn't match
46-
// if match, returns (true, name, instanceID, key)
46+
// if matched, returns (true, name, instanceID, key)
4747
func getToolNamePluginOutputKey(s string) (bool, string, string, string) {
4848
regex := `.*\${{\s*([^.]*)\.([^.]*)\.outputs\.([^.\s]*)\s*}}.*`
4949
r := regexp.MustCompile(regex)

Diff for: test/e2e/yaml/e2e-trello-github-config.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
varFile: e2e-variables.yaml
2+
toolFile: e2e-trello-github-tools.yaml
3+
state:
4+
backend: local
5+
options:
6+
stateFile: devstream.state

Diff for: test/e2e/yaml/e2e-trello-github-tools.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
tools:
2+
- name: trello
3+
instanceID: default
4+
dependsOn: [ ]
5+
options:
6+
org: [[ githubOrganization ]]
7+
repo: [[ RepoName ]]
8+
kanbanBoardName: [[ kanbanBoardName ]]
9+
- name: trello-github-integ
10+
instanceID: default
11+
dependsOn: [ "trello.default" ]
12+
options:
13+
org: [[ githubOrganization ]]
14+
repo: [[ RepoName ]]
15+
boardId: ${{ trello.default.outputs.boardId }}
16+
todoListId: ${{ trello.default.outputs.todoListId }}
17+
doingListId: ${{ trello.default.outputs.doingListId }}
18+
doneListId: ${{ trello.default.outputs.doneListId }}
19+
branch: main

Diff for: test/e2e/yaml/e2e-variables.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ repoName: dtm-e2e-go
44
dockerRegistryUserName: dtme2etest
55
argocdNameSpace: argocd
66
argocdDeployTimeout: 10m
7+
kanbanBoardName: dtmKanbanTest

0 commit comments

Comments
 (0)