Skip to content

Commit 4923b75

Browse files
authored
fix file:// validation bug (#1992)
1 parent dc75805 commit 4923b75

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Fix 'file://' prefix validation bug

framework/components/dockercompose/chip_ingress_set/chip_ingress.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ func New(in *Input) (*Output, error) {
167167
return nil, errors.Wrap(chipIngressExternalHostErr, "failed to get host for Chip Ingress")
168168
}
169169
// for some magical reason mapped port sometimes cannot be found, even though we wait for it to be ready, when starting the services
170-
chipIngressExternalPort, chipIngressExternalPortErr := findMappdePort(ctx, 20*time.Second, chipIngressContainer, DEFAULT_CHIP_INGRESS_GRPC_PORT)
170+
chipIngressExternalPort, chipIngressExternalPortErr := findMappdePort(ctx, 31*time.Second, chipIngressContainer, DEFAULT_CHIP_INGRESS_GRPC_PORT)
171171
if chipIngressExternalPortErr != nil {
172172
return nil, errors.Wrap(chipIngressExternalPortErr, "failed to get mapped port for Chip Ingress")
173173
}
@@ -181,11 +181,11 @@ func New(in *Input) (*Output, error) {
181181
if redpandaExternalHostErr != nil {
182182
return nil, errors.Wrap(redpandaExternalHostErr, "failed to get host for Red Panda")
183183
}
184-
redpandaExternalKafkaPort, redpandaExternalKafkaPortErr := findMappdePort(ctx, 20*time.Second, redpandaContainer, DEFAULT_RED_PANDA_KAFKA_PORT)
184+
redpandaExternalKafkaPort, redpandaExternalKafkaPortErr := findMappdePort(ctx, 31*time.Second, redpandaContainer, DEFAULT_RED_PANDA_KAFKA_PORT)
185185
if redpandaExternalKafkaPortErr != nil {
186186
return nil, errors.Wrap(redpandaExternalKafkaPortErr, "failed to get mapped port for Red Panda")
187187
}
188-
redpandaExternalSchemaRegistryPort, redpandaExternalSchemaRegistryPortErr := findMappdePort(ctx, 20*time.Second, redpandaContainer, DEFAULT_RED_PANDA_SCHEMA_REGISTRY_PORT)
188+
redpandaExternalSchemaRegistryPort, redpandaExternalSchemaRegistryPortErr := findMappdePort(ctx, 31*time.Second, redpandaContainer, DEFAULT_RED_PANDA_SCHEMA_REGISTRY_PORT)
189189
if redpandaExternalSchemaRegistryPortErr != nil {
190190
return nil, errors.Wrap(redpandaExternalSchemaRegistryPortErr, "failed to get mapped port for Red Panda")
191191
}
@@ -198,7 +198,7 @@ func New(in *Input) (*Output, error) {
198198
if redpandaExternalConsoleHostErr != nil {
199199
return nil, errors.Wrap(redpandaExternalConsoleHostErr, "failed to get host for Red Panda Console")
200200
}
201-
redpandaExternalConsolePort, redpandaExternalConsolePortErr := findMappdePort(ctx, 20*time.Second, redpandaConsoleContainer, DEFAULT_RED_PANDA_CONSOLE_PORT)
201+
redpandaExternalConsolePort, redpandaExternalConsolePortErr := findMappdePort(ctx, 31*time.Second, redpandaConsoleContainer, DEFAULT_RED_PANDA_CONSOLE_PORT)
202202
if redpandaExternalConsolePortErr != nil {
203203
return nil, errors.Wrap(redpandaExternalConsolePortErr, "failed to get mapped port for Red Panda Console")
204204
}

framework/components/dockercompose/chip_ingress_set/protos.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ func validateRepoConfiguration(repoConfig ProtoSchemaSet) error {
4545
return errors.New("uri has to start with either 'file://' or 'https://'")
4646
}
4747

48+
if strings.HasPrefix(repoConfig.URI, "file://") {
49+
if repoConfig.Ref != "" {
50+
return errors.New("ref is not supported with local protos with 'file://' prefix")
51+
}
52+
53+
return nil
54+
}
55+
4856
trimmedURI := strings.TrimPrefix(repoConfig.URI, "https://")
4957
if !strings.HasPrefix(trimmedURI, "github.com") {
5058
return fmt.Errorf("only repositories hosted at github.com are supported, but %s was found", repoConfig.URI)
@@ -55,12 +63,8 @@ func validateRepoConfiguration(repoConfig ProtoSchemaSet) error {
5563
return fmt.Errorf("URI should have following format: 'https://github.com/<OWNER>/<REPOSITORY>', but %s was found", repoConfig.URI)
5664
}
5765

58-
if repoConfig.Ref == "" && strings.HasPrefix(repoConfig.URI, "https://") {
59-
return errors.New("ref is required, when fetching protos from Github")
60-
}
61-
62-
if repoConfig.Ref != "" && strings.HasPrefix(repoConfig.URI, "file://") {
63-
return errors.New("ref is not supported with local protos")
66+
if repoConfig.Ref == "" {
67+
return errors.New("ref is required, when fetching protos from Github repository")
6468
}
6569

6670
return nil

0 commit comments

Comments
 (0)