Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions core/runjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type RunJob struct {
Network string
Hostname string
Container string
Entrypoint string
Volume []string
VolumesFrom []string `gcfg:"volumes-from" mapstructure:"volumes-from,"`
Environment []string
Expand Down Expand Up @@ -170,6 +171,7 @@ func (j *RunJob) buildContainer() (*docker.Container, error) {
AttachStdout: true,
AttachStderr: true,
Tty: j.TTY,
Entrypoint: args.GetArgs(j.Entrypoint),
Cmd: args.GetArgs(j.Command),
User: j.User,
Env: j.Environment,
Expand Down
2 changes: 2 additions & 0 deletions core/runjob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func (s *SuiteRunJob) SetUpTest(c *C) {
func (s *SuiteRunJob) TestRun(c *C) {
job := &RunJob{Client: s.client}
job.Image = ImageFixture
job.Entrypoint = "/bin/bash -c"
job.Command = `echo -a "foo bar"`
job.User = "foo"
job.TTY = true
Expand Down Expand Up @@ -62,6 +63,7 @@ func (s *SuiteRunJob) TestRun(c *C) {
time.Sleep(200 * time.Millisecond)
container, err := job.getContainer()
c.Assert(err, IsNil)
c.Assert(container.Config.Entrypoint, DeepEquals, []string{"/bin/bash", "-c"})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would need two test cases for this, one with no Entrypoint provided to make sure that default value is honoured and another with entrypoint to make sure that default one is overwritten

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@taraspos sure, I will add the tests once I got the chance 👌

c.Assert(container.Config.Cmd, DeepEquals, []string{"echo", "-a", "foo bar"})
c.Assert(container.Config.User, Equals, job.User)
c.Assert(container.Config.Image, Equals, job.Image)
Expand Down
4 changes: 4 additions & 0 deletions docs/jobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ This job can be used in 2 situations:
- *description*: When the job should be executed. E.g. every 10 seconds or every night at 1 AM.
- *value*: String, see [Scheduling format](https://godoc.org/github.com/robfig/cron) of the Go implementation of `cron`. E.g. `@every 10s` or `0 0 1 * * *` (every night at 1 AM). **Note**: the format starts with seconds, instead of minutes.
- *default*: Required field, no default.
- **Entrypoint** (1)
- *description*: Override container default entrypoint.
- *value*: String, e.g. `/bin/bash -c`
- *default*: Default container entrypoint
- **Command** (1)
- *description*: Command you want to run inside the container.
- *value*: String, e.g. `touch /tmp/example`
Expand Down