gofrog is a service to fetch most downloaded artifacts for given repository on an Artifactory instance. It uses the Artifactory REST API.
- Robust CI/CD pipeline: Linting, unit tests, builds and deploys are done using GitHub actions
- Deployment: gofrog.herokuapp.com (Temporary credentials: Username=gofrog Password=gofrog)
- Approach: Fetching the top 2 most popular artifacts for a given repository has been implemented using a max-heap so that the solution is extensible to fetching top 'n' most popular artifacts. It also utilizes Go's excellent concurrency primitives to speed up processing artifact details for given repository.
- GET
/v1/healthHealth check to indicate API health - GET
/v1/mostPopular?repo=jcenter-cache&count=2Fetches top 2 most downloaded artifacts in repojcenter-cache
Sample JSON Response:
{
"results": [
{
"path": "jcenter-cache/org/hamcrest/hamcrest-parent/1.3/hamcrest-parent-1.3.pom",
"downloadLink": "http://<IP_ADDRESS>:80/artifactory/jcenter-cache/org/hamcrest/hamcrest-parent/1.3/hamcrest-parent-1.3.pom",
"downloads": 30
},
{
"path": "jcenter-cache/org/apache/struts/struts2-core/2.3.14/struts2-core-2.3.14.pom",
"downloadLink": "http://<IP_ADDRESS>:80/artifactory/jcenter-cache/org/apache/struts/struts2-core/2.3.14/struts2-core-2.3.14.pom",
"downloads": 26
}
],
"error": ""
}Pre-requisites: Go 1.15+
-
Clone the repository locally.
-
From repository root, run:
make start- API will be up and running at http://localhost:5000.
From repository root, run:
make test