File tree 16 files changed +136
-21
lines changed 16 files changed +136
-21
lines changed Original file line number Diff line number Diff line change @@ -237,6 +237,10 @@ def py_library(self, **kwargs) -> Path:
237
237
if "samples" not in kwargs :
238
238
self .excludes += ["samples/AUTHORING_GUIDE.md" , "samples/CONTRIBUTING.md" ]
239
239
240
+ # Assume the python-docs-samples Dockerfile is used for samples by default
241
+ if "custom_samples_dockerfile" not in kwargs :
242
+ kwargs ["custom_samples_dockerfile" ] = False
243
+
240
244
ret = self ._generic_library ("python_library" , ** kwargs )
241
245
242
246
# If split_system_tests is set to True, we disable the system
Original file line number Diff line number Diff line change @@ -17,18 +17,29 @@ env_vars: {
17
17
key: " TRAMPOLINE_BUILD_FILE"
18
18
value: " github/{{ metadata['repo']['repo'].split('/')[1] }}/.kokoro/test-samples.sh"
19
19
}
20
+ {% if custom_samples_dockerfile %}
21
+ env_vars: {
22
+ key: " TRAMPOLINE_IMAGE"
23
+ value: " gcr.io/cloud-devrel-kokoro-resources/{{ metadata['repo']['repo'].split('/')[1] }}-samples-docker"
24
+ }
20
25
26
+ # Configure the docker image for kokoro-trampoline.
27
+ env_vars: {
28
+ key: " TRAMPOLINE_DOCKERFILE"
29
+ value: " .kokoro/docker/samples/Dockerfile"
30
+ }
31
+ {% else %}
21
32
# Configure the docker image for kokoro-trampoline.
22
33
env_vars: {
23
34
key: " TRAMPOLINE_IMAGE"
24
35
value: " gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
25
36
}
26
-
37
+ {% endif %}
27
38
# Download secrets for samples
28
39
gfile_resources: " /bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
29
40
30
41
# Download trampoline resources.
31
42
gfile_resources: " /bigstore/cloud-devrel-kokoro-resources/trampoline"
32
43
33
44
# Use the trampoline script to run in docker.
34
- build_file: " {{ metadata['repo']['repo'].split('/')[1] }}/.kokoro/trampoline .sh"
45
+ build_file: " {{ metadata['repo']['repo'].split('/')[1] }}/.kokoro/trampoline_v2 .sh"
Original file line number Diff line number Diff line change @@ -23,18 +23,29 @@ env_vars: {
23
23
key: " TRAMPOLINE_BUILD_FILE"
24
24
value: " github/{{ metadata['repo']['repo'].split('/')[1] }}/.kokoro/test-samples.sh"
25
25
}
26
+ {% if custom_samples_dockerfile %}
27
+ env_vars: {
28
+ key: " TRAMPOLINE_IMAGE"
29
+ value: " gcr.io/cloud-devrel-kokoro-resources/{{ metadata['repo']['repo'].split('/')[1] }}-samples-docker"
30
+ }
26
31
32
+ # Configure the docker image for kokoro-trampoline.
33
+ env_vars: {
34
+ key: " TRAMPOLINE_DOCKERFILE"
35
+ value: " .kokoro/docker/samples/Dockerfile"
36
+ }
37
+ {% else %}
27
38
# Configure the docker image for kokoro-trampoline.
28
39
env_vars: {
29
40
key: " TRAMPOLINE_IMAGE"
30
41
value: " gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
31
42
}
32
-
43
+ {% endif %}
33
44
# Download secrets for samples
34
45
gfile_resources: " /bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
35
46
36
47
# Download trampoline resources.
37
48
gfile_resources: " /bigstore/cloud-devrel-kokoro-resources/trampoline"
38
49
39
50
# Use the trampoline script to run in docker.
40
- build_file: " {{ metadata['repo']['repo'].split('/')[1] }}/.kokoro/trampoline .sh"
51
+ build_file: " {{ metadata['repo']['repo'].split('/')[1] }}/.kokoro/trampoline_v2 .sh"
Original file line number Diff line number Diff line change @@ -9,3 +9,10 @@ env_vars: {
9
9
key: " TRAMPOLINE_BUILD_FILE"
10
10
value: " github/{{ metadata['repo']['repo'].split('/')[1] }}/.kokoro/test-samples-against-head.sh"
11
11
}
12
+ {% if custom_samples_dockerfile %}
13
+ # Upload the docker image after successful builds.
14
+ env_vars: {
15
+ key: " TRAMPOLINE_IMAGE_UPLOAD"
16
+ value: " true"
17
+ }
18
+ {% endif %}
Original file line number Diff line number Diff line change 3
3
env_vars: {
4
4
key: " INSTALL_LIBRARY_FROM_SOURCE"
5
5
value: " False"
6
- }
6
+ }
7
+ {% if custom_samples_dockerfile %}
8
+ # Upload the docker image after successful builds.
9
+ env_vars: {
10
+ key: " TRAMPOLINE_IMAGE_UPLOAD"
11
+ value: " true"
12
+ }
13
+ {% endif %}
Original file line number Diff line number Diff line change @@ -23,18 +23,29 @@ env_vars: {
23
23
key: " TRAMPOLINE_BUILD_FILE"
24
24
value: " github/{{ metadata['repo']['repo'].split('/')[1] }}/.kokoro/test-samples.sh"
25
25
}
26
+ {% if custom_samples_dockerfile %}
27
+ env_vars: {
28
+ key: " TRAMPOLINE_IMAGE"
29
+ value: " gcr.io/cloud-devrel-kokoro-resources/{{ metadata['repo']['repo'].split('/')[1] }}-samples-docker"
30
+ }
26
31
32
+ # Configure the docker image for kokoro-trampoline.
33
+ env_vars: {
34
+ key: " TRAMPOLINE_DOCKERFILE"
35
+ value: " .kokoro/docker/samples/Dockerfile"
36
+ }
37
+ {% else %}
27
38
# Configure the docker image for kokoro-trampoline.
28
39
env_vars: {
29
40
key: " TRAMPOLINE_IMAGE"
30
41
value: " gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
31
42
}
32
-
43
+ {% endif %}
33
44
# Download secrets for samples
34
45
gfile_resources: " /bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
35
46
36
47
# Download trampoline resources.
37
48
gfile_resources: " /bigstore/cloud-devrel-kokoro-resources/trampoline"
38
49
39
50
# Use the trampoline script to run in docker.
40
- build_file: " {{ metadata['repo']['repo'].split('/')[1] }}/.kokoro/trampoline .sh"
51
+ build_file: " {{ metadata['repo']['repo'].split('/')[1] }}/.kokoro/trampoline_v2 .sh"
Original file line number Diff line number Diff line change 3
3
env_vars: {
4
4
key: " INSTALL_LIBRARY_FROM_SOURCE"
5
5
value: " False"
6
- }
6
+ }
7
+ {% if custom_samples_dockerfile %}
8
+ # Upload the docker image after successful builds.
9
+ env_vars: {
10
+ key: " TRAMPOLINE_IMAGE_UPLOAD"
11
+ value: " true"
12
+ }
13
+ {% endif %}
Original file line number Diff line number Diff line change @@ -23,18 +23,29 @@ env_vars: {
23
23
key: " TRAMPOLINE_BUILD_FILE"
24
24
value: " github/{{ metadata['repo']['repo'].split('/')[1] }}/.kokoro/test-samples.sh"
25
25
}
26
+ {% if custom_samples_dockerfile %}
27
+ env_vars: {
28
+ key: " TRAMPOLINE_IMAGE"
29
+ value: " gcr.io/cloud-devrel-kokoro-resources/{{ metadata['repo']['repo'].split('/')[1] }}-samples-docker"
30
+ }
26
31
32
+ # Configure the docker image for kokoro-trampoline.
33
+ env_vars: {
34
+ key: " TRAMPOLINE_DOCKERFILE"
35
+ value: " .kokoro/docker/samples/Dockerfile"
36
+ }
37
+ {% else %}
27
38
# Configure the docker image for kokoro-trampoline.
28
39
env_vars: {
29
40
key: " TRAMPOLINE_IMAGE"
30
41
value: " gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
31
42
}
32
-
43
+ {% endif %}
33
44
# Download secrets for samples
34
45
gfile_resources: " /bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
35
46
36
47
# Download trampoline resources.
37
48
gfile_resources: " /bigstore/cloud-devrel-kokoro-resources/trampoline"
38
49
39
50
# Use the trampoline script to run in docker.
40
- build_file: " {{ metadata['repo']['repo'].split('/')[1] }}/.kokoro/trampoline .sh"
51
+ build_file: " {{ metadata['repo']['repo'].split('/')[1] }}/.kokoro/trampoline_v2 .sh"
Original file line number Diff line number Diff line change @@ -9,3 +9,10 @@ env_vars: {
9
9
key: " TRAMPOLINE_BUILD_FILE"
10
10
value: " github/{{ metadata['repo']['repo'].split('/')[1] }}/.kokoro/test-samples-against-head.sh"
11
11
}
12
+ {% if custom_samples_dockerfile %}
13
+ # Upload the docker image after successful builds.
14
+ env_vars: {
15
+ key: " TRAMPOLINE_IMAGE_UPLOAD"
16
+ value: " true"
17
+ }
18
+ {% endif %}
Original file line number Diff line number Diff line change 3
3
env_vars: {
4
4
key: " INSTALL_LIBRARY_FROM_SOURCE"
5
5
value: " False"
6
- }
6
+ }
7
+ {% if custom_samples_dockerfile %}
8
+ # Upload the docker image after successful builds.
9
+ env_vars: {
10
+ key: " TRAMPOLINE_IMAGE_UPLOAD"
11
+ value: " true"
12
+ }
13
+ {% endif %}
Original file line number Diff line number Diff line change @@ -23,18 +23,29 @@ env_vars: {
23
23
key: " TRAMPOLINE_BUILD_FILE"
24
24
value: " github/{{ metadata['repo']['repo'].split('/')[1] }}/.kokoro/test-samples.sh"
25
25
}
26
+ {% if custom_samples_dockerfile %}
27
+ env_vars: {
28
+ key: " TRAMPOLINE_IMAGE"
29
+ value: " gcr.io/cloud-devrel-kokoro-resources/{{ metadata['repo']['repo'].split('/')[1] }}-samples-docker"
30
+ }
26
31
32
+ # Configure the docker image for kokoro-trampoline.
33
+ env_vars: {
34
+ key: " TRAMPOLINE_DOCKERFILE"
35
+ value: " .kokoro/docker/samples/Dockerfile"
36
+ }
37
+ {% else %}
27
38
# Configure the docker image for kokoro-trampoline.
28
39
env_vars: {
29
40
key: " TRAMPOLINE_IMAGE"
30
41
value: " gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
31
42
}
32
-
43
+ {% endif %}
33
44
# Download secrets for samples
34
45
gfile_resources: " /bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
35
46
36
47
# Download trampoline resources.
37
48
gfile_resources: " /bigstore/cloud-devrel-kokoro-resources/trampoline"
38
49
39
50
# Use the trampoline script to run in docker.
40
- build_file: " {{ metadata['repo']['repo'].split('/')[1] }}/.kokoro/trampoline .sh"
51
+ build_file: " {{ metadata['repo']['repo'].split('/')[1] }}/.kokoro/trampoline_v2 .sh"
Original file line number Diff line number Diff line change @@ -9,3 +9,10 @@ env_vars: {
9
9
key: " TRAMPOLINE_BUILD_FILE"
10
10
value: " github/{{ metadata['repo']['repo'].split('/')[1] }}/.kokoro/test-samples-against-head.sh"
11
11
}
12
+ {% if custom_samples_dockerfile %}
13
+ # Upload the docker image after successful builds.
14
+ env_vars: {
15
+ key: " TRAMPOLINE_IMAGE_UPLOAD"
16
+ value: " true"
17
+ }
18
+ {% endif %}
Original file line number Diff line number Diff line change 3
3
env_vars: {
4
4
key: " INSTALL_LIBRARY_FROM_SOURCE"
5
5
value: " False"
6
- }
6
+ }
7
+ {% if custom_samples_dockerfile %}
8
+ # Upload the docker image after successful builds.
9
+ env_vars: {
10
+ key: " TRAMPOLINE_IMAGE_UPLOAD"
11
+ value: " true"
12
+ }
13
+ {% endif %}
Original file line number Diff line number Diff line change @@ -23,6 +23,4 @@ set -eo pipefail
23
23
# Enables `**` to include files nested inside sub-folders
24
24
shopt -s globstar
25
25
26
- cd github/{{ metadata[' repo' ][' repo' ].split(' /' )[1] }}
27
-
28
26
exec .kokoro/test-samples-impl.sh
Original file line number Diff line number Diff line change @@ -24,8 +24,6 @@ set -eo pipefail
24
24
# Enables `**` to include files nested inside sub-folders
25
25
shopt -s globstar
26
26
27
- cd github/{{ metadata[' repo' ][' repo' ].split(' /' )[1] }}
28
-
29
27
# Run periodic samples tests at latest release
30
28
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = * " periodic" * ]]; then
31
29
# preserving the test runner implementation.
Original file line number Diff line number Diff line change 16
16
17
17
# Add required env vars here.
18
18
required_envvars+=(
19
- "STAGING_BUCKET"
20
- "V2_STAGING_BUCKET"
21
19
)
22
20
23
21
# Add env vars which are passed down into the container here.
24
22
pass_down_envvars+=(
23
+ "NOX_SESSION"
24
+ ###############
25
+ # Docs builds
26
+ ###############
25
27
"STAGING_BUCKET"
26
28
"V2_STAGING_BUCKET"
27
- "NOX_SESSION"
29
+ ##################
30
+ # Samples builds
31
+ ##################
32
+ "INSTALL_LIBRARY_FROM_SOURCE"
33
+ "RUN_TESTS_SESSION"
34
+ "BUILD_SPECIFIC_GCLOUD_PROJECT"
35
+ # Target directories.
36
+ "RUN_TESTS_DIRS"
37
+ # The nox session to run.
38
+ "RUN_TESTS_SESSION"
28
39
)
29
40
30
41
# Prevent unintentional override on the default image.
You can’t perform that action at this time.
0 commit comments