Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cdsctl,api): allow to push a template from url #3810

Merged
merged 5 commits into from
Jan 4, 2019

Conversation

richardlt
Copy link
Member

@richardlt richardlt commented Jan 3, 2019

  1. Description
  2. Related issues
  3. About tests
  4. Mentions

@ovh/cds

@@ -63,8 +62,7 @@ func environmentGroupImportRun(v cli.Values) error {
format = "json"
}

isURL, _ := regexp.MatchString(`http[s]?:\/\/(.*)`, v["path"])
if isURL {
if exportentities.IsURL(v["path"]) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v.GetString

@@ -63,8 +62,7 @@ func environmentGroupImportRun(v cli.Values) error {
format = "json"
}

isURL, _ := regexp.MatchString(`http[s]?:\/\/(.*)`, v["path"])
if isURL {
if exportentities.IsURL(v["path"]) {
var err error
reader, _, err = exportentities.OpenURL(v["path"], format)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v.GetString

@@ -130,8 +129,7 @@ func pipelineImportRun(v cli.Values) error {
format = "json"
}

isURL, _ := regexp.MatchString(`http[s]?:\/\/(.*)`, v["path"])
if isURL {
if exportentities.IsURL(v["path"]) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v.GetString

@@ -64,8 +63,7 @@ func pipelineGroupImportRun(v cli.Values) error {
format = "json"
}

isURL, _ := regexp.MatchString(`http[s]?:\/\/(.*)`, v["path"])
if isURL {
if exportentities.IsURL(v["path"]) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v.GetString

@@ -62,8 +61,7 @@ func projectGroupImportRun(v cli.Values) error {
format = "json"
}

isURL, _ := regexp.MatchString(`http[s]?:\/\/(.*)`, v["path"])
if isURL {
if exportentities.IsURL(v["path"]) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v.GetString

}
buf := new(bytes.Buffer)
if _, err := buf.ReadFrom(contentFile); err != nil {
return fmt.Errorf("Cannot read from given remote file: %v", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error strings should not start with a capital letter because they'll often be prefixed before printing:

https://github.com/golang/go/wiki/Errors

}
var t exportentities.Template
if err := yaml.Unmarshal(buf.Bytes(), &t); err != nil {
return fmt.Errorf("Cannot unmarshal given remote yaml file: %v", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error strings should not start with a capital letter because they'll often be prefixed before printing:

https://github.com/golang/go/wiki/Errors

for _, file := range files {
fi, err := os.Lstat(file)
if err != nil {
fmt.Printf("Skipping file %s: %v\n", file, err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error strings should not start with a capital letter because they'll often be prefixed before printing:

https://github.com/golang/go/wiki/Errors

@yesnault yesnault merged commit ebfc9eb into master Jan 4, 2019
@richardlt richardlt deleted the feat-template-push-from-url branch January 9, 2019 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants