This project is a demonstration of how to use Google Cloud Run Jobs to periodically download and update a user's starred repositories from the GitHub API. It includes a sample Cloud Run Job that uses the GitHub API to fetch the list of repositories starred by a specified user and log them in order to route those logs to a sink such as BigQuery.
To run the demo, you will need:
- A Google Cloud account with access to the Google Cloud Run, Cloud Workflow, and Cloud Scheduler services.
- The Google Cloud SDK, which includes the gcloud command-line tool for managing Google Cloud resources.
- A GitHub personal access token with the public_repo scope, which will be used to authenticate the GitHub API requests.
To run the demo, follow these steps:
Clone or download the Cloud Run Jobs Demo repository to your local machine. Open a terminal and navigate to the root directory of the project.
git clone https://github.com/veggiemonk/cloud-run-jobs-demo
cd cloud-run-jobs-demo
Set the environment variable GITHUB_TOKEN
to your GitHub personal access token:
./build.sh
export GITHUB_TOKEN=<your-github-token>
./bin/batch --username <your-github-username> --github-token $GITHUB_TOKEN
Use the gcloud tool to authenticate and set your default project and region:
gcloud auth login
gcloud config set project <your-project-id>
gcloud config set run/region <your-preferred-region>
Read the
setup.sh
script to understand what is needed to run the demo.
cat setup.sh
Here is a sample of what will be deployed:
go get golang.org/x/tools/cmd/present # install present binary in your $GOPATH
make presentation