2020-08-14 22:53:59 +00:00
|
|
|
# Architecture Guide
|
|
|
|
|
|
|
|
This guide describes the program architecture.
|
|
|
|
|
|
|
|
## Contents
|
|
|
|
|
|
|
|
- [Architecture Guide](#architecture-guide)
|
|
|
|
- [Contents](#contents)
|
2020-08-22 22:29:19 +00:00
|
|
|
- [Summary](#summary)
|
|
|
|
- [Labels](#labels)
|
|
|
|
- [Flag Labels](#flag-labels)
|
|
|
|
- [Change Sets](#change-sets)
|
|
|
|
- [State Labels](#state-labels)
|
|
|
|
- [State Values](#state-values)
|
2020-08-20 22:08:57 +00:00
|
|
|
- [State Changes](#state-changes)
|
2020-08-14 22:53:59 +00:00
|
|
|
- [Remote](#remote)
|
|
|
|
- [Github Remote](#github-remote)
|
|
|
|
- [Gitlab Remote](#gitlab-remote)
|
|
|
|
- [Sync](#sync)
|
|
|
|
- [Sync Issues](#sync-issues)
|
2020-08-22 22:29:19 +00:00
|
|
|
- [Sync Projects](#sync-projects)
|
2020-08-14 22:53:59 +00:00
|
|
|
|
2020-08-22 22:29:19 +00:00
|
|
|
## Summary
|
2020-08-14 22:53:59 +00:00
|
|
|
|
2020-08-22 22:29:19 +00:00
|
|
|
`cautious-journey` is a label manager and state machine for remote APIs. It creates and updates labels to match
|
|
|
|
the configuration, can replace labels to create complex workflows, and supports multiple projects with shared or
|
|
|
|
unique labels.
|
2020-08-14 22:53:59 +00:00
|
|
|
|
2020-08-22 22:29:19 +00:00
|
|
|
## Labels
|
2020-08-14 22:53:59 +00:00
|
|
|
|
2020-08-22 22:29:19 +00:00
|
|
|
Labels come in two varieties: individual flags and mutually-exclusive states. These are equivalent to
|
|
|
|
checkboxes and radio groups in web forms, with the state changes between values forming a state machine within
|
|
|
|
each group of state labels.
|
2020-08-14 22:53:59 +00:00
|
|
|
|
2020-08-22 22:29:19 +00:00
|
|
|
### Flag Labels
|
2020-08-14 22:53:59 +00:00
|
|
|
|
2020-08-22 22:29:19 +00:00
|
|
|
Flag labels are set individually. They support basic change sets, like `adds` and `removes`. While flags are
|
|
|
|
independent by default, they can depend on other labels in `requires`.
|
2020-08-14 22:53:59 +00:00
|
|
|
|
2020-08-22 22:29:19 +00:00
|
|
|
#### Change Sets
|
2020-08-14 22:53:59 +00:00
|
|
|
|
2020-08-22 22:29:19 +00:00
|
|
|
If the flag in question is present on an issue, then:
|
2020-08-14 22:53:59 +00:00
|
|
|
|
2020-08-22 22:29:19 +00:00
|
|
|
- the labels listed in `adds` will be added
|
|
|
|
- the labels listed in `removes` will be removed
|
2020-08-14 22:53:59 +00:00
|
|
|
|
2020-08-22 22:29:19 +00:00
|
|
|
### State Labels
|
|
|
|
|
|
|
|
State labels are set from a group of values. Only one value from each state may be present at a time; if more than
|
|
|
|
one value exists, the highest priority will be kept. Each value can define a set of potential state changes, which
|
|
|
|
will replace the current value with another label (flag or state value).
|
|
|
|
|
|
|
|
#### State Values
|
|
|
|
|
|
|
|
State values are mutually exclusive, but are normal labels in other ways. They support basic change sets, like
|
|
|
|
`adds` and `removes`, along with a set of potential changes in `becomes`.
|
2020-08-14 22:53:59 +00:00
|
|
|
|
2020-08-20 22:08:57 +00:00
|
|
|
#### State Changes
|
|
|
|
|
|
|
|
State labels may replace one value with another using normal change rules, with the addition
|
|
|
|
of a list of matching labels that must be present for the state change to be resolved.
|
|
|
|
|
|
|
|
For example, a state with three values like so:
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
projects:
|
|
|
|
- name: foo
|
|
|
|
flags:
|
|
|
|
- name: next
|
|
|
|
states:
|
|
|
|
- name: status
|
|
|
|
values:
|
|
|
|
- name: new
|
|
|
|
becomes:
|
|
|
|
- adds: [status/in-progress]
|
|
|
|
matches: [next]
|
|
|
|
- name: in-progress
|
|
|
|
becomes:
|
|
|
|
- adds: [status/done]
|
|
|
|
matches: [next]
|
|
|
|
- name: done
|
|
|
|
becomes:
|
|
|
|
- adds: [status/new]
|
|
|
|
matches: [next]
|
|
|
|
```
|
|
|
|
|
|
|
|
Each time `cautious-journey` evaluates the labels on this project, any issues with the `status/new` **and** `next`
|
|
|
|
labels will be promoted to `status/in-progress`, and both the `status/new` and `next` labels will be removed.
|
|
|
|
|
2020-08-14 22:53:59 +00:00
|
|
|
## Remote
|
|
|
|
|
2020-08-22 22:29:19 +00:00
|
|
|
`cautious-journey` typically connects to some remote service to manage labels there. You can choose which remote
|
|
|
|
should be used for each project.
|
2020-08-14 22:53:59 +00:00
|
|
|
|
|
|
|
### Github Remote
|
|
|
|
|
|
|
|
Connects to a Github repository.
|
|
|
|
|
2020-08-22 22:29:19 +00:00
|
|
|
- `type: github-remote`
|
|
|
|
- `data:`
|
|
|
|
- `type: app`
|
|
|
|
- `appId`
|
|
|
|
- `installationId`
|
|
|
|
- `privateKey`
|
|
|
|
- `type: token`
|
|
|
|
- `token`: personal token with `repo` scope
|
2020-08-14 22:53:59 +00:00
|
|
|
|
|
|
|
### Gitlab Remote
|
|
|
|
|
|
|
|
Connects to a Gitlab repository.
|
|
|
|
|
2020-08-22 22:29:19 +00:00
|
|
|
- `type: gitlab-remote`
|
|
|
|
- `data:`
|
|
|
|
- `type: token`
|
|
|
|
- `token`: personal access token with `api` scope
|
2020-08-14 22:53:59 +00:00
|
|
|
|
|
|
|
## Sync
|
|
|
|
|
|
|
|
Update issue labels or the labels themselves.
|
|
|
|
|
|
|
|
### Sync Issues
|
|
|
|
|
2020-08-22 22:29:19 +00:00
|
|
|
Update issue labels by resolving state changes and other change sets.
|
|
|
|
|
|
|
|
### Sync Projects
|
2020-08-14 22:53:59 +00:00
|
|
|
|
2020-08-22 22:29:19 +00:00
|
|
|
Update project labels to match the `flags` and `states` provided in the config.
|
2020-08-14 22:53:59 +00:00
|
|
|
|
2020-08-22 22:29:19 +00:00
|
|
|
The project config is considered the source of truth when syncing projects, and the remote labels will be
|
|
|
|
updated to match the config.
|