dd010101 / vyos-jenkins

How build packages from VyOS stable branches (1.3 equuleus/1.4 sagitta) with Jenkins (and then build ISO from them)
87 stars 28 forks source link

jenkins package build jobs branch selection #29

Closed UnixxSH closed 3 months ago

UnixxSH commented 3 months ago

First - many thanks to provide such a way to build VyOS, considering the last annoucements they did without proper documentation.

I just wanted to know if there is a way to only build the packages for sagitta for example ? I had to delete the equuleus ones in ./jobs/project-jobs.json, as I do not need packages for 1.3.

Thanks.

GurliGebis commented 3 months ago

If you remove the equuleus packages from there, it won't build them. But, depending on your hardware, the overhead of building both isn't that big.

dd010101 commented 3 months ago

Most of the equuleus packages don't take much time/resources to build but there are few exceptions like the kernel. Also many small ones will add up. That's why if you don't want equuleus (or sagitta) then it makes sense to add support to exclude it. There is no option to do it as of now.

If you delete "equuleus-only" that's not the whole solution since many packages are shared and to exclude shared packages you would need to adjust the branch regex correctly - not easy to do. Not only in the project-jobs.json but also in docker-container-jobs.json.

Thus I added the option to build only specific branch, check the readme for "If you want to build only specific branch" how to use it.

Let me know if this works for you.

UnixxSH commented 3 months ago

Thus I added the option to build only specific branch, check the readme for "If you want to build only specific branch" how to use it.

I just tried, and it's working as intended. Thanks for the quick reply !

dd010101 commented 3 months ago

👍

GurliGebis commented 3 months ago

@dd010101 I think SELECTED_BRANCH_REGEX="(sagitta|current)" is a problem, since it would mean that it tries to provision current for all packages - which would make the provision script fail, since not all of them have a current. Have you tested that case, with a clean Jenkins? 🙂

GurliGebis commented 3 months ago

Or am I missing something

dd010101 commented 3 months ago

This regex is used only for matching if the job is applicable at all. This regex isn't used for the pipeline. It only says if pipeline regex is applicable for further processing - thus if the job is applicable and isn't only for one branch that is excluded. Thus the regex matches for sagitta:

It simply excludes equuleus only.

The logic that overrides the pipeline regex is here. Thus the pipeline regex is converted for sagitta as follows:

Equuleus gets always just equuleus. This is compared only if the branch regex matches thus sagitta only or equuleus only jobs won't even get here, they are excluded before this. There are two kinds of exclusions - job is excluded completely or just the piplene regex is reduced. That's why the regex you found exists - to exclude non-shared jobs completely.

Yes I did test and you get all packages correctly and two ISOs if you don't set the branch. I also run the sagitta only and I did check all the combinations for pipeline regex, I also test to add equuleus later to sagitta only. I didn't test equuleus only though. So much testing... I did run the scripts from start to end like 50 times already, so many packages built just to be deleted right away! 😄

GurliGebis commented 3 months ago

I see 😊

I have optimized it a bit, to make sure the skipped jobs doesn't take up space in the queue - see #30