ci

package module
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2022 License: Apache-2.0 Imports: 0 Imported by: 0

README

ci

go.dev reference CircleCI Generated via Stencil

Collection of utilities for use in CI @ Outreach


Please read the CONTRIBUTING.md document for guidelines on developing and contributing changes.

CI

Using in CircleCI

Note: To get credentials you will need to ensure your CI jobs includes the context ghaccesstoken

To use in CircleCI you must first download this binary as part of a base image or machine image. The following Docker images have this installed:

  • gcr.io/outreach-docker/bootstrap/ci: ghaccesstoken

For machine mode, the following snippet may be used (Bootstrap):

./scripts/shell-wrapper.sh gobin.sh github.com/getoutreach/ci/cmd/ghaccesstoken@<version-here>

This will vend credentials. It can be used like: export GH_TOKEN=$(<command-string-from-above> token). That will set a valid github token as the env var GH_TOKEN.

Note: This Token is valid at the time of issuance for an unknown (potentially 10) API calls. If you hit a 429 you will need to call this script again to get a new token.

Adding new credentials

In order to add new credentials to the pool you will need to create a new Github App and add it to the "pool"

Creating a new App

Create a new app via the UI and use the same permissions as an existing one (e.g. `getoutreach/ci-2).

Permissions MUST be the same otherwise flakes can occur.

Once this has been done, download the private key from the bottom of the app page.

Run the following command in your terminal to generate the env var string:

echo "YOUR_APP_ID,YOUR_INSTALL_ID,$(base64 < "$HOME/Downloads/your-key.pem")" | pbcopy

Note: This is now in your clipboard on macOS.

APP_ID comes from the main app page you downloaded the private key from, while install ID comes from the URL when you go to the installed app page for the app on getoutreach (e.g. `getoutreach/ci-2)

Take the string you generated earlier (from your clipboard) and add it to the ghaccesstoken CircleCI context as GHACCESSTOKEN_GHAPP_<NUMBER> replacing <NUMBER> with the next number in the "pool".

Done!

Dependencies and Setup

Dependencies

License

Apache-2.0

Documentation

Overview

Package ci contains useful CI tooling

Directories

Path Synopsis
cmd
ghaccesstoken
Description: Implements the "ghaccesstoken token" command.
Description: Implements the "ghaccesstoken token" command.
internal
github
Package github contains all logic for implementing Github credential pooling
Package github contains all logic for implementing Github credential pooling

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL