Merge branch 'master' into addRedoSnapshotter
This commit is contained in:
commit
c511cb7689
|
|
@ -166,6 +166,21 @@ Additionally, the integration tests can output benchmarking information to a `be
|
|||
BENCHMARK=true go test -v --bucket $GCS_BUCKET --repo $IMAGE_REPO
|
||||
```
|
||||
|
||||
#### Benchmarking your GCB runs
|
||||
If you are GCB builds are slow, you can check which phases in kaniko are bottlenecks or taking more time.
|
||||
To do this, add "BENCHMARK_ENV" to your cloudbuild.yaml like this.
|
||||
```shell script
|
||||
steps:
|
||||
- name: 'gcr.io/kaniko-project/executor:latest'
|
||||
args:
|
||||
- --build-arg=NUM=${_COUNT}
|
||||
- --no-push
|
||||
- --snapshotMode=redo
|
||||
env:
|
||||
- 'BENCHMARK_FILE=gs://$PROJECT_ID/gcb/benchmark_file'
|
||||
```
|
||||
You can download the file `gs://$PROJECT_ID/gcb/benchmark_file` using `gsutil cp` command.
|
||||
|
||||
## Creating a PR
|
||||
|
||||
When you have changes you would like to propose to kaniko, you will need to:
|
||||
|
|
|
|||
|
|
@ -1,3 +1,16 @@
|
|||
# Copyright 2020 Google, Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
FROM bash:4.4
|
||||
|
||||
ARG NUM
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
steps:
|
||||
- name: 'gcr.io/kaniko-project/executor:perf-latest'
|
||||
- name: 'gcr.io/kaniko-project/executor:latest'
|
||||
args:
|
||||
- --build-arg=NUM=${_COUNT}
|
||||
- --no-push
|
||||
- --snapshotMode=redo
|
||||
env:
|
||||
- 'BENCHMARK_FILE=gs://tejal-test/redo_gcb/benchmark_file_${_COUNT}'
|
||||
- 'BENCHMARK_FILE=gs://$PROJECT_ID/gcb/benchmark_file_${_COUNT}'
|
||||
timeout: 2400s
|
||||
timeout: 2400s
|
||||
substitutions:
|
||||
|
|
|
|||
|
|
@ -132,10 +132,10 @@ func TestSnapshotBenchmarkGcloud(t *testing.T) {
|
|||
for _, num := range nums {
|
||||
t.Run(fmt.Sprintf("test_benchmark_%d", num), func(t *testing.T) {
|
||||
wg.Add(1)
|
||||
var err error
|
||||
go func(num int, err error) {
|
||||
go func(num int) {
|
||||
dir, err := runInGcloud(contextDir, num)
|
||||
if err != nil {
|
||||
t.Errorf("error when running in gcloud %v", err)
|
||||
return
|
||||
}
|
||||
r := newResult(t, filepath.Join(dir, "results"))
|
||||
|
|
@ -143,10 +143,7 @@ func TestSnapshotBenchmarkGcloud(t *testing.T) {
|
|||
wg.Done()
|
||||
defer os.Remove(dir)
|
||||
defer os.Chdir(cwd)
|
||||
}(num, err)
|
||||
if err != nil {
|
||||
t.Errorf("could not run benchmark results for num %d due to %s", num, err)
|
||||
}
|
||||
}(num)
|
||||
})
|
||||
}
|
||||
wg.Wait()
|
||||
|
|
@ -167,7 +164,7 @@ func runInGcloud(dir string, num int) (string, error) {
|
|||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
src := fmt.Sprintf("gs://tejal-test/redo_gcb/benchmark_file_%d", num)
|
||||
src := fmt.Sprintf("%s/gcb/benchmark_file_%d", config.gcsBucket, num)
|
||||
dest := filepath.Join(tmpDir, "results")
|
||||
copyCommand := exec.Command("gsutil", "cp", src, dest)
|
||||
_, err = RunCommandWithoutTest(copyCommand)
|
||||
|
|
|
|||
Loading…
Reference in New Issue