openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.86k stars 3.57k forks source link

Migrating existing PRs to "main" branch for openHAB 3 #8512

Closed kaikreuzer closed 3 years ago

kaikreuzer commented 3 years ago

Dear contributors,

As it has been announced in our community forum, we have now reached the moment where we move all development efforts away from openHAB 2.x towards openHAB 3.x.

What does this mean for you in detail? A few things:

1. Re-submit existing PRs

We ask you to re-create any existing PR to go against the main branch and not against 2.5.x. Clearly, the code has to compile against openHAB 3 core bundles - @Hilbrand wrote a very good summary of what this means in detail.

The good news is that you do not have to manually change your code. The bulk work can be done fully automatically and we have set up a Jenkins build plan for this purpose, which is triggered for any PR when the "migrate to OH 3" label is added to it. The build result should include your code readily migrated, so you can download it and create a PR against the main branch from it.

2. Create new PRs against the main branch (first)

New PRs are only accepted against the main branch from now on. If you have a fix for 2.5.x this is very welcome, but the PR should only be created once the PR against main is approved and merged, i.e. anything is first addressed for openHAB 3 and can then be backported to openHAB 2.5.x.

3. Set up an openHAB 3 IDE

Afaik, we are lacking a detailed documentation so far, but the most important thing is to install Java 11 on your development machine. Depending on your preferred IDE, most steps of these instructions should still apply.

4. Resubmit your PRs against the previous master for openHAB 3

We followed the new Github naming guideline and renamed the master branch to main. Unfortunately, all PRs against the previous master branch have disappeared/closed 😞 . So in case you had such an PR, please re-open it against the main branch now - thanks!

5. Make sure to use the openhab-addons and not openhab2-addons repo

As we have shrunk the repo, we keep the history in an archive at openhab2-addons, while the latest code is at openhab-addons. If you have an old checkout of openhab2-addons, which was automatically forwarded to openhab-addons when we renamed the repo a year ago, you will now only see the archive repo. Make sure to do a fresh checkout of the openhab-addons repo.

mhilbush commented 3 years ago

We ask you to re-create any existing PR to go against the main branch and not against 2.5.x

How should I handle my 2.5.x PR for which I have a bunch of uncommitted changes? If at all possible, I'd rather not have to redo all those changes against the new 3.0 master.

kaikreuzer commented 3 years ago

@mhilbush Commit them to your branch and re-add the "migrate to OH3" label - this will trigger the code migration and you can take the result and continue working against OH3 from there.

mhilbush commented 3 years ago

Perfect. That's easy!

mhilbush commented 3 years ago

One thing I noticed in the OH3 code migration... It doesn't change the SNAPSHOT version in the pom. It still says 2.5.9-SNAPSHOT. Shouldn't it be 3.0-SNAPSHOT?

mhilbush commented 3 years ago

I closed the 2.5.x PR #7412 and opened an 3.0.0 PR #8530

The conversion was very easy thanks to the jenkins code migration job! Thanks @kaikreuzer!

kaikreuzer commented 3 years ago

It doesn't change the SNAPSHOT version in the pom. It still says 2.5.9-SNAPSHOT. Shouldn't it be 3.0-SNAPSHOT?

That's true, @mhilbush, I seem to have missed that. You should hence once run

mvn versions:set -DnewVersion=3.0.0-SNAPSHOT

over it.

jeremystucki commented 3 years ago

Is there a way to keep the commit history? (it says that the main branch is unrelated to the 2.5.x branch)

kaikreuzer commented 3 years ago

See point 5 above: "As we have shrunk the repo, we keep the history in an archive at openhab2-addons"

wborn commented 3 years ago

Please don't unpin our issues @markus7017.

kgoderis commented 3 years ago

@kaikreuzer Are there any constraints to take in mind when doing it this way, e.g. can 3.x jars run against the 2.5.x runtime [as you know, for now I have to play catch-up with wrt 3.x, am not aware of any breaking changes/evolutions]

wborn commented 3 years ago

All core API packages were renamed from org.eclipse.smarthome to org.openhab.core so you cannot run OH 3.x code on 2.5.x or vice versa (https://github.com/openhab/openhab-core/issues/1290).

If you want to catch up, also have a look at our board: https://github.com/orgs/openhab/projects/3 . Most major issues/PRs can be found on it.

J-N-K commented 3 years ago

Is this still relevant, @kaikreuzer

kaikreuzer commented 3 years ago

There are still some unported PRs, but this issue is still there and readable, even when it is closed - so let's close it.

SRGDamia1 commented 3 years ago

@mhilbush Commit them to your branch and re-add the "migrate to OH3" label - this will trigger the code migration and you can take the result and continue working against OH3 from there.

I'm sorry, but how do I re-add the label as a non-contributor?

kaikreuzer commented 3 years ago

@SRGDamia1 Simple: Become a contributor 😄! I've just sent you an invite to join the group.

SRGDamia1 commented 3 years ago

@kaikreuzer Thank you!

SRGDamia1 commented 3 years ago

Ouch. Jenkins failed right away for me. It's showing ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.

https://ci.openhab.org/job/openHAB-Addons-Migration/116/console attempting to migrate from https://github.com/openhab/openhab-addons/pull/7260

SRGDamia1 commented 3 years ago

If I want to make the changes by hand, is there a proper way to merge/rebase/cherry pick commits onto the new shrunken repo?

kaikreuzer commented 3 years ago

@SRGDamia1 Better move that discussion to #7260.