It is hard for developers to track branches and tags in GitHub. Especially in an active work group where developers collaborate and work on multiple branches, cherry-pick, merge, rebase and patch operations make it even more difficult to search for a commit. Searching for a commit may be required in cases like code review, debugging, reverting specific changes, etc. Moreover, lots of continuous integration jobs are triggered by events or run periodically every day. Hence, finding out relationships between commits and jobs is also a tough task. This project is crucial because it addresses these challenges by introducing a tool that simplifies navigating through commits, branches, tags, and clarifies the connections between the code changes and CI/CD processes.
/<owner>/<repo>/branch/getActiveBranches: Provides a list of branches that have been active in the given time frame/<owner>/<repo>/branch/getBranchByTag: Provides the name of the branch from which the given tag was built/<owner>/<repo>/tag/getChildTagsByCommit: Provides the child tags in each branch/<owner>/<repo>/tag/getParentTagsByCommit: Provides the nearest parent tags in each branch/<owner>/<repo>/commit/getCommitsBefore: Provides the commits before the given commit in the branches it is present in/<owner>/<repo>/commit/getCommitsAfter: Provides the commits after the given commit in the branches it is present in/<owner>/<repo>/commit/getCommitByName: Provides list of commits when searched by name/<owner>/<repo>/commit/getCommitByAuthor: Provides list of commits when searched by author/<owner>/<repo>job/getJobsByCommit: Provides the CI/CD jobs associated with the given commit/<owner>/<repo>/commit/commitReleased: Accepts commit id and release branch name. Tells if the commit is released or not
- Install the
golangcompiler from the official source (version 1.21.3) - Include $GOPATH in your path via
export PATH=$PATH:$(go env GOPATH)/bin - Adding the above to your
~/.bashrcfile will requiresource ~/.bashrc - Alternatively, if using a package manager like homebrew for example, install golang by running
brew install golang
- Language: Golang@1.21.3
- Package Management Tool: go mod
- Code Format Tool: golangci-lint@1.55.2
- Static Analysis Tool: golangci-lint@1.55.2
- CI Tool: CircleCI@2.1
$ tree
.
|____go.mod # dependencies
|____LICENSE
|____ git_functions # Git-Service Server Component
|____Makefile # make test, fmt….
|____README.md
|____.gitignore
|____.circleci # CI configuration
|____main.go # main function
|____pkg # Components
| ├── handler # Server Handler Components
| ├── model # Github-API defined Objects
| └── swagger-ui # Swagger File and Frontend
|____.golangci.yml # golangci-lint ConfigurationYou have to prepare tools with make -
make toolsAlso, you can run lint, format and test with make before making a pull request -
# test
make test
# lint
make lint
# format
make format# Download the packages
go mod download
# Compile the packages and dependencies
go build
# Run the code
go run main.goUse http://localhost:8000/swaggerui/ in your browser to test the APIs
- Clone the repository
- Pull latest code on the
mainbranch - Follow the instructions given in the
Usage Instructions: Getting Startedsection to start your server - Swagger UI should be accessible on this link: http://localhost:8000/swaggerui/
- For the endpoint to be accessible on UI, make changes to
swagger.jsonfile. You can pick any of the existing endpoints and it is fairly straightforward to follow. - After making changes to this file, hard reload your web browser for the changes to reflect, in case the previous state is cached.
- The
main.gofile initializes all packages. - For example,
HandleCommitsis defined in thegit_functions/service.gofile. - It states all endpoints related to commits on GitHub.
- To define a new endpoint, simply add it here.
- The corresponding function call is defined in the
pkg/handler/commit.gofile. - You can add your function and the respective implementation here.
- If you were to add an endpoint related to GitHub branches, then defining it in
pkg/handler/branch.gowould be more appropriate. - After adding the backend code, you will have to run
go buildandgo run main.goto test your changes.
- Pick the API you wish to test from Swagger UI.
- Click on
Try it outand fill the request parameters. - Click on
Executeto make the backend call. - To debug backend code, add
fmt.Printlnstatements at suitable breakpoints.
https://docs.google.com/document/d/11t64NrmHKW-JwUUJK40whs7IXLFPDU1AUfR30w8SSd4/edit?usp=sharing
Demo Video: https://www.youtube.com/watch?v=8U0Q7gK9bSw
Presentation Video: https://youtu.be/oy0XSqaiCjk
Part 1: https://drive.google.com/file/d/1iTuZFx7GFKrc0Y2Onb6TKgPmDng-Ot5O/view?usp=sharing
Part 2: https://drive.google.com/file/d/14JybIKFUYTKba3ziE8ToSLc4zUgYjqZZ/view?usp=sharing
Part 3: https://drive.google.com/file/d/1kLatH64ZEvh-7J4CCB4uuzKNNsBO0fDY/view?usp=sharing
Part 4: https://youtu.be/aM4C4Mcs-0E