ElektraInitiative / PermaplanT

https://www.permaplant.net
BSD 3-Clause "New" or "Revised" License
16 stars 13 forks source link

Two builds when creating a PR #587

Closed 4ydan closed 1 year ago

4ydan commented 1 year ago

Describe the Bug

I have seen this multiple times now. is it intended?

Steps to Reproduce the Problem

Open a PR

Expected Result

One Jenkins build to start.

Actual Result

Two are started.

PermaplanT version

master

Operating System

-

Browser

-

Versions of other relevant software/extensions

-

Additional info/logs

image

markus2330 commented 1 year ago

Thanks for creating the issue!

No, it is not on purpose. It happens on PRs where the branch is also within PermaplanTs repository. Currently we don't need to build any branch but master branch, so if you find a way to disable these "branch" builds, it would be very good for the environment.

Btw. I think Elektra has the same problem but branches in the main repo are not so typical but still they exist and lead to many useless build jobs.

markus2330 commented 1 year ago

Do we know anything about that yet? It is quite a waste of resources and also sometimes confusing (if one passes and the other fails).

4ydan commented 1 year ago

We could maybe try to solve this with jenkins API, to cancel a running branch when it's opened as PR, but I didnt have much time looking into this.

4ydan commented 1 year ago

we could do this image

4ydan commented 1 year ago

but then no more CI when it's not opened as PR. The issue is, that you cant open the PR before pushing the new branch.

markus2330 commented 1 year ago

we could do this

Yes, sounds like exactly what we need.

but then no more CI when it's not opened as PR.

We would need another pipeline for these PR.

4ydan commented 1 year ago

Or maybe this? https://plugins.jenkins.io/autocancel/ only 92 installs though

markus2330 commented 1 year ago

I don't think autocancel is a good idea: we would see aborted runs all the time.

Let us go with the option you found and master in a separate pipeline. People simply should create PRs for branches they want to build.

4ydan commented 1 year ago

so master still has both and PR's need to be pushed for CI? I'm a bit confused.

markus2330 commented 1 year ago

No, master is the only branch that should be build without having a PR.

Can you have a quick look at #668? Did you cancel the build?

4ydan commented 1 year ago

Ok I understand.

Can you have a quick look at https://github.com/ElektraInitiative/PermaplanT/pull/668? Did you cancel the build?

It was not me.

4ydan commented 1 year ago

Or maybe it was me, when I moved the folders in Jenkins, possible.

markus2330 commented 1 year ago

Ok, no problemo :wink:

Everything is done and well, thanks for your great responsiveness! Maybe you can also do a release soon?

4ydan commented 1 year ago

Great, next time I should probably not touch anything in jenkins on release day.

Maybe you can also do a release soon?

sure

lukashartl commented 1 year ago

Together in a discord session with @4ydan ,

we have added a Filter by name (with regular expression) with (PR-.*)|master. If I understand this correctly this should build all PRs (PR-.*) and the branch named master.

@4ydan will be testing this now.

lukashartl commented 1 year ago

In Jenkins we can now see that all branches except master are in disabled state; PRs are not disabled.

The triggered Pipeline scan will now rebuild lots of PRs unfortunately, but that's just a one time thing. (after changing the settings in the multi branch pipeline it automatically triggers a full scan).

4ydan commented 1 year ago

Very impressive and elegant solution from lukas.