Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 87bb12f

Browse files
authored
Merge pull request #438 from silvin-lubecki/settings-to-parameters
Rename Settings to Parameters
2 parents bf8ecad + c0c9cd6 commit 87bb12f

95 files changed

Lines changed: 485 additions & 465 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
*.dockerapp
66
_build/
77
bin/
8-
!examples/simple/*.dockerapp
8+
!examples/*/*.dockerapp
99
!e2e/**/*.dockerapp
10+
!integrations/**/*.dockerapp
1011
.gradle
1112
coverage.html
1213
cover.out

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ hello.dockerapp
4141
```
4242

4343
We created a new file `hello.dockerapp` that contains three YAML documents:
44-
- metadatas
44+
- metadata
4545
- the Compose file
46-
- settings for your application
46+
- parameters for your application
4747

4848
It should look like this:
4949

@@ -69,7 +69,7 @@ services:
6969
{}
7070
```
7171

72-
Let's edit the settings section and add the following default values for our application:
72+
Let's edit the parameters section and add the following default values for our application:
7373

7474
```yaml
7575
port: 5678
@@ -113,7 +113,7 @@ You can then use that Compose file like any other. You could save it to disk or
113113
$ docker-app render | docker-compose -f - up
114114
```
115115
116-
This is where it gets interesting. We can override those settings at runtime, using the `--set` option. Let's specify different option and run `render` again:
116+
This is where it gets interesting. We can override those parameters at runtime, using the `--set` option. Let's specify different option and run `render` again:
117117
118118
```
119119
$ docker-app render --set version=0.2.3 --set port=4567 --set text="hello production"
@@ -131,7 +131,7 @@ services:
131131
protocol: tcp
132132
```
133133
134-
If you prefer you can create a standalone configuration file to store those settings. Let's create `prod.yml` with the following contents:
134+
If you prefer you can create a standalone configuration file to store those parameters. Let's create `prod.yml` with the following contents:
135135
136136
```yaml
137137
version: 0.2.3
@@ -164,7 +164,7 @@ cp docker-app-linux /usr/local/bin/docker-app
164164

165165
If you prefer having the three core documents in separate YAML files, omit the `-s` / `--single-file` option to
166166
the `docker-app init` command. This will create a directory instead of a single file, containing
167-
`metadata.yml`, `docker-compose.yml` and `settings.yml`.
167+
`metadata.yml`, `docker-compose.yml` and `parameters.yml`.
168168

169169
Converting between the two formats can be achieved by using the `docker-app split` and `docker-app merge` commands.
170170

@@ -197,7 +197,7 @@ $ docker-app inspect myhubuser/hello
197197

198198
We have lots of ideas for making Compose-based applications easier to share and reuse, and making applications a first-class part of the Docker toolchain. Please let us know what you think about this initial release and about any of the ideas below:
199199

200-
* Introducing environments to the settings file
200+
* Introducing environments to the parameters file
201201
* Docker images which launch the application when run
202202
* Built-in commands for running applications
203203
* Saving required images into the application artifact to support offline installation
@@ -212,9 +212,10 @@ $ docker-app
212212
213213
Usage: docker-app [OPTIONS] COMMAND
214214
215-
Docker Application Packages
215+
Build and deploy Docker Application Packages.
216216
217217
Options:
218+
-c, --context string context to use to connect to the daemon (overrides host flag, DOCKER_HOST env var and default context set with "docker context use")
218219
-D, --debug Enable debug mode
219220
-H, --host list Daemon socket(s) to connect to
220221
-l, --log-level string Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
@@ -229,7 +230,7 @@ Commands:
229230
completion Generates completion scripts for the specified shell (bash or zsh)
230231
deploy Deploy or update an application
231232
init Start building a Docker application
232-
inspect Shows metadata, settings and a summary of the compose file for a given application
233+
inspect Shows metadata, parameters and a summary of the compose file for a given application
233234
merge Merge a multi-file application into a single file
234235
push Push the application to a registry
235236
render Render the Compose file for the application

cmd/docker-app/deploy.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919

2020
type deployOptions struct {
2121
deployComposeFiles []string
22-
deploySettingsFiles []string
22+
deployParametersFiles []string
2323
deployEnv []string
2424
deployOrchestrator string
2525
deployKubeConfig string
@@ -42,8 +42,8 @@ func deployCmd(dockerCli command.Cli) *cobra.Command {
4242
},
4343
}
4444

45-
cmd.Flags().StringArrayVarP(&opts.deploySettingsFiles, "settings-files", "f", []string{}, "Override settings files")
46-
cmd.Flags().StringArrayVarP(&opts.deployEnv, "set", "s", []string{}, "Override settings values")
45+
cmd.Flags().StringArrayVarP(&opts.deployParametersFiles, "parameters-files", "f", []string{}, "Override with parameters from files")
46+
cmd.Flags().StringArrayVarP(&opts.deployEnv, "set", "s", []string{}, "Override parameters values")
4747
cmd.Flags().StringVarP(&opts.deployOrchestrator, "orchestrator", "o", "swarm", "Orchestrator to deploy on (swarm, kubernetes)")
4848
cmd.Flags().StringVarP(&opts.deployKubeConfig, "kubeconfig", "k", "", "Kubernetes config file to use")
4949
cmd.Flags().StringVarP(&opts.deployNamespace, "namespace", "n", "default", "Kubernetes namespace to deploy into")
@@ -57,7 +57,7 @@ func deployCmd(dockerCli command.Cli) *cobra.Command {
5757

5858
func runDeploy(dockerCli command.Cli, flags *pflag.FlagSet, appname string, opts deployOptions) error {
5959
app, err := packager.Extract(appname,
60-
types.WithSettingsFiles(opts.deploySettingsFiles...),
60+
types.WithParametersFiles(opts.deployParametersFiles...),
6161
types.WithComposeFiles(opts.deployComposeFiles...),
6262
)
6363
if err != nil {

cmd/docker-app/image-add.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import (
1313
)
1414

1515
var (
16-
imageAddComposeFiles []string
17-
imageAddSettingsFile []string
18-
imageAddEnv []string
16+
imageAddComposeFiles []string
17+
imageAddParametersFile []string
18+
imageAddEnv []string
1919
)
2020

2121
func imageAddCmd() *cobra.Command {
@@ -29,7 +29,7 @@ subdirectory.`,
2929
RunE: func(cmd *cobra.Command, args []string) error {
3030
oappname := args[0]
3131
app, err := packager.Extract(oappname,
32-
types.WithSettingsFiles(imageAddSettingsFile...),
32+
types.WithParametersFiles(imageAddParametersFile...),
3333
types.WithComposeFiles(imageAddComposeFiles...),
3434
)
3535
if err != nil {
@@ -66,8 +66,8 @@ subdirectory.`,
6666
},
6767
}
6868
if internal.Experimental == "on" {
69-
cmd.Flags().StringArrayVarP(&imageAddComposeFiles, "compose-files", "c", []string{}, "Override Compose files")
70-
cmd.Flags().StringArrayVarP(&imageAddSettingsFile, "settings-files", "s", []string{}, "Override settings files")
69+
cmd.Flags().StringArrayVarP(&imageAddComposeFiles, "compose-files", "c", []string{}, "Override Compose file")
70+
cmd.Flags().StringArrayVarP(&imageAddParametersFile, "parameters-files", "f", []string{}, "Override with parameters from files")
7171
cmd.Flags().StringArrayVarP(&imageAddEnv, "env", "e", []string{}, "Override environment values")
7272
}
7373
return cmd

cmd/docker-app/inspect.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,29 @@ import (
1111
)
1212

1313
var (
14-
inspectSettingsFile []string
15-
inspectEnv []string
14+
inspectParametersFile []string
15+
inspectEnv []string
1616
)
1717

1818
// inspectCmd represents the inspect command
1919
func inspectCmd(dockerCli command.Cli) *cobra.Command {
2020
cmd := &cobra.Command{
21-
Use: "inspect [<app-name>] [-s key=value...] [-f settings-file...]",
22-
Short: "Shows metadata, settings and a summary of the compose file for a given application",
21+
Use: "inspect [<app-name>] [-s key=value...] [-f parameters-file...]",
22+
Short: "Shows metadata, parameters and a summary of the compose file for a given application",
2323
Args: cli.RequiresMaxArgs(1),
2424
RunE: func(cmd *cobra.Command, args []string) error {
2525
app, err := packager.Extract(firstOrEmpty(args),
26-
types.WithSettingsFiles(inspectSettingsFile...),
26+
types.WithParametersFiles(inspectParametersFile...),
2727
)
2828
if err != nil {
2929
return err
3030
}
3131
defer app.Cleanup()
32-
argSettings := cliopts.ConvertKVStringsToMap(inspectEnv)
33-
return inspect.Inspect(dockerCli.Out(), app, argSettings)
32+
argParameters := cliopts.ConvertKVStringsToMap(inspectEnv)
33+
return inspect.Inspect(dockerCli.Out(), app, argParameters)
3434
},
3535
}
36-
cmd.Flags().StringArrayVarP(&inspectSettingsFile, "settings-files", "f", []string{}, "Override settings files")
37-
cmd.Flags().StringArrayVarP(&inspectEnv, "set", "s", []string{}, "Override settings values")
36+
cmd.Flags().StringArrayVarP(&inspectParametersFile, "parameters-files", "f", []string{}, "Override with parameters from files")
37+
cmd.Flags().StringArrayVarP(&inspectEnv, "set", "s", []string{}, "Override parameters values")
3838
return cmd
3939
}

cmd/docker-app/render.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@ import (
1616
)
1717

1818
var (
19-
formatDriver string
20-
renderComposeFiles []string
21-
renderSettingsFile []string
22-
renderEnv []string
23-
renderOutput string
19+
formatDriver string
20+
renderComposeFiles []string
21+
renderParametersFile []string
22+
renderEnv []string
23+
renderOutput string
2424
)
2525

2626
func renderCmd(dockerCli command.Cli) *cobra.Command {
2727
cmd := &cobra.Command{
28-
Use: "render <app-name> [-s key=value...] [-f settings-file...]",
28+
Use: "render <app-name> [-s key=value...] [-f parameters-file...]",
2929
Short: "Render the Compose file for the application",
3030
Long: `Render the Compose file for the application.`,
3131
Args: cli.RequiresMaxArgs(1),
3232
RunE: func(cmd *cobra.Command, args []string) error {
3333
app, err := packager.Extract(firstOrEmpty(args),
34-
types.WithSettingsFiles(renderSettingsFile...),
34+
types.WithParametersFiles(renderParametersFile...),
3535
types.WithComposeFiles(renderComposeFiles...),
3636
)
3737
if err != nil {
@@ -64,10 +64,10 @@ func renderCmd(dockerCli command.Cli) *cobra.Command {
6464
cmd.Long += `- External Compose files or template Compose files can be specified with the -c flag.
6565
(Repeat the flag for multiple files). These files will be merged in order with
6666
the app's own Compose file.`
67-
cmd.Flags().StringArrayVarP(&renderComposeFiles, "compose-files", "c", []string{}, "Override Compose files")
67+
cmd.Flags().StringArrayVarP(&renderComposeFiles, "compose-files", "c", []string{}, "Override Compose file")
6868
}
69-
cmd.Flags().StringArrayVarP(&renderSettingsFile, "settings-files", "f", []string{}, "Override settings files")
70-
cmd.Flags().StringArrayVarP(&renderEnv, "set", "s", []string{}, "Override settings values")
69+
cmd.Flags().StringArrayVarP(&renderParametersFile, "parameters-files", "f", []string{}, "Override with parameters from files")
70+
cmd.Flags().StringArrayVarP(&renderEnv, "set", "s", []string{}, "Override parameters values")
7171
cmd.Flags().StringVarP(&renderOutput, "output", "o", "-", "Output file")
7272
cmd.Flags().StringVar(&formatDriver, "formatter", "yaml", "Configure the output format (yaml|json)")
7373
return cmd

cmd/docker-app/validate.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,29 @@ import (
1010
)
1111

1212
var (
13-
validateSettingsFile []string
14-
validateEnv []string
13+
validateParametersFile []string
14+
validateEnv []string
1515
)
1616

1717
func validateCmd() *cobra.Command {
1818
cmd := &cobra.Command{
19-
Use: "validate [<app-name>] [-s key=value...] [-f settings-file...]",
19+
Use: "validate [<app-name>] [-s key=value...] [-f parameters-file...]",
2020
Short: "Checks the rendered application is syntactically correct",
2121
Args: cli.RequiresMaxArgs(1),
2222
RunE: func(cmd *cobra.Command, args []string) error {
2323
app, err := packager.Extract(firstOrEmpty(args),
24-
types.WithSettingsFiles(validateSettingsFile...),
24+
types.WithParametersFiles(validateParametersFile...),
2525
)
2626
if err != nil {
2727
return err
2828
}
2929
defer app.Cleanup()
30-
argSettings := cliopts.ConvertKVStringsToMap(validateEnv)
31-
_, err = render.Render(app, argSettings)
30+
argParameters := cliopts.ConvertKVStringsToMap(validateEnv)
31+
_, err = render.Render(app, argParameters)
3232
return err
3333
},
3434
}
35-
cmd.Flags().StringArrayVarP(&validateSettingsFile, "settings-files", "f", []string{}, "Override settings files")
36-
cmd.Flags().StringArrayVarP(&validateEnv, "set", "s", []string{}, "Override settings values")
35+
cmd.Flags().StringArrayVarP(&validateParametersFile, "parameters-files", "f", []string{}, "Override with parameters from files")
36+
cmd.Flags().StringArrayVarP(&validateEnv, "set", "s", []string{}, "Override parameters values")
3737
return cmd
3838
}

e2e/commands_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ services:
2929
hello-world:
3030
image: hello-world
3131
---
32-
# This section contains the default values for your application settings.`
32+
# This section contains the default values for your application parameters.`
3333
)
3434

3535
func TestRenderTemplates(t *testing.T) {
@@ -59,14 +59,14 @@ func TestRender(t *testing.T) {
5959

6060
func testRenderApp(appPath string, env ...string) func(*testing.T) {
6161
return func(t *testing.T) {
62-
envSettings := map[string]string{}
62+
envParameters := map[string]string{}
6363
data, err := ioutil.ReadFile(filepath.Join(appPath, "env.yml"))
6464
assert.NilError(t, err)
65-
assert.NilError(t, yaml.Unmarshal(data, &envSettings))
65+
assert.NilError(t, yaml.Unmarshal(data, &envParameters))
6666
args := []string{dockerApp, "render", filepath.Join(appPath, "my.dockerapp"),
67-
"-f", filepath.Join(appPath, "settings-0.yml"),
67+
"-f", filepath.Join(appPath, "parameters-0.yml"),
6868
}
69-
for k, v := range envSettings {
69+
for k, v := range envParameters {
7070
args = append(args, "-s", fmt.Sprintf("%s=%s", k, v))
7171
}
7272
result := icmd.RunCmd(icmd.Cmd{
@@ -130,7 +130,7 @@ maintainers:
130130
fs.WithMode(0755),
131131
fs.WithFile(internal.MetadataFileName, meta, fs.WithMode(0644)), // too many variables, cheating
132132
fs.WithFile(internal.ComposeFileName, composeData, fs.WithMode(0644)),
133-
fs.WithFile(internal.SettingsFileName, "NGINX_ARGS: FILL ME\nNGINX_VERSION: latest\n", fs.WithMode(0644)),
133+
fs.WithFile(internal.ParametersFileName, "NGINX_ARGS: FILL ME\nNGINX_VERSION: latest\n", fs.WithMode(0644)),
134134
)
135135
assert.Assert(t, fs.Equal(dirName, manifest))
136136

File renamed without changes.

e2e/testdata/envvariables-inspect.golden

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Service (1) Replicas Ports Image
66
----------- -------- ----- -----
77
test 1 alpine:latest
88

9-
Settings (4) Value
10-
------------ -----
9+
Parameters (4) Value
10+
-------------- -----
1111
myapp.alpine_version latest
1212
myapp.command1 cat
1313
myapp.command2 foo

0 commit comments

Comments
 (0)