@@ -2,6 +2,7 @@ package gitreceive
22
33import (
44 "strings"
5+ "time"
56)
67
78type Config struct {
@@ -11,15 +12,19 @@ type Config struct {
1112 RegistryHost string `envconfig:"DEIS_REGISTRY_SERVICE_HOST" required:"true"`
1213 RegistryPort string `envconfig:"DEIS_REGISTRY_SERVICE_PORT" required:"true"`
1314
14- GitHome string `envconfig:"GIT_HOME" required:"true"`
15- SSHConnection string `envconfig:"SSH_CONNECTION" required:"true"`
16- SSHOriginalCommand string `envconfig:"SSH_ORIGINAL_COMMAND" required:"true"`
17- Repository string `envconfig:"REPOSITORY" required:"true"`
18- Username string `envconfig:"USERNAME" required:"true"`
19- Fingerprint string `envconfig:"FINGERPRINT" required:"true"`
20- PodNamespace string `envconfig:"POD_NAMESPACE" required:"true"`
21- StorageRegion string `envconfig:"STORAGE_REGION" default:"us-east-1"`
22- Debug bool `envconfig:"DEBUG" default:"false"`
15+ GitHome string `envconfig:"GIT_HOME" required:"true"`
16+ SSHConnection string `envconfig:"SSH_CONNECTION" required:"true"`
17+ SSHOriginalCommand string `envconfig:"SSH_ORIGINAL_COMMAND" required:"true"`
18+ Repository string `envconfig:"REPOSITORY" required:"true"`
19+ Username string `envconfig:"USERNAME" required:"true"`
20+ Fingerprint string `envconfig:"FINGERPRINT" required:"true"`
21+ PodNamespace string `envconfig:"POD_NAMESPACE" required:"true"`
22+ StorageRegion string `envconfig:"STORAGE_REGION" default:"us-east-1"`
23+ Debug bool `envconfig:"DEBUG" default:"false"`
24+ BuilderPodTickDurationMSec int `envconfig:"BUILDER_POD_TICK_DURATION" default:"100"`
25+ BuilderPodWaitDurationMSec int `envconfig:"BUILDER_POD_WAIT_DURATION" default:"300000"` // 5 minutes
26+ ObjectStorageTickDurationMSec int `envconfing:"OBJECT_STORAGE_TICK_DURATION" default:"500"`
27+ ObjectStorageWaitDurationMSec int `envconfig:"OBJECT_STORAGE_WAIT_DURATION" default:"300000"` // 5 minutes
2328}
2429
2530func (c Config ) App () string {
@@ -29,3 +34,27 @@ func (c Config) App() string {
2934 }
3035 return c .Repository [0 :li ]
3136}
37+
38+ // BuilderPodTickDuration returns the size of the interval used to check for
39+ // the end of the execution of a Pod building an application
40+ func (c Config ) BuilderPodTickDuration () time.Duration {
41+ return time .Duration (time .Duration (c .BuilderPodTickDurationMSec ) * time .Millisecond )
42+ }
43+
44+ // BuilderPodWaitDuration returns the maximum time to wait for the end
45+ // of the execution of a Pod building an application
46+ func (c Config ) BuilderPodWaitDuration () time.Duration {
47+ return time .Duration (time .Duration (c .BuilderPodWaitDurationMSec ) * time .Millisecond )
48+ }
49+
50+ // ObjectStorageTickDuration returns the size of the interval used to check for
51+ // the end of an operation that involves the object storage
52+ func (c Config ) ObjectStorageTickDuration () time.Duration {
53+ return time .Duration (time .Duration (c .ObjectStorageTickDurationMSec ) * time .Millisecond )
54+ }
55+
56+ // ObjectStorageWaitDuration returns the maximum time to wait for the end of an
57+ // operation that involves the object storage
58+ func (c Config ) ObjectStorageWaitDuration () time.Duration {
59+ return time .Duration (time .Duration (c .ObjectStorageWaitDurationMSec ) * time .Millisecond )
60+ }
0 commit comments