Discover APIs in a GitHub repository (Docker)

Created:
August 31, 2023
Updated:
April 2, 2024

The Docker image discovers APIs in your GitHub account by scanning for OpenAPI or Swagger specifications in your repositories, as well as generating them using static code analysis.

It will create an API per repository, and potentially multiple specifications for that API, in the FireTail SaaS Platform.

Build a docker image

The docker image can be built by cloning the repository and using this docker command:


git clone git@github.com:FireTail-io/github-api-discovery.git
cd github-api-discovery
docker build --rm -t firetail-io/github-api-discovery:latest 
	// -f build_setup/Dockerfile . --target runtime

Run a test

Run a test using the Dockerfile:


  docker build --rm -t firetail-io/github-api-discovery:test-python 
  	// -f build_setup/Dockerfile . --target test-python
  

Run tests for the Golang analyzer separately using the Dockerfile to yield a html coverage report:


    docker build --rm -t firetail-io/github-api-discovery:test-golang -f 
    	//build_setup/Dockerfile . --target test-golang
    

Running the image requires two environment variables, `GITHUB_TOKEN` and `FIRETAIL_APP_TOKEN`. You can find a full list of environment variables used by the scanner below.

The scanner also requires a config file to determine the organizations, users and repositories to scan. You can find an example at config-example.yml.

Copy config-example.yml to config.yml and adjust it to your use case, then run the image using the following docker command:


      export GITHUB_TOKEN=YOUR_GITHUB_TOKEN
      export FIRETAIL_APP_TOKEN=YOUR_FIRETAIL_APP_TOKEN
      docker run --rm -e GITHUB_TOKEN=${GITHUB_TOKEN} -e 
      	// FIRETAIL_APP_TOKEN=${FIRETAIL_APP_TOKEN} --mount 
        // type=bind,source="$(pwd)"/config.yml,target=/config.yml,readonly 
        // firetail-io/github-api-discovery:latest
      

Environment Variables

Variable Name Description Required? Default
GITHUB_TOKEN A classic GitHub personal access token. Yes None
FIRETAIL_APP_TOKEN An app token from the Firetail SaaS platform. Yes None
FIRETAIL_API_URL The URL of the Firetail SaaS' API. No "https://api.saas.eu-west-1.prod.firetail.app"
LOGGING_LEVEL The logging level provided to python's logging library. No "INFO"