How to contribute to Eclipse JKube?
There are various resources on web regarding making your first contribution towards Open Source projects. Yet I see a lot of people struggling with pull requests and issues. I was talking to my colleague Sun Tan about this; I thought maybe it’s better to write a blog post specific to contributing to Eclipse JKube (or any other open source project in general). It might be helpful for beginners interested in Eclipse JKube getting started with contributions and getting involved with community in long term.
Before you get started:
Before you start contributing to Eclipse JKube or any other open source project. It’s really important to have a clear mindset regarding the motivation regarding contributing. You should ask yourself the following questions:
- Does the project (Eclipse JKube in this case) interests to you? Have you tried it out as an end user? Did you like something about it? Did you dislike something about it and want to improve it?
- Do you have the matching skill set (experience with Java, Maven, Docker and Kubernetes in this case) which might be useful while contributing? Or are you willing to learn these as you contribute?
You might not be able to find answers to these questions right away. So it’s important that you find some resources about the project on internet. Here is a short list of some blog posts and videos about Eclipse JKube:
- Introduction to Eclipse JKube: Java tooling for Kubernetes and Red Hat OpenShift
- Java development on top of Kubernetes using Eclipse JKube
- (Video) Deploy your Java applications to the Cloud using Eclipse JKube
- (Video) Local Java development on top Of Kubernetes JKube
Finding an issue to work on:
Once you’ve tried out the project and gotten some idea about it. Maybe you can try finding some issue you would like to fix. It can be anything: documentation, tests or code or bug reports; All contributions are welcome. You can also report an issue about something you discovered and start working on it. You can also check existing issues which users might have created already. For first timers, good first issue
/ low hanging fruit
labels are usually added to GitHub issue tickets:
Usually it’s a good practice to comment on the issue and ask maintainers to assign it to you if no one is working on it. If it’s assigned to someone else but there hasn’t been any activity for more than 2–3 weeks, feel free to drop a comment showcasing your interest.
Setting up development environment:
Once you’ve decided what you want to work on, you can start by setting up development environment by installing the required tools. You need to install the following tools on your machine:
Setting up Git:
In order to contribute to Eclipse, you would need to create an Eclipse Account and Sign Eclipse Contributor Agreement.
- Fork Eclipse JKube repository on Github
2. Clone Eclipse JKube:
$ git clone https://github.com/rohanKanojia/jkube.git
3. Set user name and email in your git config.
# Configure Git User and Email
$ git config user.name "Your Name"
$ git config user.email "your_email@example.com"
Setting up IntelliJ:
After installing IntelliJ, you need to load Eclipse JKube in your IDE as a maven project.
Run maven build first:
jkube : $ mvn clean install -DskipTests
Open IntelliJ and go to Open
> Open File or Project
> Navigate to directory where you cloned jkube > Load as Maven Project
:
You would also need to install Eclipse Code Formatter plugin and configure it as shown in Contributing Guide.
Working on the issue you picked up:
Once you’ve gotten your development environment ready, you need to start working on the actual problem you picked up. It can be a trivial refactor or it can be a slightly involved task. Feel free to ask questions either via Eclipse JKube Gitter Channel or via comment on the issue itself.
Create a new Git branch for the task you’re going to work on:
jkube $ git checkout -b pr/issue1234
Modify code and verify whether it’s working as per your expectations. Once you’ve completed the task, make sure project is building okay :
jkube $ mvn clean install
If you’ve provided bug fix for some issue or a new functionality, try to add test cases to cover those scenarios. Please make sure that you follow the code style used already in the project.
Committing Changes:
Once you’ve finished making changes, you can add them to git index like this:
jkube $ git add foo/file/changed.txt
Once you’ve added affected files to git index, you can commit them:
jkube $ git commit --signoff
It would open up a text editor where you need to write about the changes you’ve made. Please write meaningful and descriptive commit messages. You can observe how maintainers are writing commit messages in their patches. Otherwise, It’s better to stick to Conventional Commits.
Once you’ve committed you can push your branch
jkube $ git push origin pr/issue1234
Submitting Pull Request on GitHub:
Once you’ve pushed your branch, you only need to go to GitHub repository where you’d get this message for creating pull request for this recently pushed branch:
This would open up a form for filling in pull request description. Please try to be as descriptive as you can while explaining the need for your changes and which issue it addresses. If you see some checkpoints in pull request template, check whatever seem applicable to your pull request:
This form has your changes opened up as diff. Review them again just to verify whether your changes are as per your expectations. Once it’s ready click on Create pull request
button. If it’s not ready, click on Create draft PR
button.
That’s it! You’re successfully submitted a pull request to Eclipse JKube. But wait, your task isn’t over yet.
Addressing Review Comments:
Once you’ve submitted the pull request, it will be reviewed within 1–2 weeks by the maintainers. It highly likely that reviewer would request some additional changes that need to be done before merging the pull request. Unless it’s an extremely huge pull request with lots of files, Please keep the number of commits in the pull request to one. Use git commit --amend
to modify your previous commit. Here is an example:
jkube $ git checkout pr/issue1234
Switched to branch 'pr/issue1234'# Make requested changes
jkube $ vi dir/some-file.txtjkube $ git add dir/some-file.txt
jkube $ git commit --amend# Force push changes
jkube $ git push origin pr/issue1224 -f
Your pull request would be reviewed again within 1–2 weeks and would be merged by maintainers if it matches their expectations.
Conclusion:
Contributing to any open source project can be slightly difficult and time consuming process. Please try to be patient during the process. Most of the maintainers are already busy with their tasks and they review it in their free time.
Refer to project documentation in case of any doubt. If it’s still the case feel free to ask questions on public channel.
I hope this would be helpful to someone getting started with contributing to Eclipse JKube.
Happy Contributing!