-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(linear): Move the linear-jira sync from the private release repo…
… to the open DRE repo (#573)
- Loading branch information
1 parent
9994667
commit f48c69d
Showing
15 changed files
with
13,540 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
build:ci --progress_report_interval=30 | ||
build:ci --remote_timeout=5m # Default is 60s. | ||
build:ci --build_event_binary_file=bazel-bep.pb | ||
build:ci --bes_timeout=180s # Default is no timeout. | ||
build:ci --noremote_local_fallback |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
checkpoint.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
checkpoint.txt | ||
last-attempt.txt | ||
|
||
# bazel | ||
bazel-linear-jira | ||
.aspect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
load("@aspect_rules_js//js:defs.bzl", "js_binary", "js_image_layer", "js_test") | ||
load("@aspect_rules_ts//ts:defs.bzl", "ts_config", "ts_project") | ||
load("@npm//:defs.bzl", "npm_link_all_packages") | ||
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_push") | ||
|
||
# Link all packages from the /WORKSPACE npm_translate_lock(name = "npm") and also packages from | ||
# manual /WORKSPACE npm_import rules to bazel-bin/node_modules as well as the virtual store | ||
# bazel-bin/node_modules/.aspect_rules_js since /pnpm-lock.yaml is the root of the pnpm workspace | ||
npm_link_all_packages( | ||
name = "node_modules", | ||
) | ||
|
||
ts_config( | ||
name = "tsconfig", | ||
src = "tsconfig.json", | ||
) | ||
|
||
ts_project( | ||
name = "linear-jira-ts", | ||
srcs = [ | ||
"main.ts", | ||
"test.ts", | ||
], | ||
tsconfig = "@//:tsconfig", | ||
deps = [ | ||
":node_modules/@atlaskit/adf-schema", | ||
":node_modules/@atlaskit/editor-json-transformer", | ||
":node_modules/@atlaskit/editor-markdown-transformer", | ||
":node_modules/@linear/sdk", | ||
":node_modules/@types/lodash", | ||
":node_modules/adf-to-md", | ||
":node_modules/jira.js", | ||
":node_modules/lodash", | ||
":node_modules/@types/react", | ||
# Dev dependencies | ||
":node_modules/@types/node", | ||
":node_modules/ts-node", | ||
":node_modules/typescript", | ||
], | ||
) | ||
|
||
js_binary( | ||
name = "linear-jira", | ||
node_options = [ | ||
"--unhandled-rejections=strict", | ||
], | ||
data = [ | ||
":linear-jira-ts", | ||
":package.json", | ||
], | ||
entry_point = "main.js", | ||
) | ||
|
||
# Image | ||
js_image_layer( | ||
name = "layers", | ||
binary = ":linear-jira", | ||
root = "/app", | ||
) | ||
|
||
oci_image( | ||
name = "linear-jira-image", | ||
base = "@debian", | ||
cmd = ["/app/linear-jira"], | ||
entrypoint = ["bash"], | ||
tars = [ | ||
":layers", | ||
], | ||
) | ||
|
||
oci_push( | ||
name = "push_image", | ||
image = ":linear-jira-image", | ||
repository = "registry.gitlab.com/dfinity-lab/core/release/linear-jira", | ||
) | ||
|
||
js_test( | ||
name = "test", | ||
entry_point = "test.js", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM node:14.17.4 | ||
|
||
WORKDIR /usr/src/app | ||
COPY package*.json ./ | ||
COPY yarn* ./ | ||
COPY *.ts ./ | ||
|
||
RUN yarn install | ||
|
||
ENTRYPOINT ["yarn", "start"] | ||
CMD [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# linear-jira | ||
|
||
linear-jira enables state syncing between Linear and Jira to enable teams to use Linear while still maintaing the state in Jira for any other stakeholders. Primary direction of syncing is Linear -> Jira, but some Jira -> Linear syncing is available. | ||
|
||
## Development | ||
|
||
Configure the environment variables by copying `.env.template` and modifying it to your needs. | ||
|
||
**IMPORTANT: Please use `RELTEST` Jira project, and `RELT` Linear team for any local development.** | ||
|
||
```shell | ||
cp .env.template .env | ||
``` | ||
|
||
Run a sync. | ||
|
||
```shell | ||
yarn dev | ||
``` | ||
|
||
## Syncing overview | ||
|
||
The syncing has the following mapping. | ||
|
||
<!-- Generated with: https://www.tablesgenerator.com/markdown_tables --> | ||
|
||
| Linear | Jira | Linear -> Jira | Jira -> Linear | | ||
| --------- | ----------------- | ------------------ | ------------------ | | ||
| Team | Project | :white_check_mark: | TBD | | ||
| Project | Epic | :white_check_mark: | TBD | | ||
| Issue | Task | :white_check_mark: | :white_check_mark: | | ||
| Relations | Relations | :white_check_mark: | :x: | | ||
| Sub-issue | Split-to relation | :white_check_mark: | :x: | | ||
| Labels | Labels | TBD | TBD | | ||
|
||
## Features | ||
|
||
### Linear to Jira issues syncing | ||
|
||
All the Linear issues and projects are synced to Jira issues. Linear issues and sub-issues are created as Jira tasks, while projects are created as epics. | ||
|
||
The field of the issues is synced continously on any updates to the Linear issue. | ||
|
||
* :white_check_mark: Title | ||
* :white_check_mark: Description | ||
* :white_check_mark: State | ||
* :white_check_mark: Assignee | ||
* :white_check_mark: Reporter | ||
* :white_check_mark: Creator | ||
* :white_check_mark:/:heavy_minus_sign: Relations (blocks / duplicates / relates) (removals are not implemented) | ||
* :white_check_mark:/:heavy_minus_sign: Children (removals are not implemented) | ||
* :white_check_mark:/:heavy_minus_sign: Links (only Jira <-> Linear link is updated) | ||
|
||
### Jira to Linear syncing | ||
|
||
Issues (not Epics) created in Jira are created in Linear and are automatically managed by Linear in the future. If for some reason, you need to managed the ticket in Jira (e.g. assigning the ticket to a person outside of the team who's not using Linear), you can remove the `managed-by-linear` label from the Jira ticket. At that point, Linear will have `Managed by Jira` label. To reverse the action, simply remove the label from Linear. | ||
|
||
## Missing features | ||
|
||
* Cross-project / cross-team relations - primarily to avoid polluting any other projects by accident | ||
* Relation removals - would require state persistence or comparing the entire state of both Linear and Jira | ||
* Label syncing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
workspace( | ||
name = "linear-jira", | ||
) | ||
|
||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
http_archive( | ||
name = "rules_nodejs", | ||
sha256 = "5ad078287b5f3069735652e1fc933cb2e2189b15d2c9fc826c889dc466c32a07", | ||
strip_prefix = "rules_nodejs-6.0.1", | ||
url = "https://github.com/bazelbuild/rules_nodejs/releases/download/v6.0.1/rules_nodejs-v6.0.1.tar.gz", | ||
) | ||
|
||
http_archive( | ||
name = "aspect_rules_js", | ||
sha256 = "7ab2fbe6d79fb3909ad2bf6dcacfae39adcb31c514efa239dd730b4f147c8097", | ||
strip_prefix = "rules_js-1.32.1", | ||
url = "https://github.com/aspect-build/rules_js/releases/download/v1.32.1/rules_js-v1.32.1.tar.gz", | ||
) | ||
|
||
load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies") | ||
|
||
rules_js_dependencies() | ||
|
||
load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains") | ||
|
||
nodejs_register_toolchains( | ||
name = "nodejs", | ||
node_version = "18.17.1", | ||
) | ||
|
||
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock") | ||
|
||
npm_translate_lock( | ||
name = "npm", | ||
data = [ | ||
"@//:package.json", | ||
], | ||
pnpm_lock = "@//:pnpm-lock.yaml", | ||
verify_node_modules_ignored = "//:.bazelignore", | ||
yarn_lock = "@//:yarn.lock", | ||
) | ||
|
||
load("@npm//:repositories.bzl", "npm_repositories") | ||
|
||
npm_repositories() | ||
|
||
################## | ||
# rules_ts setup # | ||
################## | ||
http_archive( | ||
name = "aspect_rules_ts", | ||
sha256 = "4c3f34fff9f96ffc9c26635d8235a32a23a6797324486c7d23c1dfa477e8b451", | ||
strip_prefix = "rules_ts-1.4.5", | ||
url = "https://github.com/aspect-build/rules_ts/releases/download/v1.4.5/rules_ts-v1.4.5.tar.gz", | ||
) | ||
|
||
load("@aspect_rules_ts//ts:repositories.bzl", "rules_ts_dependencies") | ||
|
||
rules_ts_dependencies( | ||
ts_version_from = "//:package.json", | ||
) | ||
|
||
npm_repositories() | ||
|
||
# OCI | ||
http_archive( | ||
name = "rules_oci", | ||
sha256 = "c71c25ed333a4909d2dd77e0b16c39e9912525a98c7fa85144282be8d04ef54c", | ||
strip_prefix = "rules_oci-1.3.4", | ||
url = "https://github.com/bazel-contrib/rules_oci/releases/download/v1.3.4/rules_oci-v1.3.4.tar.gz", | ||
) | ||
|
||
load("@rules_oci//oci:dependencies.bzl", "rules_oci_dependencies") | ||
|
||
rules_oci_dependencies() | ||
|
||
load("@rules_oci//oci:repositories.bzl", "LATEST_CRANE_VERSION", "oci_register_toolchains") | ||
|
||
oci_register_toolchains( | ||
name = "oci", | ||
crane_version = LATEST_CRANE_VERSION, | ||
) | ||
|
||
load("@rules_oci//oci:pull.bzl", "oci_pull") | ||
|
||
oci_pull( | ||
name = "debian", | ||
digest = "sha256:3d868b5eb908155f3784317b3dda2941df87bbbbaa4608f84881de66d9bb297b", | ||
image = "debian", | ||
platforms = [ | ||
"linux/amd64", | ||
], | ||
) |
Oops, something went wrong.