Skip to content

Commit 7f9a3ba

Browse files
authored
fix: Validate versions only for github registry (#188)
#### Summary <!-- 🎉 Thank you for making CloudQuery awesome by submitting a PR 🎉 --> <!-- Explain what problem this PR addresses --> --- Use the following steps to ensure your PR is ready to be reviewed - [ ] Read the [contribution guidelines](../blob/main/CONTRIBUTING.md) 🧑‍🎓 - [ ] Run `go fmt` to format your code 🖊 - [ ] Lint your changes via `golangci-lint run` 🚨 (install golangci-lint [here](https://golangci-lint.run/usage/install/#local-installation)) - [ ] Update or add tests 🧪 - [ ] Ensure the status checks below are successful ✅
1 parent 8e28bd1 commit 7f9a3ba

2 files changed

Lines changed: 18 additions & 10 deletions

File tree

specs/destination.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,16 @@ func (d *Destination) Validate() error {
5050
if d.Name == "" {
5151
return fmt.Errorf("name is required")
5252
}
53-
if d.Version == "" {
54-
return fmt.Errorf("version is required")
55-
}
56-
if !strings.HasPrefix(d.Version, "v") {
57-
return fmt.Errorf("version must start with v")
53+
54+
if d.Registry == RegistryGithub {
55+
if d.Version == "" {
56+
return fmt.Errorf("version is required")
57+
}
58+
if !strings.HasPrefix(d.Version, "v") {
59+
return fmt.Errorf("version must start with v")
60+
}
5861
}
62+
5963
return nil
6064
}
6165

specs/source.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,16 @@ func (s *Source) Validate() error {
6464
if s.Name == "" {
6565
return fmt.Errorf("name is required")
6666
}
67-
if s.Version == "" {
68-
return fmt.Errorf("version is required")
69-
}
70-
if !strings.HasPrefix(s.Version, "v") {
71-
return fmt.Errorf("version must start with v")
67+
68+
if s.Registry == RegistryGithub {
69+
if s.Version == "" {
70+
return fmt.Errorf("version is required")
71+
}
72+
if !strings.HasPrefix(s.Version, "v") {
73+
return fmt.Errorf("version must start with v")
74+
}
7275
}
76+
7377
if len(s.Destinations) == 0 {
7478
return fmt.Errorf("at least one destination is required")
7579
}

0 commit comments

Comments
 (0)