# README

Integrations operations

This folder contains useful scripts and commands to update integrations in bulk.

Env vars

  • GITHUB_TOKEN: To query/update GitHub.
  • GITHUB_USER: For commits. Optional, if not present it will use the system configuration.
  • GITHUB_EMAIL: For commits. Optional, if not present it will use the system configuration.

To use SegmentDestinationsBot, get the credentials from:

$ aws-okta exec prod-privileged -- chamber read -q destinations github_bot_(token|user|email)

list-repositories

Lists all the integrations repositories. Options:

  • --verbose
  • --searchMods=<string>: GitHub search mods to query the repositories (is:private, is:public).

list-integrations

Lists all the integrations. Options:

  • --verbose
  • --monorepoPath=<string>: Local path where the monorepo lives. Default to ..

list-updated-integrations

Lists all the updated integrations since the specified commit or refs/heads/master. Options:

  • --verbose
  • --monorepoPath=<string>: Local path where the monorepo lives. Default to ..
  • --commit=<string>: Commit or reference to compare with the current workspace. Default to refs/heads/master.

migrate-integration

Migrates the integration repo into the monorepo:

  1. Copies the integration code in the monorepo.
  2. Updates references in package.json for the integration.
  3. Commits the integration code.
  4. Updates the integration repo with a notice.
  5. Comments in all opened issues and pull requests and copies them to the monorepo as issues.
  6. Marks the repo as migrated.

Options:

  • --verbose
  • --integration=<name>
  • --monorepoPath=<string>: Local path where the monorepo lives. Default to ..
  • --tmpPath=<string>: Temporal folder. Default to /tmp/integrations.

archive-integration-repository

Archives the repository of the integration:

  1. Removes all webhooks.
  2. Archives the repository.

Options:

  • --verbose
  • --integration=<name>
  • --tmpPath=<string>: Temporal folder. Default to /tmp/integrations.

boneyard-integration-repository

Moves the repository to the boneyard organization.

Options:

  • --verbose
  • --integration=<name>
  • --tmpPath=<string>: Temporal folder. Default to /tmp/integrations.

libgit2

Install libgit2 v27 following this script. This is also required for the CI docker image. IMPORTANT: The following extensions need to be present for libgit2:

  • openssl
  • libhttp-parser-dev

SauceConnect

We use SauceConnect to make a tunnel between localhost and SauceLabs infrastructure. To install it, check this script. This is also required for the CI docker image.

# Packages

No description provided by the author

# Functions

CompareSemanticVersion returns -1, 0 or 1 if the version is older, the same or newer than the other.
Debug prints a message if the Verbose flag is set.
DecodePackage parses package.json into the struct.
EncodePackage writes the struct into package.json.
GetGitHubAuthToken returns the authentication token if found, if not, it exist the app.
No description provided by the author
Log prints the message to stderr.
LogError prints the error and a message to stderr.
NewGitHubClient creates and authenticates a GraphQL client for GitHub's V4 API.
NewYarnClient returns a new npm client.
OpenIntegration gets the project from GitHub and clones the repo locally.
OpenMonorepo returns the git repository of the monorepo.
Output prints the message to stdout.

# Variables

ErrPackageNotFound returned by NPM when the package is not found in the registry.
Verbose prints some extra info.

# Structs

Bugs from package.json.
GitHub is a convenient wrapper for the GraphQL client.
Integration represents an integration contained in the monorepo.
IntegrationRepo represents an old integration with its own repository.
Issue represents a GitHub issue.
Monorepo.
Package is the representation of package.json.
Project represents a GitHub project.
PullRequest represents a GitHub pull request.
Repository from package.json.
Tag is an annotated or lightweight tag.
Look away, I'm hideous! - KramerYarn.

# Type aliases

Dependencies is a map of package:version.
Scripts from package.json.