Skip to content

Commit

Permalink
implement runner constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
azenla committed Nov 14, 2024
1 parent e3626c7 commit 62032b5
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.matrix.outputs.matrix) }}
runs-on: edera-large
runs-on: "${{ matrix.builds.runner }}""
env:
KERNEL_PUBLISH: "${{ inputs.publish }}"
KERNEL_VERSION: "${{ matrix.builds.version }}"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# linux-kernel-oci (testing)
# linux-kernel-oci

Build the Linux kernel into OCI images.
5 changes: 5 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,8 @@ images:
- target: sdk
name: "[flavor]-kernel-sdk"
format: kernel.sdk
runners:
- name: edera-large
flavors:
- host
- name: ubuntu-latest
1 change: 1 addition & 0 deletions hack/build/generate-matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def construct_manual_matrix(exact_versions):
final_matrix = matrix.filter_matrix(final_matrix, constraint)

matrix.validate_produce_conflicts(final_matrix)
matrix.fill_runners(final_matrix)

print("generated %s builds" % len(final_matrix["builds"]))
matrix.summarize_matrix(final_matrix)
Expand Down
20 changes: 19 additions & 1 deletion hack/build/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,14 @@ def summarize_matrix(matrix):
image_names.append(image_name)
tags.sort()
print(
"build %s %s for %s with tags %s on %s"
"build %s %s for %s with tags %s to %s on %s"
% (
build["flavor"],
build["version"],
", ".join(build["architectures"]),
", ".join(tags),
", ".join(image_names),
build["runner"],
)
)

Expand Down Expand Up @@ -369,3 +370,20 @@ def generate_backbuild_matrix():
if major_minor in tags:
tags.pop(major_minor)
return generate_matrix(tags)


def pick_runner(build) -> str:
version = build["version"]
version_info = parse(version)
flavor = build["flavor"]
for runner in CONFIG["runners"]:
if matches_constraints(
version_info, flavor, runner, is_current_release=is_release_current(version)
):
return runner["name"]
raise Exception("No runner found for build %s" % build)


def fill_runners(matrix):
for build in matrix["builds"]:
build["runner"] = pick_runner(build)
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pyyaml
packaging

0 comments on commit 62032b5

Please sign in to comment.