In this section you will set up the necessary services and client tools required to complete this tutorial.
The following services are required to complete this tutorial:
In this section you will create a new GCP project and enable the GCP APIs required to complete this tutorial.
Create a new GCP project named pipeline-tutorial
and capture the projectId in the PROJECT_ID
env var:
PROJECT_ID=$(gcloud projects create \
--name "pipeline-tutorial" \
--format='value(projectId)')
At the prompt type 'y' to accept generated project id.
Set the default project to the pipeline-tutorial
project:
gcloud config set project ${PROJECT_ID}
Creating new projects with the
--set-as-default
flag does not seem to work as of gcloud version (Google Cloud SDK 180.0.0) and results in the core/project property being set to None. As a workaround the projectId is being extracted from the output of the gcloud command and stored in an env var and set manually.
Set the default zone:
gcloud config set compute/zone us-west1-c
Ensure the default credentials are available on your local machine:
gcloud auth application-default login
Run the
gcloud compute zones list
command to find the zone closest to you.
Enable the required GCP APIs:
gcloud services enable --async \
container.googleapis.com \
cloudapis.googleapis.com \
cloudbuild.googleapis.com \
sourcerepo.googleapis.com \
compute.googleapis.com \
storage-component.googleapis.com \
containerregistry.googleapis.com \
cloudkms.googleapis.com \
logging.googleapis.com \
cloudfunctions.googleapis.com
In can take several minutes before the GCP APIs are enabled and ready for use. In the meanwhile it's safe to continue the tutorial. At any point you can use the gcloud
command to list enabled services:
gcloud services list --enabled
output
NAME TITLE
bigquery-json.googleapis.com BigQuery API
clouddebugger.googleapis.com Stackdriver Debugger API
datastore.googleapis.com Google Cloud Datastore API
source.googleapis.com Legacy Cloud Source Repositories API
storage-component.googleapis.com Google Cloud Storage
pubsub.googleapis.com Google Cloud Pub/Sub API
container.googleapis.com Google Container Engine API
storage-api.googleapis.com Google Cloud Storage JSON API
logging.googleapis.com Stackdriver Logging API
resourceviews.googleapis.com Google Compute Engine Instance Groups API
replicapool.googleapis.com Google Compute Engine Instance Group Manager API
cloudapis.googleapis.com Google Cloud APIs
sourcerepo.googleapis.com Cloud Source Repositories API
deploymentmanager.googleapis.com Google Cloud Deployment Manager V2 API
containerregistry.googleapis.com Google Container Registry API
monitoring.googleapis.com Stackdriver Monitoring API
compute.googleapis.com Google Compute Engine API
sql-component.googleapis.com Google Cloud SQL
cloudkms.googleapis.com Google Cloud Key Management Service (KMS) API
cloudtrace.googleapis.com Stackdriver Trace API
servicemanagement.googleapis.com Google Service Management API
replicapoolupdater.googleapis.com Google Compute Engine Instance Group Updater API
cloudbuild.googleapis.com Google Cloud Container Builder API
cloudfunctions.googleapis.com Google Cloud Functions API
Link a billing account to the pipeline-tutorial
project as described here: Modify a Project's Billing Settings
The following client tools are required to complete this tutorial:
- hub 2.3.0+
- hub-credential-helper 0.0.1+
- git 2.14.0+
- gcloud 179.0.0+
- kubectl 1.8.0+
In this section you will generate a GitHub API Token which will be used to automate the GitHub related tasks throughout this tutorial.
Generate a GitHub token using the official guide. While creating the token, set the token description to "pipeline-tutorial", and check the repo
and admin:repo_hook
scopes.
Write the token to the .pipeline-tutorial-github-api-token
file in the current directory:
echo -n "<token>" > .pipeline-tutorial-github-api-token
Your GitHub username will be used to automate GitHub related tasks including forking the GitHub repositories necessary to complete this tutorial and creating GitHub webhooks. Save your GitHub username in the GITHUB_USERNAME
env var:
export GITHUB_USERNAME="<github-username>"