Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Commit 938bff7

Browse files
authored
Merge pull request #218 from nkubala/metadata
Add all config fields to ConfigObject
2 parents 37c5798 + 2717ba8 commit 938bff7

File tree

2 files changed

+49
-12
lines changed

2 files changed

+49
-12
lines changed

pkg/util/image_prep_utils.go

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,24 +87,59 @@ type ImageHistoryItem struct {
8787
}
8888

8989
type ConfigObject struct {
90-
Env []string `json:"Env"`
91-
Entrypoint []string `json:"Entrypoint"`
90+
Hostname string
91+
Domainname string
92+
User string
93+
AttachStdin bool
94+
AttachStdout bool
95+
AttachStderr bool
9296
ExposedPorts map[string]struct{} `json:"ExposedPorts"`
93-
Cmd []string `json:"Cmd"`
94-
Volumes map[string]struct{} `json:"Volumes"`
95-
Workdir string `json:"WorkingDir"`
96-
Labels map[string]string `json:"Labels"`
97+
Tty bool
98+
OpenStdin bool
99+
StdinOnce bool
100+
Env []string `json:"Env"`
101+
Cmd []string `json:"Cmd"`
102+
// Healthcheck *HealthConfig
103+
ArgsEscaped bool `json:",omitempty"`
104+
Image string
105+
Volumes map[string]struct{} `json:"Volumes"`
106+
Workdir string `json:"WorkingDir"`
107+
Entrypoint []string `json:"Entrypoint"`
108+
NetworkDisabled bool `json:",omitempty"`
109+
MacAddress string `json:",omitempty"`
110+
OnBuild []string
111+
Labels map[string]string `json:"Labels"`
112+
StopSignal string `json:",omitempty"`
113+
StopTimeout *int `json:",omitempty"`
114+
Shell []string `json:",omitempty"`
97115
}
98116

99117
func (c ConfigObject) AsList() []string {
100118
return []string{
101-
fmt.Sprintf("Env: %s", strings.Join(c.Env, ",")),
102-
fmt.Sprintf("Entrypoint: %s", strings.Join(c.Entrypoint, ",")),
119+
fmt.Sprintf("Hostname: %s", c.Hostname),
120+
fmt.Sprintf("Domainname: %s", c.Domainname),
121+
fmt.Sprintf("User: %s", c.User),
122+
fmt.Sprintf("AttachStdin: %t", c.AttachStdin),
123+
fmt.Sprintf("AttachStdout: %t", c.AttachStdout),
124+
fmt.Sprintf("AttachStderr: %t", c.AttachStderr),
103125
fmt.Sprintf("ExposedPorts: %v", sortMap(c.ExposedPorts)),
126+
fmt.Sprintf("Tty: %t", c.Tty),
127+
fmt.Sprintf("OpenStdin: %t", c.OpenStdin),
128+
fmt.Sprintf("StdinOnce: %t", c.StdinOnce),
129+
fmt.Sprintf("Env: %s", strings.Join(c.Env, ",")),
104130
fmt.Sprintf("Cmd: %s", strings.Join(c.Cmd, ",")),
131+
fmt.Sprintf("ArgsEscaped: %t", c.ArgsEscaped),
132+
fmt.Sprintf("Image: %s", c.Image),
105133
fmt.Sprintf("Volumes: %v", sortMap(c.Volumes)),
106134
fmt.Sprintf("Workdir: %s", c.Workdir),
135+
fmt.Sprintf("Entrypoint: %s", strings.Join(c.Entrypoint, ",")),
136+
fmt.Sprintf("NetworkDisabled: %t", c.NetworkDisabled),
137+
fmt.Sprintf("MacAddress: %s", c.MacAddress),
138+
fmt.Sprintf("OnBuild: %s", strings.Join(c.OnBuild, ",")),
107139
fmt.Sprintf("Labels: %v", c.Labels),
140+
fmt.Sprintf("StopSignal: %s", c.StopSignal),
141+
fmt.Sprintf("StopTimeout: %d", c.StopTimeout),
142+
fmt.Sprintf("Shell: %s", strings.Join(c.Shell, ",")),
108143
}
109144
}
110145

tests/metadata_diff_expected.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
"DiffType": "Metadata",
66
"Diff": {
77
"Adds": [
8-
"Entrypoint: /entrypoint",
9-
"ExposedPorts: 1234/tcp:{}"
8+
"ExposedPorts: 1234/tcp:{}",
9+
"Image: sha256:0b30c570b95ba9cc450c8252cb264a8c66f7492a7dd6fb32f356267b9e04038f",
10+
"Entrypoint: /entrypoint"
1011
],
1112
"Dels": [
12-
"Entrypoint: ",
13-
"ExposedPorts: 1234/tcp:{} 4321/tcp:{}"
13+
"ExposedPorts: 1234/tcp:{} 4321/tcp:{}",
14+
"Image: sha256:63d847f046cdda00df8ba9176753059439478784129443dd1da632504dce95bb",
15+
"Entrypoint: "
1416
]
1517
}
1618
}

0 commit comments

Comments
 (0)