|
| 1 | +# Building on Kokoro |
| 2 | + |
| 3 | +Kokoro is build infrastructure based on jenkins. This document describes how to configure Kokoro |
| 4 | +builds for continuous integration as well as for pull requests. |
| 5 | + |
| 6 | +There are fours steps to have builds running on Kokoro. |
| 7 | +1. Job definition |
| 8 | +2. Build Configuration |
| 9 | +3. Build Script |
| 10 | +4. Automatic Trigger |
| 11 | + |
| 12 | + |
| 13 | +## Job Definition |
| 14 | +The job definition resides in Kokoro infrastructure. Refer to Kokoro |
| 15 | +documentation for details on job definition. |
| 16 | + |
| 17 | +### Example |
| 18 | +Here is a sample presubmit job defition for linux platform. |
| 19 | +* File Name: linux.cfg |
| 20 | +* File Content: |
| 21 | +``` |
| 22 | +type: PRESUBMIT_GITHUB |
| 23 | +
|
| 24 | +cluster: GCP_UBUNTU |
| 25 | +pool: "dynamic" |
| 26 | +
|
| 27 | +scm { |
| 28 | + github_scm { |
| 29 | + owner: "census-instrumentation" |
| 30 | + repository: "opencensus-java" |
| 31 | + name: "opencensus-java" |
| 32 | + presubmit_branch_regex: ".*" |
| 33 | + build_config_dir: "buildscripts/kokoro" |
| 34 | + commit_status_context: "Linux" |
| 35 | + commit_status_url: LOGGING_URL |
| 36 | + as_if_merged: true |
| 37 | + use_webhook: true |
| 38 | + } |
| 39 | +} |
| 40 | +``` |
| 41 | + |
| 42 | +## Build Configuration |
| 43 | +The purpose of the build configuration is to tell kokoro how to build your |
| 44 | +project. It includes (but not limited to ) reference to buildscript location |
| 45 | +(build_file), build timeout value (timout_mins), etc. |
| 46 | +For detail description please refer to Kokoro documentation. |
| 47 | + |
| 48 | +The build configuration file resides in the directory specified by the field |
| 49 | +'build_config_dir' in job definition (see above). The name of the build |
| 50 | +configuration file should be same as the job definition. |
| 51 | + |
| 52 | +### Example |
| 53 | +File Name: linux.cfg |
| 54 | +File Content: |
| 55 | + |
| 56 | +``` |
| 57 | +# Config file for internal CI |
| 58 | +
|
| 59 | +# Location of the continuous shell script in repository. |
| 60 | +build_file: "opencensus-java/buildscripts/kokoro/linux.sh" |
| 61 | +timeout_mins: 60 |
| 62 | +``` |
| 63 | + |
| 64 | +## Build Script |
| 65 | +The buildscript is the script that runs to perform various build tasks. |
| 66 | +It is very specific to each project. |
| 67 | + |
| 68 | +## Automatic Trigger |
| 69 | +In order to trigger an automatic build when pull request is created/updated |
| 70 | +(presubmit job) OR a commit is made (continuous integration job) Kokoro requires |
| 71 | +a webhook. Please add kokoro-team as admin of the repo and execute a command to |
| 72 | +create a webhook. Please refer to Kokoro documentation for this command. |
| 73 | + |
0 commit comments