diff --git a/CHANGELOG.md b/CHANGELOG.md index 76a4908..a9ba7db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased +### Added +- support for setting default container shmsize + ### Changed - update environment extension protocol to version 2 - registry credentials stored in repository secrets take precedence over globals +### Fixed +- ignoring global memory limit and memory swap limit + ### Added - support for environment extension variable masking - support for username/password in config.json files diff --git a/command/daemon/config.go b/command/daemon/config.go index a512b7e..1f7cd1e 100644 --- a/command/daemon/config.go +++ b/command/daemon/config.go @@ -76,6 +76,7 @@ type Config struct { CPUPeriod int64 `envconfig:"DRONE_CPU_PERIOD"` CPUShares int64 `envconfig:"DRONE_CPU_SHARES"` CPUSet []string `envconfig:"DRONE_CPU_SET"` + ShmSize int64 `envconfig:"DRONE_SHM_SIZE"` } Environ struct { diff --git a/command/daemon/daemon.go b/command/daemon/daemon.go index 9d1173f..e5437ff 100644 --- a/command/daemon/daemon.go +++ b/command/daemon/daemon.go @@ -131,6 +131,7 @@ func (c *daemonCommand) run(*kingpin.ParseContext) error { CPUPeriod: config.Resources.CPUPeriod, CPUShares: config.Resources.CPUShares, CPUSet: config.Resources.CPUSet, + ShmSize: config.Resources.ShmSize, }, Environ: provider.Combine( provider.Static(config.Runner.Environ), diff --git a/engine/compiler/compiler.go b/engine/compiler/compiler.go index 4e06123..81782d8 100644 --- a/engine/compiler/compiler.go +++ b/engine/compiler/compiler.go @@ -51,6 +51,7 @@ type Resources struct { CPUPeriod int64 CPUShares int64 CPUSet []string + ShmSize int64 } // Compiler compiles the Yaml configuration file to an @@ -371,12 +372,15 @@ func (c *Compiler) Compile(ctx context.Context, args runtime.CompilerArgs) runti // the resource limits defined in the yaml currently // take precedence over global values. This is something // we should re-think in a future release. - if step.MemSwapLimit != 0 { + if step.MemSwapLimit == 0 { step.MemSwapLimit = c.Resources.MemorySwap } - if step.MemLimit != 0 { + if step.MemLimit == 0 { step.MemLimit = c.Resources.Memory } + if step.ShmSize == 0 { + step.ShmSize = c.Resources.ShmSize + } step.CPUPeriod = c.Resources.CPUPeriod step.CPUQuota = c.Resources.CPUQuota step.CPUShares = c.Resources.CPUShares diff --git a/go.mod b/go.mod index 76fbc5d..f177551 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/drone/drone-go v1.2.1-0.20200326064413-195394da1018 github.com/drone/drone-runtime v1.1.0 github.com/drone/envsubst v1.0.2 - github.com/drone/runner-go v1.6.1-0.20200327163121-437a98da1948 + github.com/drone/runner-go v1.6.1-0.20200415161953-7df9235cfbdb github.com/drone/signal v1.0.0 github.com/ghodss/yaml v1.0.0 github.com/golang/mock v1.3.1 diff --git a/go.sum b/go.sum index a999096..bf00ad4 100644 --- a/go.sum +++ b/go.sum @@ -79,6 +79,8 @@ github.com/drone/runner-go v1.6.1-0.20200326064521-a238edf7e8d1 h1:jeZz31BlXzGx+ github.com/drone/runner-go v1.6.1-0.20200326064521-a238edf7e8d1/go.mod h1:+Zc4z9/xqlqkFkAcqOtuYjYS77d2PeuWh0PxxibHfNs= github.com/drone/runner-go v1.6.1-0.20200327163121-437a98da1948 h1:YZMRQrYZaDApfIQFtXUHusyeoWHWHlfnENxFrjr38fI= github.com/drone/runner-go v1.6.1-0.20200327163121-437a98da1948/go.mod h1:+Zc4z9/xqlqkFkAcqOtuYjYS77d2PeuWh0PxxibHfNs= +github.com/drone/runner-go v1.6.1-0.20200415161953-7df9235cfbdb h1:Z6sPkIuKY8rCpVPROlFlicdtH9/zPmn6TS9NFXnR1TA= +github.com/drone/runner-go v1.6.1-0.20200415161953-7df9235cfbdb/go.mod h1:+Zc4z9/xqlqkFkAcqOtuYjYS77d2PeuWh0PxxibHfNs= github.com/drone/signal v1.0.0 h1:NrnM2M/4yAuU/tXs6RP1a1ZfxnaHwYkd0kJurA1p6uI= github.com/drone/signal v1.0.0/go.mod h1:S8t92eFT0g4WUgEc/LxG+LCuiskpMNsG0ajAMGnyZpc= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=