glue_ops
v2.3.0
Published
## Description This project aims at improving automation in GitOps by helping you make changes to git repositories, publishing changes as pull requests, and merging pull requests.
Downloads
15
Readme
Glue Ops
Description
This project aims at improving automation in GitOps by helping you make changes to git repositories, publishing changes as pull requests, and merging pull requests.
glue_ops <cmd> [args]
The glue for GitOps
Commands:
glue_ops run [jobName] Runs publish and merge
glue_ops publish [jobName] Applies file syncs and publishes to
repository
glue_ops merge [jobName] Merges PRs opened by GlueOps
glue_ops rollback [jobName] Runs rollbackPublish and merges PRs
glue_ops rollbackPublish [jobName] Creates rollback PRs
glue_ops sync [syncName] Applies your file syncs
glue_ops template Prints your templated config file to
STDOUT for debugging purposes
Options:
--help Show help [boolean]
--version Show version number [boolean]
-c, --config-path Sets the config path [string] [default: "glue_ops.yaml"]
Install
npm install glue_ops
Functionality
Glue Ops automates GitOps by:
- Helping you automate changes to a file or group of files. Command: [sync]
- Helping you automate the process of cloning, branching, committing, PRing changes and cleaning up old PRs. Command: [publish]
- Helping you automate the process of waiting for PR status checks to pass, approve the PR and merge the PR. Command: [merge]
- Helping you automate the process of rolling back your previous PR. Command: [rollbackPublish]
Configuration:
glue_ops requires a configuration file (default glue_ops.yaml) to run. It allows dynamic values via mustache templating. Template values must be provided via the CLI with the -r, --replacement-values
flag. For multiple replacement values, use the flag multiple times.
Example:
glue_ops sync -r foo=bar -r otherVar=foo
Configuration schema:
repository:
apiBaseUrl: https://github.enterpriserepo.com/api/v3 # Required for GH enterprise
url: https://github.enterpriserepo.com/stellaservice/jenkins-testing # Required for remote repository
local: true # Can be used to target the current working directory
cloneDirectory: /tmp/glue_ops_repos # [default]
fileSyncs:
namedSync:
type: 'yaml' # Also supports json/regex
target: ['path', 'to', 'replacement']
value: {{{mustacheTemplating}}}
files:
- filePath1
- filePath2
jobs:
- name: UniqueName # Make this name unique (collisions for the same repo & base branch can be dangerous)
fileSyncs: [] namedSync # This must be a reference to a named fileSync
branch: master # Used to branch off of and PR back to
approval:
enabled: true # [default]
merge:
method: 'squash' # [default] Can be one of: merge, squash, rebase
pollPrTimeout: 600 # [default] (in seconds)
hooks: [] # Arbitrary shell command hooks to be run post merge
Authentication
For actions (run/publish/merge command) that rely on communicating with Github (cloning, PRing, merging) the CLI relies on the environment variable: GITHUB_TOKEN
being set with proper scopes.
Additionally for PR approval functionality, typically the PR creator cannot be the PR approver. To solve this the CLI will opt to use the environment variable GITHUB_APPROVAL_TOKEN
if available.
This CLI has been tested with a personal access token including the following scopes: repo, read:org
File Syncs
File syncs helps you automate changes to a file or group of files. It currently supports targeting changes via YAML, JSON, and Regex. It can be used as part of a job which would include the branching and PR automation or completely independently ony requiring the fileSyncs
configuration in your glue_ops.yaml
Merge hooks
Merge hooks allows you to run arbitrary scripts post merge. This can be useful for monitoring changes to your infrastructure post merge. Additionally the environment will include: MERGE_SHA variable allowing you to associate an action with the current merge commit.
Run command
The run command automates the entire process of publish/merge as a single call. It implements the following steps:
- Clones and checks out repository if necessary [publish]
- Branches off your desired branch [publish]
- Runs the fileSyncs for the job [publish]
- Commits and pushes the changes [publish]
- Creates a pull request for the changes [publish]
- Deletes old PRs created by the job [publish]
- Approves PR (w/ alternative token) [merge]
- Polls PR status [merge]
- Merges PR [merge]
- Runs merge hooks if applicable [merge]