Skip to content

Commit b18fac6

Browse files
authored
Merge pull request #1370 from devstream-io/main
bugfix for v0.10.3
2 parents 17ddd2c + e15442c commit b18fac6

Some content is hidden

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

54 files changed

+724
-1069
lines changed

.github/ISSUE_TEMPLATE/bug-report.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ body:
2828
label: 'DevStream Version'
2929
description: "To find out the version run: `dtm version`"
3030
options:
31-
- < v0.10.0
32-
- v0.10.0
31+
- < v0.10.3
32+
- v0.10.3
3333
- latest
3434
validations:
3535
required: true

.github/sync-staging-repo.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
devstream-io/dtm-gitlab-share-library:
2-
- source: staging/dtm-gitlab-share-library/
1+
devstream-io/dtm-jenkins-share-library:
2+
- source: staging/dtm-jenkins-share-library/
33
dest: .
44
deleteOrphaned: true
55
devstream-io/dtm-pipeline-templates:

.github/workflows/automated-release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ jobs:
4141
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
4242
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
4343
aws-region: ap-southeast-1
44+
- name: check md5 & commit
45+
run: git rev-parse HEAD && md5sum dtm*
4446
- name: upload core
4547
run: bash -e ./hack/release/upload_dtm_core.sh ${{ secrets.GITHUB_TOKEN }} ${{ env.TAG }} ${{ env.GOOS }} ${{ env.GOARCH }}
4648
- name: upload plugin
@@ -83,4 +85,3 @@ jobs:
8385
run: bash -e ./hack/release/upload_dtm_core.sh ${{ secrets.GITHUB_TOKEN }} ${{ env.TAG }} ${{ env.GOOS }} ${{ env.GOARCH }}
8486
- name: upload plugins to s3
8587
run: aws s3 cp ~/.devstream/plugins/ s3://download.devstream.io/${{ env.TAG }}/ --recursive --acl public-read
86-

cmd/devstream/init.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,18 @@ func GetPluginsFromFlags() (tools configmanager.Tools, err error) {
9191
// check if plugins to download are supported by dtm
9292
for _, plugin := range pluginsName {
9393
if _, ok := list.PluginNamesMap()[plugin]; !ok {
94-
return nil, fmt.Errorf("Plugin %s is not supported by dtm", plugin)
94+
return nil, fmt.Errorf("plugin %s is not supported by dtm", plugin)
9595
}
9696
}
9797
}
9898

9999
if len(pluginsName) == 0 {
100-
return nil, errors.New("Please use --plugins to specify plugins to download or use --all to download all plugins.")
100+
return nil, errors.New("please use --plugins to specify plugins to download or use --all to download all plugins")
101101
}
102102
log.Debugf("plugins to download: %v", pluginsName)
103103

104104
if initOS == "" || initArch == "" {
105-
return nil, fmt.Errorf("Once you use the --all flag, you must specify the --os and --arch flags")
105+
return nil, fmt.Errorf("once you use the --all flag, you must specify the --os and --arch flags")
106106
}
107107

108108
log.Infof("Plugins to download: %v", pluginsName)

hack/release/auto-release-darwin-arm64.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pip3 install awscli
7373
aws s3 cp $plugin_dir $STORAGE_URL_WITH_TAG --recursive --acl public-read
7474

7575
# check if the number of plugins on s3 is correct
76-
local_plugin_nums=$(../../dtm list plugins |wc -l)
76+
local_plugin_nums=$(./dtm list plugins |wc -l)
7777
((local_plugin_file_nums=local_plugin_nums*6))
7878
s3_plugin_file_total_nums=$(aws s3 ls download.devstream.io/"$tag"/|awk '{print $NF}'|uniq|wc -l)
7979
((s3_plugin_file_nums=s3_plugin_file_total_nums-3))

internal/pkg/configmanager/pipelineDefault.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,15 @@ func pipelineArgocdAppGenerator(options RawOptions, globalVars *pipelineGlobalOp
8383
sourceMap := source.(RawOptions)
8484
if _, repoURLExist := sourceMap["repoURL"]; !repoURLExist {
8585
sourceMap["repoURL"] = globalVars.Repo.GetCloneURL()
86+
sourceMap["repoBranch"] = globalVars.Repo.Branch
8687
}
8788
options["source"] = sourceMap
8889
} else {
8990
options["source"] = RawOptions{
90-
"valuefile": "values.yaml",
91-
"path": fmt.Sprintf("helm/%s", globalVars.AppName),
92-
"repoURL": string(globalVars.Repo.GetCloneURL()),
91+
"valuefile": "values.yaml",
92+
"path": fmt.Sprintf("helm/%s", globalVars.AppName),
93+
"repoURL": string(globalVars.Repo.GetCloneURL()),
94+
"repoBranch": globalVars.Repo.Branch,
9395
}
9496
}
9597
// config imageRepo default options

internal/pkg/configmanager/pipelineDefault_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ var _ = Describe("pipelineArgocdAppGenerator func", func() {
6969
},
7070
Repo: &git.RepoInfo{
7171
CloneURL: "scm.test.com",
72+
Branch: "testBranch",
7273
},
7374
AppName: "test_app",
7475
}
@@ -85,9 +86,10 @@ var _ = Describe("pipelineArgocdAppGenerator func", func() {
8586
"namespace": "default",
8687
},
8788
"source": RawOptions{
88-
"valuefile": "values.yaml",
89-
"path": "helm/test_app",
90-
"repoURL": "https://scm.test.com",
89+
"valuefile": "values.yaml",
90+
"path": "helm/test_app",
91+
"repoURL": "https://scm.test.com",
92+
"repoBranch": "testBranch",
9193
},
9294
"imageRepo": RawOptions{
9395
"owner": "test_user",

internal/pkg/configmanager/variables.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@ import (
88
func renderConfigWithVariables(fileContent string, variables map[string]interface{}) ([]byte, error) {
99
logFunc(fileContent, variables)
1010

11-
str, err := template.New().
12-
FromContent(fileContent).
13-
AddDotForVariablesInConfigProcessor().
14-
AddQuoteForVariablesInConfigProcessor().
15-
SetDefaultRender(fileContent, variables).
16-
Render()
11+
str, err := template.NewRenderClient(&template.TemplateOption{
12+
Name: "configmanager",
13+
}, template.ContentGetter, template.AddDotForVariablesInConfigProcessor, template.AddQuoteForVariablesInConfigProcessor,
14+
).Render(fileContent, variables)
1715

1816
if err != nil {
1917
return nil, err

internal/pkg/develop/plugin/plugin.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,12 @@ func (p *Plugin) renderTplString(tplStr string) (string, error) {
7979
"dirFormat": pluginTpl.FormatPackageDirName,
8080
}
8181

82-
res, err := templateUtil.New().FromContent(tplStr).SetDefaultRender("default", *p, funcMap).Render()
82+
res, err := templateUtil.NewRenderClient(
83+
&templateUtil.TemplateOption{
84+
Name: "plugins",
85+
FuncMap: funcMap,
86+
}, templateUtil.ContentGetter,
87+
).Render(tplStr, *p)
8388
if err != nil {
8489
log.Debugf("Template execute failed: %s.", err)
8590
log.Debugf("Template content: %s.", tplStr)

internal/pkg/plugin/argocdapp/argocdapp.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ func pushArgocdConfigFiles(rawOptions configmanager.RawOptions) error {
2222
}
2323

2424
// 1. init scm client for check argocdapp config exists and push argocdapp files
25-
repoInfo := &git.RepoInfo{CloneURL: git.ScmURL(opts.Source.RepoURL)}
25+
repoInfo := &git.RepoInfo{
26+
CloneURL: git.ScmURL(opts.Source.RepoURL),
27+
Branch: opts.Source.RepoBranch,
28+
}
2629
scmClient, err := scm.NewClientWithAuth(repoInfo)
2730
if err != nil {
2831
return err

0 commit comments

Comments
 (0)