chore(main): add reusable workflow to test installing slices#119
chore(main): add reusable workflow to test installing slices#119cjdcordeiro merged 15 commits intocanonical:mainfrom
Conversation
This commit adds a reusable workflow file .github/workflows/install-slices.yaml which can be used to test installing slices in changed or all slice definition files.
This commit modifies the reusable workflow to be aware if it should test installing all slices or not, if the install-all is not given. This reduces complexity on the calling workflow in the ubuntu-* branches.
cjdcordeiro
left a comment
There was a problem hiding this comment.
hum there's quite a lot of repetition here. You don't need the two separate workflows.
One is enough, where:
on:
workflow_call:
inputs:
install-all:
description: "If true, install all slices in slices/"
type: boolean
default: false
required: false
push:
branches:
- "main"
paths:
- ".github/**"
pull-request:
branches:
- "main"
paths:
- ".github/**"
schedule:
# Run at 00:00 every day.
# Ref: https://man7.org/linux/man-pages/man5/crontab.5.html
- cron: "0 0 * * *"and then you can have a dedicated job just for creating the "installation" matrix
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.prepare-install.outputs.install-matrix) }}|
That is an interesting idea. I tried to do that. But the problem is that matrix will need to be different based on whether the workflow has been called via I added another input to remove duplication. Please let me know what you think!
|
cjdcordeiro
left a comment
There was a problem hiding this comment.
Why does the matrix need to be different?
in both cases the matrix is:
strategy:
fail-fast: false
matrix:
branch: []
arch: []So you'll just need a job, before the matrix one, to create that map and pass it, as a JSON output, to the matrix job
If I have a PR (or push) targeted at |
|
But that's precisely where you can apply DRY. When there's a PR or a push against a specific branch, your matrix should look like: strategy:
fail-fast: false
matrix:
branch: ["ubuntu-22.04"]
arch: [amd64, ...]And then your |
|
On |
So you're saying that what you have now won't work? Cause you are already checkout out the ref given as an input. If that works, what's the problem with putting that variable in a matrix? |
|
Added the changes as discussed in our sync: 8682974. Please take a look. |
Yup.
|
great, thanks. That made me realize something though -> the test should be fixed such that it ignores the arch if there's no deb for it upstream. Otherwise we'll get this everyday: https://github.com/rebornplusplus/chisel-releases/actions/runs/7911557498/job/21595963413, which is a false positive |
Are you practically saying to ignore these errors on a error: slice package "dotnet-host" missing from archive(I wonder if there is any other way to check if the deb exists or not for a particular Ubuntu release, components and suites other than checking the If so, then I can add an option to the script (something like |
y this is what I'm saying. If it doesn't exist, it shouldn't throw an error. Like, .net only exists for arm64 and amd64, so, we'll be seeing errors everyday because of that, when in reality it's not an error. The script should only test the |
This commit re-writes the "install-slices" script from bash to python, for better maintainability and easier addition of new features and requirements.
|
I have added the option to ignore missing packages.
I have also re-written the "install-slices" script from bash to python for better maintainability. Example run for a PR: https://github.com/rebornplusplus/chisel-releases/actions/runs/7868931941/job/21646126428?pr=2 |
cjdcordeiro
left a comment
There was a problem hiding this comment.
I have added the option to ignore missing packages.
- When installing all slices, if a package has not been found in the archive, there will be no errors.
- In other cases, where we are only installing changed slices/paths, missing packages will not be ignored and will result in an error like before. This is useful in PRs
I have also re-written the "install-slices" script from bash to python for better maintainability.
Example run for a PR: https://github.com/rebornplusplus/chisel-releases/actions/runs/7868931941/job/21646126428?pr=2 Example run for installing all slices: https://github.com/rebornplusplus/chisel-releases/actions/runs/7928229576/job/21646097589
I'm wondering...
- When installing all slices, if a package has not been found in the archive, there will be no errors.
I tend to agree, but what if the package is removed from upstream? Like, completely...which afaik can happen for dev releases (noble atm). Then we would end up with a SDF in the release that doesn't work, at all.
I think the check should be: the package must exist for at least 1 arch. If it doesn't exist, at all, for a given release, then we'll be shooting ourselves in the foot everytime we open a new release, cause we won't be able to easily port the previous release onto the new one...not without potentially adding SDFs for packages that don't exist.
- In other cases, where we are only installing changed slices/paths, missing packages will not be ignored and will result in an error like before. This is useful in PRs
Why? It's the same rationale as above...someone could try to add an SDF for a package that doesn't belong on that release.
I think there should be a check, before the multi-arch matrix, to validate that the slices can be tested - i.e. the package exists in the release.
|
I have changed the script. The current behaviour of the script is the following:
We are only passing the Usage info of the scriptExample runs: |
cjdcordeiro
left a comment
There was a problem hiding this comment.
With a few additional changes you should also be able to significantly increase the pylint score.
This commit improves the install_slices script. The commit also re-organises the files -- all the relevant files are put under ".github/scripts/install_slices" directory now. It also adds a new file "pkglist" which contains the required debian packages for running the script smoothly.
cjdcordeiro
left a comment
There was a problem hiding this comment.
great! thanks! lgtm. let's see it in action
|
I'll merge it once we get a 👍 from @linostar |
This PR adds a reusable workflow file
.github/workflows/install-slices.yamlwhich can be used to test installing slices in changed or all slice definition files. It also adds a helper scriptgithub/scripts/install-slicesused by the mentioned workflow file.Example: rebornplusplus#2