Skip to content

Commit a271bed

Browse files
committed
Update readme and tests for example files
1 parent 8edde9b commit a271bed

File tree

7 files changed

+25
-10
lines changed

7 files changed

+25
-10
lines changed

examples/README.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,9 @@ To contribute a new example configuration file, adhere to the following guidelin
3939
- If necessary, include a ``README.rst`` file in the same directory as the configuration file to provide additional details or instructions.
4040
- Any supporting files required for the configuration should be placed alongside the configuration file.
4141

42-
Following these best practices ensures consistency, maintainability, and ease of use for all contributors and users.
42+
Following these best practices ensures consistency, maintainability, and ease of use for all contributors and users.
43+
44+
Excluding Example Configuration Files from Unit Tests
45+
=====================================================
46+
47+
To exclude an example configuration file from unit tests, add the file path to the ``excluded_example_files`` list in ``tests/test_buildrunner_files.py``.

examples/build/basic/buildrunner.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ steps:
33
simple-build-step:
44
build:
55
dockerfile: |
6-
FROM busybox:latest
6+
FROM alpine:latest
77
RUN echo Hello World

examples/build/inject/buildrunner.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ steps:
88
# The file /injectfile.txt will be injected into the build context
99
examples/build/inject/injectfile.txt: /injectfile.txt
1010
dockerfile: |
11-
FROM busybox
11+
FROM alpine
1212
# Step 2: Copy the injected file into the image or use it in some other way in the build process
1313
COPY /injectfile.txt /tmp/
1414
RUN cat /tmp/injectfile.txt

examples/build/platform/buildrunner.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ steps:
55
single-platform-build-step:
66
build:
77
dockerfile: |
8-
FROM busybox:latest
8+
FROM alpine:latest
99
RUN echo Hello World
10-
platform: linux/arm64/v8
10+
platform: linux/amd64

examples/build/platforms/buildrunner.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ steps:
55
multi-platform-build-step:
66
build:
77
dockerfile: |
8-
FROM busybox:latest
9-
RUN echo Hello World
8+
FROM alpine:latest
9+
LABEL custom_label="Buildrunner example label"
1010
platforms:
1111
- linux/amd64
12-
- linux/arm64/v8
12+
- linux/arm64

examples/run/basic/buildrunner.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
steps:
33
simple-run-step:
44
run:
5-
image: busybox:latest
5+
image: alpine:latest
66
cmd: echo Hello World

tests/test_buildrunner_files.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,21 @@ def _get_test_runs(
119119

120120
def _get_example_runs(test_dir: str) -> List[Tuple[str, str, Optional[List[str]], int]]:
121121
file_names = []
122+
123+
# Files that should be excluded from the example tests
124+
excluded_example_files = [
125+
"examples/build/import/buildrunner.yaml",
126+
]
127+
122128
# Walk through the examples directory and find all files ending with buildrunner.yaml
123129
for root, _, files in os.walk(test_dir):
124130
for file in files:
125131
file_name = os.path.join(root, file)
126-
if file_name.endswith("buildrunner.yaml"):
132+
if file_name.endswith("buildrunner.yaml") and not [
133+
excluded
134+
for excluded in excluded_example_files
135+
if file_name.endswith(excluded)
136+
]:
127137
file_names.append(file_name)
128138

129139
return [

0 commit comments

Comments
 (0)