Merge pull request #2260 from thaJeztah/fix_comment_formatting
Fix comment formatting and minor linting issue
This commit is contained in:
commit
d05846d2cb
@ -164,7 +164,7 @@ func runContainer(dockerCli command.Cli, opts *runOptions, copts *containerOptio
|
|||||||
|
|
||||||
statusChan := waitExitOrRemoved(ctx, dockerCli, createResponse.ID, copts.autoRemove)
|
statusChan := waitExitOrRemoved(ctx, dockerCli, createResponse.ID, copts.autoRemove)
|
||||||
|
|
||||||
//start the container
|
// start the container
|
||||||
if err := client.ContainerStart(ctx, createResponse.ID, types.ContainerStartOptions{}); err != nil {
|
if err := client.ContainerStart(ctx, createResponse.ID, types.ContainerStartOptions{}); err != nil {
|
||||||
// If we have hijackedIOStreamer, we should notify
|
// If we have hijackedIOStreamer, we should notify
|
||||||
// hijackedIOStreamer we are going to exit and wait
|
// hijackedIOStreamer we are going to exit and wait
|
||||||
|
@ -40,11 +40,9 @@ func testDefaultMetadata() store.Metadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func testStore(t *testing.T, meta store.Metadata, tls store.ContextTLSData) (store.Store, func()) {
|
func testStore(t *testing.T, meta store.Metadata, tls store.ContextTLSData) (store.Store, func()) {
|
||||||
//meta := testDefaultMetadata()
|
|
||||||
testDir, err := ioutil.TempDir("", t.Name())
|
testDir, err := ioutil.TempDir("", t.Name())
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
//defer os.RemoveAll(testDir)
|
s := &ContextStoreWithDefault{
|
||||||
store := &ContextStoreWithDefault{
|
|
||||||
Store: store.New(testDir, testCfg),
|
Store: store.New(testDir, testCfg),
|
||||||
Resolver: func() (*DefaultContext, error) {
|
Resolver: func() (*DefaultContext, error) {
|
||||||
return &DefaultContext{
|
return &DefaultContext{
|
||||||
@ -53,8 +51,8 @@ func testStore(t *testing.T, meta store.Metadata, tls store.ContextTLSData) (sto
|
|||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
return store, func() {
|
return s, func() {
|
||||||
os.RemoveAll(testDir)
|
_ = os.RemoveAll(testDir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ func runBuildBuildKit(dockerCli command.Cli, options buildOptions) error {
|
|||||||
buildOptions := imageBuildOptions(dockerCli, options)
|
buildOptions := imageBuildOptions(dockerCli, options)
|
||||||
buildOptions.Version = types.BuilderBuildKit
|
buildOptions.Version = types.BuilderBuildKit
|
||||||
buildOptions.Dockerfile = dockerfileName
|
buildOptions.Dockerfile = dockerfileName
|
||||||
//buildOptions.AuthConfigs = authConfigs // handled by session
|
// buildOptions.AuthConfigs = authConfigs // handled by session
|
||||||
buildOptions.RemoteContext = remote
|
buildOptions.RemoteContext = remote
|
||||||
buildOptions.SessionID = s.ID()
|
buildOptions.SessionID = s.ID()
|
||||||
buildOptions.BuildID = buildID
|
buildOptions.BuildID = buildID
|
||||||
|
@ -1036,7 +1036,7 @@ portLoop:
|
|||||||
if _, ok := portSet[portConfigToString(&port)]; ok {
|
if _, ok := portSet[portConfigToString(&port)]; ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
//portSet[portConfigToString(&port)] = port
|
// portSet[portConfigToString(&port)] = port
|
||||||
newPorts = append(newPorts, port)
|
newPorts = append(newPorts, port)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ func Load(configDir string) (*configfile.ConfigFile, error) {
|
|||||||
}
|
}
|
||||||
confFile := filepath.Join(homedir, oldConfigfile)
|
confFile := filepath.Join(homedir, oldConfigfile)
|
||||||
if _, err := os.Stat(confFile); err != nil {
|
if _, err := os.Stat(confFile); err != nil {
|
||||||
return configFile, nil //missing file is not an error
|
return configFile, nil // missing file is not an error
|
||||||
}
|
}
|
||||||
file, err := os.Open(confFile)
|
file, err := os.Open(confFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -15,7 +15,7 @@ func main() {
|
|||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "nopersistentprerun",
|
Use: "nopersistentprerun",
|
||||||
Short: "Testing without PersistentPreRun hooks",
|
Short: "Testing without PersistentPreRun hooks",
|
||||||
//PersistentPreRunE: Not specified, we need to test that it works in the absence of an explicit call
|
// PersistentPreRunE: Not specified, we need to test that it works in the absence of an explicit call
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
cli := dockerCli.Client()
|
cli := dockerCli.Client()
|
||||||
ping, err := cli.Ping(context.Background())
|
ping, err := cli.Ping(context.Background())
|
||||||
|
@ -10,28 +10,28 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
//NotaryURL is the location of the notary server
|
// NotaryURL is the location of the notary server
|
||||||
NotaryURL = "https://notary-server:4443"
|
NotaryURL = "https://notary-server:4443"
|
||||||
//EvilNotaryURL is the location of the evil notary server
|
// EvilNotaryURL is the location of the evil notary server
|
||||||
EvilNotaryURL = "https://evil-notary-server:4444"
|
EvilNotaryURL = "https://evil-notary-server:4444"
|
||||||
//AlpineImage is an image in the test registry
|
// AlpineImage is an image in the test registry
|
||||||
AlpineImage = "registry:5000/alpine:3.6"
|
AlpineImage = "registry:5000/alpine:3.6"
|
||||||
//AlpineSha is the sha of the alpine image
|
// AlpineSha is the sha of the alpine image
|
||||||
AlpineSha = "641b95ddb2ea9dc2af1a0113b6b348ebc20872ba615204fbe12148e98fd6f23d"
|
AlpineSha = "641b95ddb2ea9dc2af1a0113b6b348ebc20872ba615204fbe12148e98fd6f23d"
|
||||||
//BusyboxImage is an image in the test registry
|
// BusyboxImage is an image in the test registry
|
||||||
BusyboxImage = "registry:5000/busybox:1.27.2"
|
BusyboxImage = "registry:5000/busybox:1.27.2"
|
||||||
//BusyboxSha is the sha of the busybox image
|
// BusyboxSha is the sha of the busybox image
|
||||||
BusyboxSha = "030fcb92e1487b18c974784dcc110a93147c9fc402188370fbfd17efabffc6af"
|
BusyboxSha = "030fcb92e1487b18c974784dcc110a93147c9fc402188370fbfd17efabffc6af"
|
||||||
)
|
)
|
||||||
|
|
||||||
//SetupConfigFile creates a config.json file for testing
|
// SetupConfigFile creates a config.json file for testing
|
||||||
func SetupConfigFile(t *testing.T) fs.Dir {
|
func SetupConfigFile(t *testing.T) fs.Dir {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
return SetupConfigWithNotaryURL(t, "trust_test", NotaryURL)
|
return SetupConfigWithNotaryURL(t, "trust_test", NotaryURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
//SetupConfigWithNotaryURL creates a config.json file for testing in the given path
|
// SetupConfigWithNotaryURL creates a config.json file for testing in the given path
|
||||||
//with the given notaryURL
|
// with the given notaryURL
|
||||||
func SetupConfigWithNotaryURL(t *testing.T, path, notaryURL string) fs.Dir {
|
func SetupConfigWithNotaryURL(t *testing.T, path, notaryURL string) fs.Dir {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
dir := fs.NewDir(t, path, fs.WithMode(0700), fs.WithFile("config.json", fmt.Sprintf(`
|
dir := fs.NewDir(t, path, fs.WithMode(0700), fs.WithFile("config.json", fmt.Sprintf(`
|
||||||
@ -50,7 +50,7 @@ func SetupConfigWithNotaryURL(t *testing.T, path, notaryURL string) fs.Dir {
|
|||||||
return *dir
|
return *dir
|
||||||
}
|
}
|
||||||
|
|
||||||
//WithConfig sets an environment variable for the docker config location
|
// WithConfig sets an environment variable for the docker config location
|
||||||
func WithConfig(dir string) func(cmd *icmd.Cmd) {
|
func WithConfig(dir string) func(cmd *icmd.Cmd) {
|
||||||
return func(cmd *icmd.Cmd) {
|
return func(cmd *icmd.Cmd) {
|
||||||
env := append(os.Environ(),
|
env := append(os.Environ(),
|
||||||
@ -60,7 +60,7 @@ func WithConfig(dir string) func(cmd *icmd.Cmd) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//WithPassphrase sets environment variables for passphrases
|
// WithPassphrase sets environment variables for passphrases
|
||||||
func WithPassphrase(rootPwd, repositoryPwd string) func(cmd *icmd.Cmd) {
|
func WithPassphrase(rootPwd, repositoryPwd string) func(cmd *icmd.Cmd) {
|
||||||
return func(cmd *icmd.Cmd) {
|
return func(cmd *icmd.Cmd) {
|
||||||
env := append(os.Environ(),
|
env := append(os.Environ(),
|
||||||
@ -71,7 +71,7 @@ func WithPassphrase(rootPwd, repositoryPwd string) func(cmd *icmd.Cmd) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//WithTrust sets DOCKER_CONTENT_TRUST to 1
|
// WithTrust sets DOCKER_CONTENT_TRUST to 1
|
||||||
func WithTrust(cmd *icmd.Cmd) {
|
func WithTrust(cmd *icmd.Cmd) {
|
||||||
env := append(os.Environ(),
|
env := append(os.Environ(),
|
||||||
"DOCKER_CONTENT_TRUST=1",
|
"DOCKER_CONTENT_TRUST=1",
|
||||||
@ -79,7 +79,7 @@ func WithTrust(cmd *icmd.Cmd) {
|
|||||||
cmd.Env = append(cmd.Env, env...)
|
cmd.Env = append(cmd.Env, env...)
|
||||||
}
|
}
|
||||||
|
|
||||||
//WithNotary sets the location of the notary server
|
// WithNotary sets the location of the notary server
|
||||||
func WithNotary(cmd *icmd.Cmd) {
|
func WithNotary(cmd *icmd.Cmd) {
|
||||||
env := append(os.Environ(),
|
env := append(os.Environ(),
|
||||||
"DOCKER_CONTENT_TRUST_SERVER="+NotaryURL,
|
"DOCKER_CONTENT_TRUST_SERVER="+NotaryURL,
|
||||||
@ -87,14 +87,14 @@ func WithNotary(cmd *icmd.Cmd) {
|
|||||||
cmd.Env = append(cmd.Env, env...)
|
cmd.Env = append(cmd.Env, env...)
|
||||||
}
|
}
|
||||||
|
|
||||||
//WithHome sets the HOME environment variable
|
// WithHome sets the HOME environment variable
|
||||||
func WithHome(path string) func(*icmd.Cmd) {
|
func WithHome(path string) func(*icmd.Cmd) {
|
||||||
return func(cmd *icmd.Cmd) {
|
return func(cmd *icmd.Cmd) {
|
||||||
cmd.Env = append(cmd.Env, "HOME="+path)
|
cmd.Env = append(cmd.Env, "HOME="+path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//WithNotaryServer sets the location of the notary server
|
// WithNotaryServer sets the location of the notary server
|
||||||
func WithNotaryServer(notaryURL string) func(*icmd.Cmd) {
|
func WithNotaryServer(notaryURL string) func(*icmd.Cmd) {
|
||||||
return func(cmd *icmd.Cmd) {
|
return func(cmd *icmd.Cmd) {
|
||||||
env := append(os.Environ(),
|
env := append(os.Environ(),
|
||||||
|
@ -160,7 +160,7 @@ func ConvertPortToPortConfig(
|
|||||||
|
|
||||||
for i := startHostPort; i <= endHostPort; i++ {
|
for i := startHostPort; i <= endHostPort; i++ {
|
||||||
ports = append(ports, swarm.PortConfig{
|
ports = append(ports, swarm.PortConfig{
|
||||||
//TODO Name: ?
|
// TODO Name: ?
|
||||||
Protocol: swarm.PortConfigProtocol(strings.ToLower(port.Proto())),
|
Protocol: swarm.PortConfigProtocol(strings.ToLower(port.Proto())),
|
||||||
TargetPort: uint32(port.Int()),
|
TargetPort: uint32(port.Int()),
|
||||||
PublishedPort: uint32(i),
|
PublishedPort: uint32(i),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user