Skip to content

Commit 4e57a28

Browse files
committed
Deprecate the Dir template function
1 parent 6993055 commit 4e57a28

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

internal/local_runner.go

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -457,19 +457,6 @@ func (d *LocalRunner) getService(name string) *Service {
457457
func (d *LocalRunner) applyTemplate(s *Service) ([]string, map[string]string, error) {
458458
var input map[string]interface{}
459459

460-
// For {{.Dir}}:
461-
// - Service runs on host: bind to the output folder
462-
// - Service runs inside docker: bind to /artifacts
463-
if d.isHostService(s.Name) {
464-
input = map[string]interface{}{
465-
"Dir": d.out.dst,
466-
}
467-
} else {
468-
input = map[string]interface{}{
469-
"Dir": "/artifacts",
470-
}
471-
}
472-
473460
resolvePort := func(name string, defaultPort int, protocol string) int {
474461
// For {{Port "name" "defaultPort"}}:
475462
// - Service runs on host: return the host port
@@ -952,8 +939,9 @@ func CreatePrometheusServices(manifest *Manifest, out *output) error {
952939
srv := manifest.NewService("prometheus").
953940
WithImage("prom/prometheus").
954941
WithTag("latest").
955-
WithArgs("--config.file", "{{.Dir}}/prometheus.yaml").
956-
WithPort("metrics", 9090, "tcp")
942+
WithArgs("--config.file", "/data/prometheus.yaml").
943+
WithPort("metrics", 9090, "tcp").
944+
WithArtifact("/data/prometheus.yml", "prometheus.yaml")
957945
manifest.services = append(manifest.services, srv)
958946

959947
return nil

internal/manifest.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,7 @@ func applyTemplate(templateStr string) (string, []Port, []NodeRef) {
436436

437437
// use template substitution to load constants
438438
// pass-through the Dir template because it has to be resolved at the runtime
439-
input := map[string]interface{}{
440-
"Dir": "{{.Dir}}",
441-
}
439+
input := map[string]interface{}{}
442440

443441
var portRef []Port
444442
var nodeRef []NodeRef

0 commit comments

Comments
 (0)