lazylead 0.2.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.0pdd.yml +4 -1
  3. data/.circleci/config.yml +14 -4
  4. data/.docker/Dockerfile +5 -4
  5. data/.docker/vcs.dockerfile +10 -0
  6. data/.docs/accuracy.md +107 -0
  7. data/.docs/accuracy_email.jpg +0 -0
  8. data/.docs/accuracy_jira_comment.jpg +0 -0
  9. data/.docs/duedate_expired.md +92 -0
  10. data/.docs/propagate_down.md +89 -0
  11. data/.pdd +1 -1
  12. data/.rubocop.yml +7 -1
  13. data/.rultor.yml +2 -2
  14. data/.simplecov +0 -6
  15. data/bin/lazylead +13 -5
  16. data/lazylead.gemspec +4 -16
  17. data/lib/lazylead/cc.rb +180 -0
  18. data/lib/lazylead/cli/app.rb +4 -3
  19. data/lib/lazylead/exchange.rb +15 -2
  20. data/lib/lazylead/home.rb +38 -0
  21. data/lib/lazylead/log.rb +30 -8
  22. data/lib/lazylead/model.rb +60 -22
  23. data/lib/lazylead/opts.rb +68 -0
  24. data/lib/lazylead/postman.rb +15 -15
  25. data/lib/lazylead/schedule.rb +6 -4
  26. data/lib/lazylead/smtp.rb +1 -1
  27. data/lib/lazylead/system/fake.rb +1 -1
  28. data/lib/lazylead/system/jira.rb +51 -12
  29. data/lib/lazylead/system/synced.rb +2 -1
  30. data/lib/lazylead/task/accuracy/accuracy.rb +140 -0
  31. data/lib/lazylead/task/accuracy/affected_build.rb +43 -0
  32. data/lib/lazylead/task/accuracy/requirement.rb +40 -0
  33. data/lib/lazylead/task/alert.rb +8 -6
  34. data/lib/lazylead/task/confluence_ref.rb +4 -3
  35. data/lib/lazylead/task/echo.rb +4 -0
  36. data/lib/lazylead/task/fix_version.rb +10 -6
  37. data/lib/lazylead/task/missing_comment.rb +7 -5
  38. data/lib/lazylead/task/propagate_down.rb +126 -0
  39. data/lib/lazylead/task/savepoint.rb +58 -0
  40. data/lib/lazylead/task/touch.rb +102 -0
  41. data/lib/lazylead/version.rb +1 -1
  42. data/lib/messages/accuracy.erb +118 -0
  43. data/lib/messages/due_date_expired.erb +8 -7
  44. data/lib/messages/illegal_fixversion_change.erb +9 -8
  45. data/lib/messages/missing_comment.erb +10 -9
  46. data/lib/messages/savepoint.erb +43 -0
  47. data/lib/messages/svn_touch.erb +147 -0
  48. data/readme.md +35 -32
  49. data/test/lazylead/cc_test.rb +153 -0
  50. data/test/lazylead/cli/app_test.rb +3 -4
  51. data/test/lazylead/exchange_test.rb +22 -2
  52. data/test/lazylead/model_test.rb +14 -3
  53. data/test/lazylead/opts_test.rb +70 -0
  54. data/test/lazylead/postman_test.rb +57 -0
  55. data/test/lazylead/smtp_test.rb +1 -1
  56. data/test/lazylead/system/jira_test.rb +35 -1
  57. data/test/lazylead/task/accuracy/accuracy_test.rb +73 -0
  58. data/test/lazylead/task/accuracy/affected_build_test.rb +42 -0
  59. data/test/lazylead/task/assignee_alert_test.rb +2 -2
  60. data/test/lazylead/task/duedate_test.rb +48 -22
  61. data/test/lazylead/task/fix_version_test.rb +9 -6
  62. data/test/lazylead/task/missing_comment_test.rb +11 -9
  63. data/test/lazylead/task/propagate_down_test.rb +88 -0
  64. data/test/lazylead/task/savepoint_test.rb +51 -0
  65. data/test/lazylead/task/touch_test.rb +63 -0
  66. data/upgrades/sqlite/001-install-main-lazylead-tables.sql +0 -1
  67. data/upgrades/sqlite/999.testdata.sql +5 -1
  68. metadata +41 -176
  69. data/todo.yml +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc28e9d71a966a27880ceac0418cf722b6994e57e60301dc53808cb6bb57e3f2
4
- data.tar.gz: 48724243edda1c24e01e75ea50a63a0775869493696f116485125a90097c7877
3
+ metadata.gz: 4834917c8eacf27d7514a99f4a8eb9f2c9dd7a19735c3ae9653105ecf8cd7463
4
+ data.tar.gz: f7d5c5f19e7be4c11de364a27099382b78d748ee091ed0c2c6de47d5b95b21bb
5
5
  SHA512:
6
- metadata.gz: 1748fbb1289cefc4f893d4353544bc635f8942a9df33a0375f57ea14bafa135197ff328e9af4ae7d38fe7fcbc8a9cec6398c10aebd5a1a96a65f6047742ca0f7
7
- data.tar.gz: 9646375b7bcfc1ae3e61ee6075c8eb26055953a423ab6b9c9ccd04311c672dcbcd4310cf9bd7b1a0b06bbdb57c8a186ac7352cdba894972204bb64cee3a7fdac
6
+ metadata.gz: 29bd5bdaed8330d9de652ab9d11126a1af79a84acc08b415db14f3a389592ac08e2c0ce1c35bd6733302aca808571a3f65d68183ceba20a7847cbb8e766eb921
7
+ data.tar.gz: b80e43c020c05b8b26d3745916934e737f2b7176515ff82fa40f901cd7a8e8a7eb81c2cc016bb845289f22b38eb65854e1c59080f58be6ae584f1f40f5a95e5e
data/.0pdd.yml CHANGED
@@ -1,5 +1,8 @@
1
1
  errors:
2
2
  - yurii.dubinka@gmail.com
3
-
3
+ alerts:
4
+ suppress:
5
+ - on-found-puzzle
6
+ - on-lost-puzzle
4
7
  tags:
5
8
  - pdd
@@ -16,12 +16,12 @@ jobs:
16
16
  machine: true
17
17
  steps:
18
18
  - checkout
19
- # build the application image
20
19
  - run:
21
- name: "Build docker image"
20
+ name: "Build LL image"
22
21
  command: |
23
22
  set -e
24
23
  COMMIT_URL="https://github.com/dgroup/lazylead/commit/${CIRCLE_SHA1}"
24
+ sed -i "s/0\.0\.0/${DOCKER_RELEASE_TAGS}/g" lib/lazylead/version.rb
25
25
  docker build --build-arg release_tags="${CIRCLE_SHA1}, ${CIRCLE_BRANCH}, ${COMMIT_URL}" --build-arg version="${DOCKER_RELEASE_TAGS:7}" \
26
26
  -t dgroup/lazylead:$CIRCLE_BRANCH . \
27
27
  -f .docker/Dockerfile
@@ -32,12 +32,22 @@ jobs:
32
32
  expected="No tasks found"
33
33
  echo "Ensure that app prints the line '${expected}'."
34
34
  grep --color "${expected}" trace.log
35
- # publish the image
36
35
  - run:
37
- name: "Deploy docker image"
36
+ name: "Push LL image"
38
37
  command: |
39
38
  chmod +x .circleci/release_image.sh
40
39
  .circleci/release_image.sh
40
+ - run:
41
+ name: "Build & push LL VCS image"
42
+ command: |
43
+ sed -i "s/0\.0\.0/${DOCKER_RELEASE_TAGS}/g" .docker/vcs.dockerfile
44
+ sed -i "s/0\.0\.0/${DOCKER_RELEASE_TAGS}/g" lib/lazylead/version.rb
45
+ docker build -t dgroup/lazylead:${DOCKER_RELEASE_TAGS}-vcs . -f .docker/vcs.dockerfile
46
+ docker push dgroup/lazylead:${DOCKER_RELEASE_TAGS}-vcs
47
+ - run:
48
+ name: "Reset tag to master"
49
+ command: |
50
+ curl -s -X POST -u ${CI_TOKEN}:"" --url "https://circleci.com/api/v2/project/gh/dgroup/lazylead/envvar" -H "accept: application/json" -H "content-type: application/json" -d "{ \"name\": \"DOCKER_RELEASE_TAGS\", \"value\": \"master\" }"
41
51
  workflows:
42
52
  version: 2
43
53
  build_and_test:
@@ -12,15 +12,16 @@ ENV APP_HOME=/lazylead
12
12
 
13
13
  WORKDIR $APP_HOME
14
14
 
15
- # @todo #/DEV The current image size is about 150MB.
15
+ # @todo #/DEV Original size of lazylead was 350 MB.
16
+ # After removing of unnecessary libraries it took 250 MB.
16
17
  # The original alpine image is ~20MB.
17
18
  # Image cleanup is required.
18
19
  RUN echo "Install 3rd-party libraries." \
19
- && apk add libc-dev gcc make git sqlite sqlite-dev sqlite-libs tree less vim man bash unzip
20
+ && apk add --no-cache libc-dev gcc git make sqlite sqlite-dev sqlite-libs tree
20
21
 
21
22
  COPY Gemfile lazylead.gemspec ./
22
23
 
23
- RUN bundler install
24
+ RUN bundler install --without development
24
25
 
25
26
  COPY bin/lazylead ./bin/lazylead
26
27
  COPY lib ./lib
@@ -28,4 +29,4 @@ COPY upgrades ./upgrades
28
29
 
29
30
  RUN sed -i "s/0\.0\.0/${version}/g" lib/lazylead/version.rb
30
31
 
31
- CMD ["bin/lazylead", "--trace", "--verbose", "--memory-dump"]
32
+ CMD ["bin/lazylead", "--trace", "--verbose"]
@@ -0,0 +1,10 @@
1
+ FROM dgroup/lazylead:0.0.0
2
+
3
+ LABEL about="https://github.com/dgroup/lazylead" \
4
+ ci.contact="yurii.dubinka@gmail.com" \
5
+ ci.release.tag="${release_tags}" \
6
+ ll.docker.issues="https://github.com/dgroup/lazylead/issues?utf8=✓&q=label%3Adocker"
7
+
8
+ RUN apk add --no-cache subversion git mercurial
9
+
10
+ CMD ["bin/lazylead", "--trace", "--verbose"]
@@ -0,0 +1,107 @@
1
+ ## Give the score for the format of each incoming ticket to your team
2
+ #### Why?
3
+ When you have a pipeline between several teams, there should be criteria on how to pass a task between groups.
4
+ Without this, you may get the delays for your task because your team members have to do the work that is not their business, or they even don't have the skills to do it properly.
5
+ As a result, it may cause task delays or quality decreasing.
6
+
7
+ Even if you define the criteria for passing tasks between teams, it's tough to monitor that those criteria aren't violating. To hire a well-paid additional manager who will check each ticket and send emails its expensive unless you work for a bloody reach company.
8
+
9
+ This rule periodically checks the format of the ticket, post score results to the ticket, and raise email (one email per bunch of tickets) to you with details.
10
+
11
+ #### How to use lazylead for this
12
+ Let's assume that
13
+ 1. Your team is working in Jira
14
+ 2. You want daily to check the format of incoming defects to your team
15
+ 3. [JQL](https://www.atlassian.com/blog/jira-software/jql-the-most-flexible-way-to-search-jira-14) for incoming defects: `project='PRJ' and type=Defect and created < -2h and created > -26h`.
16
+ This `< -2h` and `> -26h` gives reporter 2h to fill the ticket correctly, and, after that, the task will evaluate the ticket score.
17
+ 4. you've saved this [JQL](https://www.atlassian.com/blog/jira-software/jql-the-most-flexible-way-to-search-jira-14) as jira filter with id `222`.
18
+
19
+ For simplicity, we are using [docker-compose](https://docs.docker.com/compose/):
20
+ 1. Define yml file with `docker-compose` configuration in `lazylead.yml`
21
+ ```yml
22
+ version: '2.3'
23
+ services:
24
+ lazylead:
25
+ image: dgroup/lazylead:latest
26
+ container_name: lazylead
27
+ mem_limit: 128m
28
+ environment:
29
+ # The jira server details.
30
+ # Please ensure that your jira filter(s) grants this user to see issues.
31
+ # Sometimes jira filter(s) may be created with restricted visibility, thus
32
+ # lazylead can't find the issues.
33
+ jira_url: https://your.jira.com
34
+ jira_user: theuser
35
+ jira_password: thepass
36
+ volumes:
37
+ - ./:/lazylead/db
38
+ # db/ll.db is sqlite file with jira related annoying tasks
39
+ entrypoint: bin/lazylead --sqlite db/ll.db --trace --verbose
40
+ ```
41
+
42
+ 2. Create a container, using `docker-compose -f lazylead.yml up`
43
+ The container will stop as there were no tasks provided:
44
+ ```bash
45
+ ll > docker-compose -f lazylead.yml up
46
+ Creating lazylead ... done
47
+ Attaching to lazylead
48
+ lazylead | [2020-08-09T06:17:32] DEBUG [main] Version: 0.4.0
49
+ lazylead | [2020-08-09T06:17:32] DEBUG [main] Memory footprint at start is 52MB
50
+ lazylead | [2020-08-09T06:17:32] DEBUG [main] Database: '/lazylead/db/ll.db', sql migration dir: '/lazylead/upgrades/sqlite'
51
+ lazylead | [2020-08-09T06:17:32] DEBUG [main] Migration applied to /lazylead/db/ll.db from /lazylead/upgrades/sqlite
52
+ lazylead | [2020-08-09T06:17:32] DEBUG [main] Database connection established
53
+ lazylead | [2020-08-09T06:17:32] DEBUG [main] SMTP connection established with {host} as {user}.
54
+ lazylead | [2020-08-09T06:17:32] WARN [main] ll-001: No tasks found.
55
+ lazylead | [2020-08-09T06:17:32] DEBUG [main] Memory footprint at the end is 67MB
56
+ ll >
57
+ ```
58
+
59
+ 3. Define your team and tasks in database.
60
+ The tables structure defined [here](../upgrades/sqlite/001-install-main-lazylead-tables.sql).
61
+ Modify you [sqlite](https://sqlite.com/index.html) file(`ll.db`) using [DB Browser](https://sqlitebrowser.org/) or any similar tool.
62
+ ```sql
63
+ insert into teams (id, name, properties)
64
+ values (1, 'Dream team with lazylead', '{}');
65
+ insert into systems(id, properties)
66
+ values (1,'{"type":"Lazylead::Jira", "username":"${jira_user}", "password":"${jira_password}", "site":"${jira_url}", "context_path":""}');
67
+ insert into tasks (name, cron, enabled, id, system, team_id, action, properties)
68
+ values ('Post ticket score and accuracy to the tickets',
69
+ '0 8 * * 1-5',
70
+ 'true',
71
+ 1, 1, 1,
72
+ 'Lazylead::Task::Accuracy',
73
+ '{
74
+ "jql": "filter=222",
75
+ "to": "lead@fake.com",
76
+ "rules": "Lazylead::AffectedBuild",
77
+ "colors": "{ "0": "#FF4F33", "35": "#FF9F33", "57": "#19DD1E", "90": "#0FA81A" }",
78
+ "docs": "https://github.com/dgroup/lazylead/blob/master/.github/ISSUE_TEMPLATE/bug_report.md",
79
+ "max_results": "200",
80
+ "subject": "[LL] Raised tickets",
81
+ "template": "lib/messages/accuracy.erb"
82
+ }
83
+ ');
84
+ ```
85
+ Yes, for task scheduling we are using [cron](https://crontab.guru).
86
+
87
+ 4. Once you changed `./ll.db`, please restart the container using `docker-compose -f .github/tasks.yml restart`
88
+ ```bash
89
+ ll > docker-compose -f .github/tasks.yml restart
90
+ Restarting lazylead ... done
91
+ ```
92
+
93
+ 5. Once task completed, please check your defects, they should have comment like
94
+ ![jira comment](accuracy_jira_comment.jpg)
95
+
96
+ and you'll get an email like
97
+ ![email](accuracy_email.jpg)
98
+
99
+
100
+ #### Where is the code?
101
+ | Logic | Tests |
102
+ | :-----: | :------: |
103
+ | [accuracy.rb](../lib/lazylead/task/accuracy/accuracy.rb)| [accuracy_test.rb](../test/lazylead/task/accuracy/accuracy_test.rb) |
104
+
105
+ #### How can I add my own rules?
106
+ The custom rules should extend `Lazylead::Requirement` class and placed it to the `lib/lazylead/task/accuracy` folder.
107
+ After that, you need to mention your custom rules in `rules` option in the column `properties` from `tasks` table
Binary file
@@ -0,0 +1,92 @@
1
+ ## Notify Jira ticket assignee about expired(ing) due date
2
+ #### Why?
3
+ Why do we need this if Jira has `Filter Subscription` feature:
4
+ - https://confluence.atlassian.com/jira064/receiving-search-results-via-email-720416706.html
5
+ - https://confluence.atlassian.com/jiracorecloud/advanced-searching-765593707.html
6
+
7
+ As far as I know, filter subscription feature doesn't allow(for now) to group tickets by assignee and send to each of them personal message with missing due dates.
8
+ Right now its just send whole list of tickets to you or specified group.
9
+ In worst cases, shared responsibility leads to irresponsibility each individual.
10
+
11
+ #### How to use lazylead for this
12
+ Let's assume that
13
+ 1. JQL for tickets with expired due dates: `project = PRJ and resolution = unresolved and duedate < startOfDay()`
14
+ 2. you've saved this JQL as jira filter with id `222`
15
+ 3. you want to sent an email notification to each assignee about his/her missing due dates over `MS Exchange server`
16
+
17
+ For simplicity, we are using [docker-compose](https://docs.docker.com/compose/):
18
+ 1. Define yml file with `docker-compose` configuration in `lazylead.yml`
19
+ ```yml
20
+ version: '2.3'
21
+ services:
22
+ lazylead:
23
+ image: dgroup/lazylead:latest
24
+ container_name: lazylead
25
+ mem_limit: 128m
26
+ environment:
27
+ # The jira server details.
28
+ # Please ensure that your jira filter(s) grants this user to see issues.
29
+ # Sometimes jira filter(s) may be created with restricted visibility, thus
30
+ # lazylead can't find the issues.
31
+ jira_url: https://your.jira.com
32
+ jira_user: theuser
33
+ jira_password: thepass
34
+ # The MS Exchange server details, please ensure that '/ews/Exchange.asm`
35
+ # will be after your server url. Just change the url to your server.
36
+ exchange_url: https://your.ms.exchange.server/ews/Exchange.asmx
37
+ exchange_user: theuser
38
+ exchange_password: the password
39
+ volumes:
40
+ - ./:/lazylead/db
41
+ # db/ll.db is sqlite file with jira related annoying tasks
42
+ entrypoint: bin/lazylead --sqlite db/ll.db --trace --verbose
43
+ ```
44
+
45
+ 2. Create a container, using `docker-compose -f lazylead.yml up`
46
+ The container will stop as there were no tasks provided:
47
+ ```bash
48
+ ll > docker-compose -f lazylead.yml up
49
+ Creating lazylead ... done
50
+ Attaching to lazylead
51
+ lazylead | [2020-06-06T10:35:13] DEBUG Memory footprint at start is 52MB
52
+ lazylead | [2020-06-06T10:35:13] DEBUG Database: '/lazylead/db/ll.db', sql migration dir: '/lazylead/upgrades/sqlite'
53
+ lazylead | [2020-06-06T10:35:13] DEBUG Migration applied to /lazylead/db/ll.db from /lazylead/upgrades/sqlite
54
+ lazylead | [2020-06-06T10:35:13] DEBUG Database connection established
55
+ lazylead | [2020-06-06T10:35:13] WARN SMTP connection enabled in test mode.
56
+ lazylead | [2020-06-06T10:35:13] WARN ll-001: No tasks found.
57
+ lazylead | [2020-06-06T10:35:13] DEBUG Memory footprint at the end is 66MB
58
+ lazylead exited with code 0
59
+ ll >
60
+ ```
61
+
62
+ 3. Define your team and tasks in database.
63
+ The tables structure defined [here](../upgrades/sqlite/001-install-main-lazylead-tables.sql).
64
+ Modify you [sqlite](https://sqlite.com/index.html) file(`ll.db`) using [DB Browser](https://sqlitebrowser.org/) or any similar tool.
65
+ You may add your email into tasks.properties `"cc":"your@email.com"` in order to be aware that developer got the message, but i don't recommend you as you'll get a dozen of messages in a few days :) .
66
+ ```sql
67
+ insert into teams (id, name, properties)
68
+ values (1, 'Dream team with lazylead', '{}');
69
+ insert into systems(id, properties)
70
+ values (1,'{"type":"Lazylead::Jira", "username":"${jira_user}", "password":"${jira_password}", "site":"${jira_url}", "context_path":""}');
71
+ insert into tasks (name, cron, enabled, id, system, team_id, action, properties)
72
+ values ('Expired due dates',
73
+ '0 8 * * 1-5',
74
+ 'true',
75
+ 1, 1, 1,
76
+ 'Lazylead::Task::AssigneeAlert',
77
+ '{"sql":"filter=222", "cc":"<youremail.com>", "subject":"[LL] Expired due dates", "template":"lib/messages/due_date_expired.erb", "postman":"Lazylead::Exchange"}');
78
+
79
+ ```
80
+ Yes, for task scheduling we are using [cron](https://crontab.guru).
81
+
82
+ 4. Once you changed `./ll.db`, please restart the container using `docker-compose -f .github/tasks.yml restart`
83
+ ```bash
84
+ ll > docker-compose -f .github/tasks.yml restart
85
+ Restarting lazylead ... done
86
+ ```
87
+
88
+
89
+ #### Where is the code?
90
+ | Logic | Tests | Email Template |
91
+ | :-----: | :------: | :-----: |
92
+ | AssigneeAlert in [alert.rb](../lib/lazylead/task/alert.rb)| [duedate_test.rb](../test/lazylead/task/duedate_test.rb) | [due_date_expired.erb](../lib/messages/due_date_expired.erb) |
@@ -0,0 +1,89 @@
1
+ ## Propagate fields from parent Jira ticket to sub-tasks
2
+ #### Why?
3
+ Why do we need this if Jira has automation already?
4
+
5
+ Could you able use this feature right now? Just right now, without requests to some admin/jira owner/submitting some tickets to someone/etc... I doubt.
6
+ In a huge company that's almost impossible to change something special for you in short terms.
7
+
8
+ #### How to use lazylead for this
9
+ Let's assume that
10
+ 1. JQL for parent tickets for the propagation: `issue in parentsOf("project='PRJ' and 'External ID' is empty") and "External ID" is not empty and updated >-1d`.
11
+ 2. you've saved this JQL as jira filter with id `222`.
12
+
13
+ For simplicity, we are using [docker-compose](https://docs.docker.com/compose/):
14
+ 1. Define yml file with `docker-compose` configuration in `lazylead.yml`
15
+ ```yml
16
+ version: '2.3'
17
+ services:
18
+ lazylead:
19
+ image: dgroup/lazylead:latest
20
+ container_name: lazylead
21
+ mem_limit: 128m
22
+ environment:
23
+ # The jira server details.
24
+ # Please ensure that your jira filter(s) grants this user to see issues.
25
+ # Sometimes jira filter(s) may be created with restricted visibility, thus
26
+ # lazylead can't find the issues.
27
+ jira_url: https://your.jira.com
28
+ jira_user: theuser
29
+ jira_password: thepass
30
+ volumes:
31
+ - ./:/lazylead/db
32
+ # db/ll.db is sqlite file with jira related annoying tasks
33
+ entrypoint: bin/lazylead --sqlite db/ll.db --trace --verbose
34
+ ```
35
+
36
+ 2. Create a container, using `docker-compose -f lazylead.yml up`
37
+ The container will stop as there were no tasks provided:
38
+ ```bash
39
+ ll > docker-compose -f lazylead.yml up
40
+ Creating lazylead ... done
41
+ Attaching to lazylead
42
+ lazylead | [2020-06-06T10:35:13] DEBUG Memory footprint at start is 52MB
43
+ lazylead | [2020-06-06T10:35:13] DEBUG Database: '/lazylead/db/ll.db', sql migration dir: '/lazylead/upgrades/sqlite'
44
+ lazylead | [2020-06-06T10:35:13] DEBUG Migration applied to /lazylead/db/ll.db from /lazylead/upgrades/sqlite
45
+ lazylead | [2020-06-06T10:35:13] DEBUG Database connection established
46
+ lazylead | [2020-06-06T10:35:13] WARN SMTP connection enabled in test mode.
47
+ lazylead | [2020-06-06T10:35:13] WARN ll-001: No tasks found.
48
+ lazylead | [2020-06-06T10:35:13] DEBUG Memory footprint at the end is 66MB
49
+ lazylead exited with code 0
50
+ ll >
51
+ ```
52
+
53
+ 3. Define your team and tasks in database.
54
+ The tables structure defined [here](../upgrades/sqlite/001-install-main-lazylead-tables.sql).
55
+ Modify you [sqlite](https://sqlite.com/index.html) file(`ll.db`) using [DB Browser](https://sqlitebrowser.org/) or any similar tool.
56
+ ```sql
57
+ insert into teams (id, name, properties)
58
+ values (1, 'Dream team with lazylead', '{}');
59
+ insert into systems(id, properties)
60
+ values (1,'{"type":"Lazylead::Jira", "username":"${jira_user}", "password":"${jira_password}", "site":"${jira_url}", "context_path":""}');
61
+ insert into tasks (name, cron, enabled, id, system, team_id, action, properties)
62
+ values ('Propagate customfield_1 (External ID) to sub-tasks',
63
+ '0 8 * * 1-5',
64
+ 'true',
65
+ 1, 1, 1,
66
+ 'Lazylead::Task::PropagateDown',
67
+ '{"jql":"filter=222", "propagate":"customfield_1"}');
68
+
69
+ ```
70
+ Yes, for task scheduling we are using [cron](https://crontab.guru).
71
+
72
+ 4. Once you changed `./ll.db`, please restart the container using `docker-compose -f .github/tasks.yml restart`
73
+ ```bash
74
+ ll > docker-compose -f .github/tasks.yml restart
75
+ Restarting lazylead ... done
76
+ ```
77
+
78
+ 5. Once task completed, please check your sub-tasks, they should have `customfield_1` and comment like
79
+ ```text
80
+ The following fields were propagated from <parent-ticket-key>:
81
+ ||Field||Value||
82
+ |customfield_1|<parent-field-value>|
83
+ Posted by [lazylead v0.0.0|https://bit.ly/2NjdndS]]
84
+ ```
85
+
86
+ #### Where is the code?
87
+ | Logic | Tests |
88
+ | :-----: | :------: |
89
+ | [propagate_down.rb](../lib/lazylead/task/propagate_down.rb)| [propagate_down_test.rb](../test/lazylead/task/propagate_down_test.rb) |
data/.pdd CHANGED
@@ -2,4 +2,4 @@
2
2
  --verbose
3
3
  --exclude target/**/*
4
4
  --exclude coverage/**/*
5
- --rule min-words:5
5
+ --rule min-words:7
@@ -25,7 +25,7 @@ Metrics/BlockLength:
25
25
  - "*.gemspec"
26
26
  - "Rakefile"
27
27
  - "bin/lazylead"
28
- - "test/lazylead/cli/start_test.rb"
28
+ - "test/**/*"
29
29
 
30
30
  Metrics/ClassLength:
31
31
  Exclude:
@@ -77,6 +77,12 @@ Style/HashTransformKeys:
77
77
  Style/HashTransformValues:
78
78
  Enabled: true
79
79
 
80
+ # @todo #/DEV accuracy.rb is using % symbol in text message and rubocop
81
+ # complains about it. It's false-positive violation, thus, for now ignored for this file
82
+ Style/FormatStringToken:
83
+ Exclude:
84
+ - "lib/lazylead/task/accuracy/accuracy.rb"
85
+
80
86
  Lint/RaiseException:
81
87
  Enabled: true
82
88
 
@@ -16,13 +16,13 @@ release:
16
16
  sed -i "s/0\.0\.0/${tag}/g" lib/lazylead/version.rb
17
17
  sed -i "s/0\.0\.0/${tag}/g" lazylead.gemspec
18
18
  bundle install --no-color
19
- bundle exec rake test rubocop sqlint xcop
19
+ bundle exec rake --trace test rubocop sqlint xcop
20
20
  git add lib/lazylead/version.rb lazylead.gemspec
21
21
  git commit -m "version set to ${tag}"
22
22
  gem build lazylead.gemspec
23
23
  chmod 0600 ../rubygems.yml
24
24
  gem push *.gem --config-file ../rubygems.yml
25
- curl -s -X POST --url "https://circleci.com/api/v2/project/gh/dgroup/lazylead/envvar" -H @../circleci.header -H "accept: application/json" -H "content-type: application/json" -d "{ \"name\": \"DOCKER_RELEASE_TAGS\", \"value\": \"latest ${tag}\" }" -o /dev/null
25
+ curl -s -X POST --url "https://circleci.com/api/v2/project/gh/dgroup/lazylead/envvar" -H @../circleci.header -H "accept: application/json" -H "content-type: application/json" -d "{ \"name\": \"DOCKER_RELEASE_TAGS\", \"value\": \"${tag}\" }" -o /dev/null
26
26
  curl -s -X POST --url https://circleci.com/api/v2/project/gh/dgroup/lazylead/pipeline -H @../circleci.header -H 'accept: application/json' -H 'content-type: application/json' -H 'x-attribution-login: dgroup' -o /dev/null
27
27
  merge:
28
28
  script: |-
data/.simplecov CHANGED
@@ -1,11 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
- # @todo #/DEV Increase code coverage from 75% to 80%+.
4
- # Right now it was decreased to 75% due to long manual setup of
5
- # dev. instances of Atlassian Jira and Confluence.
6
- # It was configured locally and there is no automation for now how
7
- # it can be included quickly into CI process. This need to be done later.
8
-
9
3
  SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
10
4
  [SimpleCov::Formatter::HTMLFormatter]
11
5
  )