Skip to content
This repository has been archived by the owner on Oct 2, 2022. It is now read-only.

Commit

Permalink
0.9.12: Moved to using the ContainerSSH agent for the init process
Browse files Browse the repository at this point in the history
This release moves to using the new ContainerSSH agent `wait-signal` feature as an init process instead of the bash solution.
  • Loading branch information
Janos Pasztor committed Mar 30, 2021
1 parent 1a9af27 commit 68d4a67
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 109 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.9.12: Moved to using the ContainerSSH agent for the init process

This release moves to using the new ContainerSSH agent `wait-signal` feature as an init process instead of the bash solution.

## 0.9.11: Better JSON and YAML support

Explicitly disabled internal fields in JSON or YAML.
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ connectionID := "0123456789ABCDEF"
config := docker.Config{
//...
}
collector := metrics.New
collector := metrics.New()
dr, err := docker.New(
client,
connectionID,
config,
logger,
collector.MustCreateCounter("backend_requests", "", ""),
collector.MustCreateCounter("backend_failures", "", ""),
)
if err != nil {
// Handle error
Expand Down
2 changes: 1 addition & 1 deletion config_execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type ExecutionConfig struct {
Mode ExecutionMode `json:"mode" yaml:"mode" default:"connection"`

// IdleCommand is the command that runs as the first process in the container in ExecutionModeConnection. Ignored in ExecutionModeSession.
IdleCommand []string `json:"idleCommand" yaml:"idleCommand" comment:"Run this command to wait for container exit" default:"[\"/bin/sh\", \"-c\", \"sleep infinity & PID=$!; trap \\\"kill $PID\\\" INT TERM; wait\"]"`
IdleCommand []string `json:"idleCommand" yaml:"idleCommand" comment:"Run this command to wait for container exit" default:"[\"/usr/bin/containerssh-agent\", \"wait-signal\", \"--signal\", \"INT\", \"--signal\", \"TERM\"]"`
// ShellCommand is the command used for launching shells when the container is in ExecutionModeConnection. Ignored in ExecutionModeSession.
ShellCommand []string `json:"shellCommand" yaml:"shellCommand" comment:"Run this command as a default shell." default:"[\"/bin/bash\"]"`
// AgentPath contains the path to the ContainerSSH Guest Agent.
Expand Down
3 changes: 1 addition & 2 deletions conformance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func TestConformance(t *testing.T) {
//goland:noinspection GoDeprecation
config := docker.DockerRunConfig{}
structutils.Defaults(&config)

testFile, err := os.Open("testdata/config-0.3.yaml")
if err != nil {
return nil, err
Expand All @@ -36,15 +37,13 @@ func TestConformance(t *testing.T) {
"session": func(logger log.Logger) (sshserver.NetworkConnectionHandler, error) {
config := docker.Config{}
structutils.Defaults(&config)
config.Execution.ShellCommand = []string{"/bin/sh"}

config.Execution.Mode = docker.ExecutionModeSession
return getDocker(config, logger)
},
"connection": func(logger log.Logger) (sshserver.NetworkConnectionHandler, error) {
config := docker.Config{}
structutils.Defaults(&config)
config.Execution.ShellCommand = []string{"/bin/sh"}

config.Execution.Mode = docker.ExecutionModeConnection
return getDocker(config, logger)
Expand Down
17 changes: 5 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,28 @@ require (
github.com/containerssh/geoip v0.9.4
github.com/containerssh/log v0.9.13
github.com/containerssh/metrics v0.9.8
github.com/containerssh/sshserver v0.9.20
github.com/containerssh/sshserver v0.9.24
github.com/containerssh/structutils v0.9.0
github.com/containerssh/unixutils v0.9.0
github.com/docker/distribution v2.7.1+incompatible
github.com/docker/docker v20.10.5+incompatible
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/fzipp/gocyclo v0.3.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.1 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.5
github.com/gordonklaus/ineffassign v0.0.0-20200809085317-e36bfde3bb78 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/magefile/mage v1.11.0 // indirect
github.com/mattn/go-shellwords v1.0.11 // indirect
github.com/moby/term v0.0.0-20201216013528-df9cb8a40635 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.1
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/stretchr/testify v1.7.0
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 // indirect
golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 // indirect
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 // indirect
golang.org/x/net v0.0.0-20210330142815-c8897c278d10 // indirect
golang.org/x/sys v0.0.0-20210326220804-49726bf1d181 // indirect
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect
google.golang.org/genproto v0.0.0-20210322173543-5f0e89347f5a // indirect
google.golang.org/grpc v1.36.0 // indirect
google.golang.org/genproto v0.0.0-20210330181207-2295ebbda0c6 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
gotest.tools/v3 v3.0.3 // indirect
)
Expand Down
Loading

0 comments on commit 68d4a67

Please sign in to comment.