-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.github: refactor job matrix generation into YAML files #26019
Conversation
This commit addresses two main issues and introduces a more streamlined approach to generating job matrices for GitHub Actions. By migrating the job matrix definition into YAML files, we gain the ability to separate scheduled jobs and pull requests (PRs) into specific files, ensuring comprehensive testing coverage similar to what we have with Jenkins. The first benefit of this approach is the improved organization of job definitions. With separate files for scheduled jobs and PRs, it becomes easier to manage and maintain testing configurations independently. This modular structure allows us to make changes to specific job types without impacting others, enhancing overall maintainability. The second advantage is with help of jq, we can define kernel versions for all desired Kubernetes (k8s) versions to be tested without manually commenting out unwanted versions. Previously, when using the "include" mechanism, certain k8s versions like 1.24 had to be commented out to prevent their execution. However, with jq, we can selectively include only the desired k8s versions by mapping them with the definitions in main-prs.yaml or main-scheduled.yaml. Lastly, this refactor enables per-branch configuration through prefixed filenames. By structuring configuration files with branch-specific prefixes, we can easily define and manage job configurations tailored to stable branches. Signed-off-by: André Martins <andre@cilium.io>
ref: ${{ needs.check_changes.outputs.matrix_sha }} | ||
persist-credentials: false | ||
|
||
- name: Convert YAML to JSON |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this done because we need jq
-specific features that yq
is lacking?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nebril no, it's because of the there isn't a fromYaml
function, similar to the fromJson
on GitHub as documented https://docs.github.com/en/enterprise-cloud@latest/actions/learn-github-actions/expressions#fromjson
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome! I think one thing missing would be adding some kind of yaml schema for new branch-*.yaml
files, that would validate their structure. I think that debugging errors made in these files would be pretty painful, so it might make sense to make these as obvious as possible.
I don't think it's blocking though, it could be tracked in a new issue.
This commit addresses two main issues and introduces a more streamlined approach to generating job matrices for GitHub Actions. By migrating the job matrix definition into YAML files, we gain the ability to separate scheduled jobs and pull requests (PRs) into specific files, ensuring comprehensive testing coverage similar to what we have with Jenkins.
The first benefit of this approach is the improved organization of job definitions. With separate files for scheduled jobs and PRs, it becomes easier to manage and maintain testing configurations independently. This modular structure allows us to make changes to specific job types without impacting others, enhancing overall maintainability.
The second advantage is with help of jq, we can define kernel versions for all desired Kubernetes (k8s) versions to be tested without manually commenting out unwanted versions. Previously, when using the "include" mechanism, certain k8s versions like 1.24 had to be commented out to prevent their execution. However, with jq, we can selectively include only the desired k8s versions by mapping them with the definitions in main-prs.yaml or main-scheduled.yaml.
Lastly, this refactor enables per-branch configuration through prefixed filenames. By structuring configuration files with branch-specific prefixes, we can easily define and manage job configurations tailored to stable branches.