This reverts commit 9c968e34afe34a5384c549c2f83ec401db01afb6.
| ... | ... |
@@ -138,15 +138,13 @@ func (c *builderConfig) execute(b builder) error {
|
| 138 | 138 |
} |
| 139 | 139 |
gitClient := git.NewRepositoryWithEnv(gitEnv) |
| 140 | 140 |
|
| 141 |
- /* |
|
| 142 |
- cgLimits, err := bld.GetCGroupLimits() |
|
| 143 |
- if err != nil {
|
|
| 144 |
- return fmt.Errorf("failed to retrieve cgroup limits: %v", err)
|
|
| 145 |
- } |
|
| 146 |
- glog.V(2).Infof("Running build with cgroup limits: %#v", *cgLimits)
|
|
| 147 |
- */ |
|
| 141 |
+ cgLimits, err := bld.GetCGroupLimits() |
|
| 142 |
+ if err != nil {
|
|
| 143 |
+ return fmt.Errorf("failed to retrieve cgroup limits: %v", err)
|
|
| 144 |
+ } |
|
| 145 |
+ glog.V(2).Infof("Running build with cgroup limits: %#v", *cgLimits)
|
|
| 148 | 146 |
|
| 149 |
- if err := b.Build(c.dockerClient, c.dockerEndpoint, c.buildsClient, c.build, gitClient, nil); err != nil {
|
|
| 147 |
+ if err := b.Build(c.dockerClient, c.dockerEndpoint, c.buildsClient, c.build, gitClient, cgLimits); err != nil {
|
|
| 150 | 148 |
return fmt.Errorf("build error: %v", err)
|
| 151 | 149 |
} |
| 152 | 150 |
|
| ... | ... |
@@ -144,12 +144,11 @@ func execPostCommitHook(client DockerClient, postCommitSpec api.BuildPostCommitS |
| 144 | 144 |
args = append([]string{script, command[0]}, args...)
|
| 145 | 145 |
} |
| 146 | 146 |
|
| 147 |
- /* |
|
| 148 |
- limits, err := GetCGroupLimits() |
|
| 149 |
- if err != nil {
|
|
| 150 |
- return fmt.Errorf("read cgroup limits: %v", err)
|
|
| 151 |
- } |
|
| 152 |
- */ |
|
| 147 |
+ limits, err := GetCGroupLimits() |
|
| 148 |
+ if err != nil {
|
|
| 149 |
+ return fmt.Errorf("read cgroup limits: %v", err)
|
|
| 150 |
+ } |
|
| 151 |
+ |
|
| 153 | 152 |
return dockerRun(client, docker.CreateContainerOptions{
|
| 154 | 153 |
Name: containerName, |
| 155 | 154 |
Config: &docker.Config{
|
| ... | ... |
@@ -158,14 +157,12 @@ func execPostCommitHook(client DockerClient, postCommitSpec api.BuildPostCommitS |
| 158 | 158 |
Cmd: args, |
| 159 | 159 |
}, |
| 160 | 160 |
HostConfig: &docker.HostConfig{
|
| 161 |
- // Limit container's resource allocation. |
|
| 162 |
- /* |
|
| 161 |
+ // Limit container's resource allocation. |
|
| 163 | 162 |
CPUShares: limits.CPUShares, |
| 164 | 163 |
CPUPeriod: limits.CPUPeriod, |
| 165 | 164 |
CPUQuota: limits.CPUQuota, |
| 166 | 165 |
Memory: limits.MemoryLimitBytes, |
| 167 | 166 |
MemorySwap: limits.MemorySwap, |
| 168 |
- */ |
|
| 169 | 167 |
}, |
| 170 | 168 |
}, docker.LogsOptions{
|
| 171 | 169 |
// Stream logs to stdout and stderr. |