associated Jenkins job: https://builder.openwsn.org/job/demo_github_jenkins_job/
Fork the target repository
Log into your GitHub account
Go to repository: https://github.com/changtengfei/demo_github_jenkins_repo and click the “fork“ button on the right side of repository name
Create an issue
Go to https://crystalfree.atlassian.net/secure/BrowseProjects.jspa and select the project you are working on
Click the “+“ on the left bar of the page to create an issue in Jira system
Fill the Summary of the issue and the description if necessary
Assignee to yourself if you are the one working on the issue
Click “Create“ to create an issue
In the issue page, change the STATUS to IN PROGRESS
Work on the issue
Clone the repo just forked on your local computer with following command:
git clone https://github.com/[GitHub Account]/demo_github_jenkins_repo
By default, you will be on “master“ branch. Create a new branch based on the “master“ branch. Use a name starting with the issue ID, such as, “SW-4”. This allows Jira hook the branch link in the issue page.
git branch # make sure you are on master branch
git checkout -b [name_of_your_new_branch] # create a new branch
You will work on the issue/task and commit your code into the created new branch. Use commit message starting with issue ID, such as “SW-4. fix…“, allows Jira system hook the commit link in the issue page.
Create a pull request
When you resolve your issue or finish the task, make sure you have commit all your work to the branch and push the changes to GitHub with following command
git push origin [name_of_your_new_branch]
https://github.com/[GitHub Account]/demo_github_jenkins_repoin a browser
Select your branch in the branch drop box on the left side of the page
Click “New pull request“ button next to the branch drop box
Make sure the target branch is https://github.com/changtengfei/demo_github_jenkins_repo:master
Review the changes and click “Create pull request“ when you are satisfied with your changes.
Go to the issue page and change the STATUS to RESOLVED
Verify the tests pass
Your repository contains the tests to run (see pytest-based automated writing tests )
Opening a pull request causes the Jenkins build to start and test your branch, automatically. The result of that test appears directly in the PR on GitHub.
You can make further changes to your code. Each time you push your code, Jenkins kicks in again.
Review the code
Log into your GitHub account
Go to the “Pull Requests” Tab and open the PR you would like to review
At the bottom of the “Conversation” page, the status shows the checks status by the Jenkins builder. The PR can only be merged when all checks passed unless you do know what is the consequence to merge the PR that doesn’t pass the checks.
The “Files changed“ pages detailed the changes made by the PR. Review and comment about the changes before merging
Keep discussing any changes related to the code on the GitHub site to track the story
Merge the code
When both Admin and developer(s) agree there is no further changes required to the PR, you can click the green “Merge pull request“ button to merge the PR
Go to the linked issue page, close the issue by change the STATUS to CLOSED