jenkins-infra / kubernetes-management

Jenkins Infrastructure Kubernetes Management
MIT License
53 stars 45 forks source link

chore(privatek8s/infra.ci.jenkins.io): exclude build from main for stats.jenkins.io PR previews job #5355

Closed lemeurherve closed 1 week ago

lemeurherve commented 1 week ago

This PR excludes build from main for stats.jenkins.io PR previews job.

Testing done: helmfile diff -f clusters/privatek8s.yaml -l name=jenkins-infra-jobs

                        // Select branches and tags to build based on these filters
                        headWildcardFilterWithPR {
                          includes('main master PR-*') // only branches listed here
-                         excludes('')
+                         excludes('main')
                          tagIncludes('*')
                          tagExcludes('')
                        }

Follow-up of:

Ref:

lemeurherve commented 1 week ago

this works with an include and an exclude?

Yes:

image

dduportal commented 1 week ago
  • The helmfile diff looks good to me (the JobDSL change is the one expected by this PR change). So I'm approving.

    • However it looks like this change will make the Multibranch job to stop watching the builds for the branch mainbut also the builds of PR targeted to the main branch as per the UI name of the Branch Source Trait" changed: "Filter by name including PRs destined for this branch (with wildcards)"
Capture d’écran 2024-06-26 à 15 05 44

=> you may try merging this PR but I believe we'll have to add a new feature on the jenkins-jobs helm chart to allow customization of the other "Branch Source" traits such as allowing to disable "Discover branches" trait and/or the "Discover pull requests from origin" trait and/or "Discover pull requests from forks"

A few pointers to help:

lemeurherve commented 1 week ago

Closing in favor of @dduportal recommendations.

dduportal commented 2 days ago
  • The helmfile diff looks good to me (the JobDSL change is the one expected by this PR change). So I'm approving.

    • However it looks like this change will make the Multibranch job to stop watching the builds for the branch mainbut also the builds of PR targeted to the main branch as per the UI name of the Branch Source Trait" changed: "Filter by name including PRs destined for this branch (with wildcards)"
Capture d’écran 2024-06-26 à 15 05 44

=> you may try merging this PR but I believe we'll have to add a new feature on the jenkins-jobs helm chart to allow customization of the other "Branch Source" traits such as allowing to disable "Discover branches" trait and/or the "Discover pull requests from origin" trait and/or "Discover pull requests from forks"

A few pointers to help:

* Customization of the "branch discovery" trait is there: https://github.com/jenkins-infra/helm-charts/blob/8800432356358003e7327ee6fbd337aad0193801/charts/jenkins-jobs/templates/_helpers.tpl#L152-L154

* Customization of the "discover origin pull requests" is there: https://github.com/jenkins-infra/helm-charts/blob/8800432356358003e7327ee6fbd337aad0193801/charts/jenkins-jobs/templates/_helpers.tpl#L155-L158

* Customization of the "discover PR from forks" (with the  trust stuff) is there: https://github.com/jenkins-infra/helm-charts/blob/8800432356358003e7327ee6fbd337aad0193801/charts/jenkins-jobs/templates/_helpers.tpl#L213-L218.

  * Note: it uses the "tedious XML node" syntax and I'm pretty sure JobDSL now provides a modern syntax like the 2 above (easier to templatize)

* Finally: we would have to tune (in the same feature) the build strategies (defined in https://github.com/jenkins-infra/helm-charts/blob/8800432356358003e7327ee6fbd337aad0193801/charts/jenkins-jobs/templates/_helpers.tpl#L175-L194) so not only we scan the PR/branches we want, but we also build them.

Opened issues to implement separately: