|
| 1 | +# Adopting Go with Trusted GitHub API Clients |
| 2 | + |
| 3 | +* Status: **accepted** 👍 |
| 4 | +* Deciders: [@hackebrot] [@dlactin] |
| 5 | +* Date: 2025-03-31 |
| 6 | + |
| 7 | +Technical Story: This decision addresses issues discussed in Jira tickets |
| 8 | +[CICD-45] and [CICD-439]. |
| 9 | + |
| 10 | +[CICD-45]: https://mozilla-hub.atlassian.net/browse/CICD-45 |
| 11 | +[CICD-439]: https://mozilla-hub.atlassian.net/browse/CICD-439 |
| 12 | + |
| 13 | +[@hackebrot]: https://github.com/hackebrot |
| 14 | +[@dlactin]: https://github.com/dlactin |
| 15 | + |
| 16 | +## Context and Problem Statement |
| 17 | + |
| 18 | +The Four Keys BigQuery dataset currently lacks historical data because it only |
| 19 | +ingests events (such as Git commit pushes, deployments, and incidents) as they |
| 20 | +occur through GitHub webhooks. This real-time approach leaves a data gap that |
| 21 | +limits the completeness of our retroactive deployment analysis. |
| 22 | + |
| 23 | +Furthermore, the current method for measuring `Lead Time for Changes` links |
| 24 | +deployments to pushes using a single commit SHA. This approach fails to capture |
| 25 | +all relevant commits—particularly those from earlier pushes that were not |
| 26 | +deployed—and assumes an immutable git history, which is not always the case. By |
| 27 | +leveraging the GitHub APIs for retroactive data collection, we can fill this |
| 28 | +historical data gap and capture all relevant commit information, thereby |
| 29 | +enhancing the accuracy of our deployment-related metrics. |
| 30 | + |
| 31 | +## Decision Drivers |
| 32 | + |
| 33 | +1. **Retroactive Data Collection Capability:** |
| 34 | + The solution must facilitate the retrieval of historical data via the GitHub |
| 35 | + APIs, effectively addressing the gaps in the Four Keys dataset. |
| 36 | +2. **Stability and Maturity:** |
| 37 | + The solution must leverage well-established libraries that have proven |
| 38 | + reliability in production environments. |
| 39 | +3. **Maintenance and Support:** |
| 40 | + The selected tools must be actively maintained and well-documented, with |
| 41 | + strong community or official support to ensure long-term viability. |
| 42 | +4. **Team Expertise and Ecosystem Fit:** |
| 43 | + It should align with the team's existing skills and integrate smoothly with |
| 44 | + our current infrastructure and technology stack (e.g., Kubernetes, Argo CD). |
| 45 | + |
| 46 | +## Considered Options |
| 47 | + |
| 48 | +* A. Python with packages like `PyGitHub` and `gql` |
| 49 | +* B. Go with packages like `github.com/shurcooL/githubv4` and `github.com/google/go-github/v68/github` |
| 50 | +* C. Custom-Built API Wrappers |
| 51 | + |
| 52 | +## Decision Outcome |
| 53 | + |
| 54 | +Chosen option: |
| 55 | + |
| 56 | +**B. Go with packages like `github.com/shurcooL/githubv4` and `github.com/google/go-github/v68/github`** |
| 57 | + |
| 58 | +Option B was selected because it best satisfies our key decision drivers. Go’s |
| 59 | +strong compile-time type safety, combined with the maturity and active |
| 60 | +maintenance of the selected packages, ensures production-ready support for the |
| 61 | +GitHub GraphQL API. Additionally, Go aligns well with our team's expertise and |
| 62 | +technology stack (e.g., Kubernetes, Argo CD). |
| 63 | + |
| 64 | +While Python offers advantages in rapid prototyping, its available GitHub API |
| 65 | +libraries lack the specialized stability and GitHub-specific support required |
| 66 | +for this project. |
| 67 | + |
| 68 | +Furthermore, developing custom API wrappers was ruled out due to the |
| 69 | +significantly higher development and maintenance overhead, and the risk of |
| 70 | +re-implementing functionality already well-supported by mature libraries. |
| 71 | + |
| 72 | +## Links |
| 73 | + |
| 74 | +* Go client library for accessing the GitHub GraphQL API v4: https://github.com/shurcooL/githubv4 |
| 75 | +* Go client library for accessing the GitHub REST API v3: https://github.com/google/go-github |
| 76 | +* Python client library for accessing the GitHub REST API v3: https://pypi.org/project/PyGithub/ |
| 77 | +* General purpose Python GraphQL client: https://pypi.org/project/gql/ |
0 commit comments