@@ -129,9 +129,9 @@ func NewLocalRunner(out *output, manifest *Manifest, overrides map[string]string
129
129
logRef : log_output ,
130
130
path : log_output .Name (),
131
131
}
132
- component := FindComponent (service .componentName )
132
+ component := FindComponent (service .ComponentName )
133
133
if component == nil {
134
- return nil , fmt .Errorf ("component not found '%s'" , service .componentName )
134
+ return nil , fmt .Errorf ("component not found '%s'" , service .ComponentName )
135
135
}
136
136
instance := & instance {
137
137
service : service ,
@@ -145,7 +145,7 @@ func NewLocalRunner(out *output, manifest *Manifest, overrides map[string]string
145
145
// TODO: it feels a bit weird to have all this logic on the new command. We should split it later on.
146
146
for _ , instance := range instances {
147
147
ss := instance .service
148
- if ss .labels [useHostExecutionLabel ] == "true" {
148
+ if ss .Labels [useHostExecutionLabel ] == "true" {
149
149
// If the service wants to run on the host, it must implement the ReleaseService interface
150
150
// which provides functions to download the release artifact.
151
151
releaseService , ok := instance .component .(ReleaseService )
@@ -176,8 +176,8 @@ func NewLocalRunner(out *output, manifest *Manifest, overrides map[string]string
176
176
}
177
177
178
178
srv := manifest .MustGetService (k )
179
- srv .image = parts [0 ]
180
- srv .tag = parts [1 ]
179
+ srv .Image = parts [0 ]
180
+ srv .Tag = parts [1 ]
181
181
182
182
delete (overrides , k )
183
183
continue
@@ -443,7 +443,7 @@ func (d *LocalRunner) reservePort(startPort int, protocol string) int {
443
443
panic ("BUG: could not reserve a port" )
444
444
}
445
445
446
- func (d * LocalRunner ) getService (name string ) * service {
446
+ func (d * LocalRunner ) getService (name string ) * Service {
447
447
for _ , svc := range d .manifest .services {
448
448
if svc .Name == name {
449
449
return svc
@@ -454,7 +454,7 @@ func (d *LocalRunner) getService(name string) *service {
454
454
455
455
// applyTemplate resolves the templates from the manifest (Dir, Port, Connect) into
456
456
// the actual values for this specific docker execution.
457
- func (d * LocalRunner ) applyTemplate (s * service ) ([]string , map [string ]string , error ) {
457
+ func (d * LocalRunner ) applyTemplate (s * Service ) ([]string , map [string ]string , error ) {
458
458
var input map [string ]interface {}
459
459
460
460
// For {{.Dir}}:
@@ -535,7 +535,7 @@ func (d *LocalRunner) applyTemplate(s *service) ([]string, map[string]string, er
535
535
536
536
// apply the templates to the arguments
537
537
var argsResult []string
538
- for _ , arg := range s .args {
538
+ for _ , arg := range s .Args {
539
539
newArg , err := runTemplate (arg )
540
540
if err != nil {
541
541
return nil , nil , err
@@ -545,7 +545,7 @@ func (d *LocalRunner) applyTemplate(s *service) ([]string, map[string]string, er
545
545
546
546
// apply the templates to the environment variables
547
547
envs := map [string ]string {}
548
- for k , v := range s .env {
548
+ for k , v := range s .Env {
549
549
newV , err := runTemplate (v )
550
550
if err != nil {
551
551
return nil , nil , err
@@ -577,7 +577,7 @@ func (d *LocalRunner) validateImageExists(image string) error {
577
577
return fmt .Errorf ("image %s not found: %w" , image )
578
578
}
579
579
580
- func (d * LocalRunner ) toDockerComposeService (s * service ) (map [string ]interface {}, error ) {
580
+ func (d * LocalRunner ) toDockerComposeService (s * Service ) (map [string ]interface {}, error ) {
581
581
// apply the template again on the arguments to figure out the connections
582
582
// at this point all of them are valid, we just have to resolve them again. We assume for now
583
583
// everyone is going to be on docker at the same network.
@@ -594,7 +594,7 @@ func (d *LocalRunner) toDockerComposeService(s *service) (map[string]interface{}
594
594
}
595
595
596
596
// Validate that the image exists
597
- imageName := fmt .Sprintf ("%s:%s" , s .image , s .tag )
597
+ imageName := fmt .Sprintf ("%s:%s" , s .Image , s .Tag )
598
598
if err := d .validateImageExists (imageName ); err != nil {
599
599
return nil , fmt .Errorf ("failed to validate image %s: %w" , imageName , err )
600
600
}
@@ -610,20 +610,20 @@ func (d *LocalRunner) toDockerComposeService(s *service) (map[string]interface{}
610
610
// add the local ports exposed by the service as labels
611
611
// we have to do this for now since we do not store the manifest in JSON yet.
612
612
// Otherwise, we could use that directly
613
- for _ , port := range s .ports {
613
+ for _ , port := range s .Ports {
614
614
labels [fmt .Sprintf ("port.%s" , port .Name )] = fmt .Sprintf ("%d" , port .Port )
615
615
}
616
616
617
617
// Use files mapped to figure out which files from the artifacts is using the service
618
618
volumes := map [string ]string {
619
619
outputFolder : "/artifacts" , // placeholder
620
620
}
621
- for k , v := range s .filesMapped {
621
+ for k , v := range s .FilesMapped {
622
622
volumes [filepath .Join (outputFolder , v )] = k
623
623
}
624
624
625
625
// create the bind volumes
626
- for localPath , volumeName := range s .volumesMapped {
626
+ for localPath , volumeName := range s .VolumesMapped {
627
627
volumeDirAbsPath , err := d .createVolume (s .Name , volumeName )
628
628
if err != nil {
629
629
return nil , err
@@ -669,10 +669,10 @@ func (d *LocalRunner) toDockerComposeService(s *service) (map[string]interface{}
669
669
}
670
670
}
671
671
672
- if s .dependsOn != nil {
672
+ if s .DependsOn != nil {
673
673
depends := map [string ]interface {}{}
674
674
675
- for _ , d := range s .dependsOn {
675
+ for _ , d := range s .DependsOn {
676
676
if d .Condition == "" {
677
677
depends [d .Name ] = struct {}{}
678
678
} else {
@@ -694,13 +694,13 @@ func (d *LocalRunner) toDockerComposeService(s *service) (map[string]interface{}
694
694
}
695
695
}
696
696
697
- if s .entrypoint != "" {
698
- service ["entrypoint" ] = s .entrypoint
697
+ if s .Entrypoint != "" {
698
+ service ["entrypoint" ] = s .Entrypoint
699
699
}
700
700
701
- if len (s .ports ) > 0 {
701
+ if len (s .Ports ) > 0 {
702
702
ports := []string {}
703
- for _ , p := range s .ports {
703
+ for _ , p := range s .Ports {
704
704
protocol := ""
705
705
if p .Protocol == ProtocolUDP {
706
706
protocol = "/udp"
@@ -740,7 +740,7 @@ func (d *LocalRunner) generateDockerCompose() ([]byte, error) {
740
740
// both to have access to the services from localhost but also to do communication
741
741
// between services running inside docker and the ones running on the host machine.
742
742
for _ , svc := range d .manifest .services {
743
- for _ , port := range svc .ports {
743
+ for _ , port := range svc .Ports {
744
744
port .HostPort = d .reservePort (port .Port , port .Protocol )
745
745
}
746
746
}
@@ -775,7 +775,7 @@ func (d *LocalRunner) createVolume(service, volumeName string) (string, error) {
775
775
}
776
776
777
777
// runOnHost runs the service on the host machine
778
- func (d * LocalRunner ) runOnHost (ss * service ) error {
778
+ func (d * LocalRunner ) runOnHost (ss * Service ) error {
779
779
// TODO: Use env vars in host processes
780
780
args , _ , err := d .applyTemplate (ss )
781
781
if err != nil {
@@ -784,7 +784,7 @@ func (d *LocalRunner) runOnHost(ss *service) error {
784
784
785
785
// Create the volumes for this service
786
786
volumesMapped := map [string ]string {}
787
- for pathInDocker , volumeName := range ss .volumesMapped {
787
+ for pathInDocker , volumeName := range ss .VolumesMapped {
788
788
volumeDirAbsPath , err := d .createVolume (ss .Name , volumeName )
789
789
if err != nil {
790
790
return err
@@ -796,7 +796,7 @@ func (d *LocalRunner) runOnHost(ss *service) error {
796
796
// Just a string replacement should be enough
797
797
for i , arg := range args {
798
798
// If any of the args contains any of the files mapped, we need to replace it
799
- for pathInDocker , artifactName := range ss .filesMapped {
799
+ for pathInDocker , artifactName := range ss .FilesMapped {
800
800
if strings .Contains (arg , pathInDocker ) {
801
801
args [i ] = strings .ReplaceAll (arg , pathInDocker , filepath .Join (d .out .dst , artifactName ))
802
802
}
@@ -914,10 +914,10 @@ func CreatePrometheusServices(manifest *Manifest, out *output) error {
914
914
})
915
915
916
916
for _ , c := range manifest .services {
917
- for _ , port := range c .ports {
917
+ for _ , port := range c .Ports {
918
918
if port .Name == "metrics" {
919
919
metricsPath := "/metrics"
920
- if overrideMetricsPath , ok := c .labels ["metrics_path" ]; ok {
920
+ if overrideMetricsPath , ok := c .Labels ["metrics_path" ]; ok {
921
921
metricsPath = overrideMetricsPath
922
922
}
923
923
0 commit comments