lazylead 0.1.1 → 0.4.0
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.
- checksums.yaml +4 -4
- data/.0pdd.yml +4 -1
- data/.circleci/config.yml +19 -7
- data/.circleci/release_image.sh +6 -3
- data/.docker/Dockerfile +10 -9
- data/.docker/docker-compose.yml +3 -3
- data/.docker/readme.md +24 -21
- data/.docker/vcs.dockerfile +10 -0
- data/.docs/accuracy.md +107 -0
- data/.docs/accuracy_email.jpg +0 -0
- data/.docs/accuracy_jira_comment.jpg +0 -0
- data/.docs/duedate_expired.md +92 -0
- data/.docs/propagate_down.md +89 -0
- data/.pdd +1 -1
- data/.rubocop.yml +7 -1
- data/.rultor.yml +13 -14
- data/.simplecov +0 -6
- data/Rakefile +38 -1
- data/bin/lazylead +13 -5
- data/lazylead.gemspec +6 -17
- data/lib/lazylead/cc.rb +180 -0
- data/lib/lazylead/cli/app.rb +4 -3
- data/lib/lazylead/exchange.rb +15 -2
- data/lib/lazylead/home.rb +38 -0
- data/lib/lazylead/log.rb +30 -8
- data/lib/lazylead/model.rb +60 -16
- data/lib/lazylead/opts.rb +68 -0
- data/lib/lazylead/postman.rb +15 -15
- data/lib/lazylead/schedule.rb +6 -4
- data/lib/lazylead/smtp.rb +1 -1
- data/lib/lazylead/system/fake.rb +1 -1
- data/lib/lazylead/system/jira.rb +55 -12
- data/lib/lazylead/system/synced.rb +2 -1
- data/lib/lazylead/task/accuracy/accuracy.rb +140 -0
- data/lib/lazylead/task/accuracy/affected_build.rb +43 -0
- data/lib/lazylead/task/accuracy/requirement.rb +40 -0
- data/lib/lazylead/task/alert.rb +8 -6
- data/lib/lazylead/task/confluence_ref.rb +4 -3
- data/lib/lazylead/task/echo.rb +4 -0
- data/lib/lazylead/task/fix_version.rb +11 -7
- data/lib/lazylead/task/missing_comment.rb +7 -5
- data/lib/lazylead/task/propagate_down.rb +126 -0
- data/lib/lazylead/task/savepoint.rb +58 -0
- data/lib/lazylead/task/touch.rb +102 -0
- data/lib/lazylead/version.rb +1 -1
- data/lib/messages/accuracy.erb +118 -0
- data/lib/messages/due_date_expired.erb +8 -7
- data/lib/messages/illegal_fixversion_change.erb +9 -8
- data/lib/messages/missing_comment.erb +10 -9
- data/lib/messages/savepoint.erb +43 -0
- data/lib/messages/svn_touch.erb +147 -0
- data/readme.md +90 -80
- data/test/lazylead/cc_test.rb +153 -0
- data/test/lazylead/cli/app_test.rb +3 -4
- data/test/lazylead/exchange_test.rb +22 -2
- data/test/lazylead/model_test.rb +14 -3
- data/test/lazylead/opts_test.rb +66 -0
- data/test/lazylead/postman_test.rb +57 -0
- data/test/lazylead/smtp_test.rb +1 -1
- data/test/lazylead/system/jira_test.rb +43 -1
- data/test/lazylead/task/accuracy/accuracy_test.rb +73 -0
- data/test/lazylead/task/accuracy/affected_build_test.rb +42 -0
- data/test/lazylead/task/assignee_alert_test.rb +47 -0
- data/test/lazylead/task/duedate_test.rb +52 -30
- data/test/lazylead/task/fix_version_test.rb +11 -10
- data/test/lazylead/task/missing_comment_test.rb +13 -13
- data/test/lazylead/task/propagate_down_test.rb +88 -0
- data/test/lazylead/task/savepoint_test.rb +51 -0
- data/test/lazylead/task/touch_test.rb +63 -0
- data/test/test.rb +11 -0
- data/upgrades/sqlite/001-install-main-lazylead-tables.sql +3 -4
- data/upgrades/sqlite/999.testdata.sql +8 -2
- metadata +57 -177
- data/deploy.sh +0 -16
- data/todo.yml +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8f6929a5583f40fca08c1d1293b77cf2f19ea22b1844eb9888a860b79c86b7c
|
4
|
+
data.tar.gz: 07b70000fe7e00aeb7c33b321d1f35c99dccb8220f477650b90a693ea8688c0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1699bbdc2484d6a77715b11bb0f666e70e18e3bc5927d79ee02cee3bfcc4e6bf6d848a74a5c287990e56d059f669f07dc9e450f7af6992b63881288f481e062e
|
7
|
+
data.tar.gz: 0c471418e7ed2a92d740d0e362c0bcd9ce37eca1538272eab8abe0eff4fb3b01df1559b5f16d7af9ed3dfa52d06ebb5ff1c6a10cb897df7aeab3e119f8fe63c3
|
data/.0pdd.yml
CHANGED
data/.circleci/config.yml
CHANGED
@@ -11,31 +11,43 @@ jobs:
|
|
11
11
|
- run: |
|
12
12
|
apk add libc-dev gcc make git sqlite sqlite-dev sqlite-libs
|
13
13
|
bundler install
|
14
|
-
- run: rake test rubocop xcop
|
14
|
+
- run: bundle exec rake test rubocop sqlint xcop
|
15
15
|
deploy:
|
16
16
|
machine: true
|
17
17
|
steps:
|
18
18
|
- checkout
|
19
|
-
# build the application image
|
20
19
|
- run:
|
21
|
-
name: "Build
|
20
|
+
name: "Build LL image"
|
22
21
|
command: |
|
23
22
|
set -e
|
24
|
-
COMMIT_URL="https://github.com/dgroup/
|
25
|
-
|
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
|
+
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
|
28
|
+
echo "Available LL images:"
|
29
|
+
docker images | grep lazylead
|
28
30
|
docker run --rm dgroup/lazylead:${CIRCLE_BRANCH} bin/lazylead --verbose > trace.log
|
29
31
|
cat trace.log
|
30
32
|
expected="No tasks found"
|
31
33
|
echo "Ensure that app prints the line '${expected}'."
|
32
34
|
grep --color "${expected}" trace.log
|
33
|
-
# publish the image
|
34
35
|
- run:
|
35
|
-
name: "
|
36
|
+
name: "Push LL image"
|
36
37
|
command: |
|
37
38
|
chmod +x .circleci/release_image.sh
|
38
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\" }"
|
39
51
|
workflows:
|
40
52
|
version: 2
|
41
53
|
build_and_test:
|
data/.circleci/release_image.sh
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
#!/bin/bash
|
2
|
-
|
2
|
+
set -e
|
3
|
+
echo "Release tags: ${DOCKER_RELEASE_TAGS}"
|
3
4
|
docker login --username "${DOCKER_USER}" --password "${DOCKER_TOKEN}"
|
4
5
|
if [ "${CIRCLE_BRANCH}" == "master" ]; then
|
5
|
-
for tag in ${
|
6
|
+
for tag in ${DOCKER_RELEASE_TAGS// / } ; do
|
6
7
|
docker tag "dgroup/lazylead:${CIRCLE_BRANCH}" "dgroup/lazylead:${tag}"
|
7
8
|
docker push "dgroup/lazylead:${tag}"
|
8
9
|
echo "dgroup/lazylead:${tag} released"
|
@@ -10,4 +11,6 @@ if [ "${CIRCLE_BRANCH}" == "master" ]; then
|
|
10
11
|
else
|
11
12
|
docker push "dgroup/lazylead:${CIRCLE_BRANCH}"
|
12
13
|
echo "dgroup/lazylead:${CIRCLE_BRANCH} released"
|
13
|
-
fi
|
14
|
+
fi
|
15
|
+
echo "Available LL images:"
|
16
|
+
docker images | grep lazylead
|
data/.docker/Dockerfile
CHANGED
@@ -1,31 +1,32 @@
|
|
1
1
|
FROM ruby:2.6.5-alpine
|
2
2
|
|
3
3
|
ARG release_tags
|
4
|
+
ARG version
|
4
5
|
|
5
6
|
LABEL about="https://github.com/dgroup/lazylead" \
|
6
7
|
ci.contact="yurii.dubinka@gmail.com" \
|
7
8
|
ci.release.tag="${release_tags}" \
|
8
9
|
ll.docker.issues="https://github.com/dgroup/lazylead/issues?utf8=✓&q=label%3Adocker"
|
9
10
|
|
10
|
-
ENV APP_HOME=/lazylead
|
11
|
-
version=${release_tags}
|
11
|
+
ENV APP_HOME=/lazylead
|
12
12
|
|
13
13
|
WORKDIR $APP_HOME
|
14
14
|
|
15
|
-
# @todo #/DEV
|
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
|
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
|
-
|
27
|
+
COPY lib ./lib
|
28
|
+
COPY upgrades ./upgrades
|
28
29
|
|
29
|
-
|
30
|
+
RUN sed -i "s/0\.0\.0/${version}/g" lib/lazylead/version.rb
|
30
31
|
|
31
|
-
|
32
|
+
CMD ["bin/lazylead", "--trace", "--verbose"]
|
data/.docker/docker-compose.yml
CHANGED
@@ -10,9 +10,9 @@ services:
|
|
10
10
|
build:
|
11
11
|
context: ../
|
12
12
|
dockerfile: .docker/Dockerfile
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
args:
|
14
|
+
release_tags: "latest 0.1.0"
|
15
|
+
version: "0.1.0"
|
16
16
|
ports:
|
17
17
|
- 82:8080
|
18
18
|
- 1082:1082 # remote debug
|
data/.docker/readme.md
CHANGED
@@ -1,21 +1,24 @@
|
|
1
|
-
#### Docker
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
1
|
+
#### Docker FAQ
|
2
|
+
- Prepare environment
|
3
|
+
````bash
|
4
|
+
docker start <container_name> # start particular container
|
5
|
+
docker start -i <container_name> # start particular container in interactive mode
|
6
|
+
docker stop <container_name> # stop particular container
|
7
|
+
docker ps # display all running containers
|
8
|
+
docker ps -a # display all existing containers (stopped)
|
9
|
+
docker exec -it <container_name> /bin/bash # join to the container via bash
|
10
|
+
docker rm <container_name> # remove particular container
|
11
|
+
docker rmi <image_name> # remove particular image
|
12
|
+
docker pull <image_name> # download particular image from the remote repository (NC Artifactory, dockerhub, etc)
|
13
|
+
````
|
14
|
+
|
15
|
+
- Monitoring
|
16
|
+
```bash
|
17
|
+
# Display on-line information regarding system usage (CPU,RAM,IO) per container
|
18
|
+
docker stats $(docker ps --format '{{.Names}}')
|
19
|
+
docker stats $(docker ps | awk '{if(NR>1) print $NF}')
|
20
|
+
```
|
21
|
+
|
22
|
+
- [Cheat sheet](https://gist.github.com/dgroup/5046bac5531fae11242dd03201626f5b)
|
23
|
+
|
24
|
+
- [Basics](https://github.com/wsargent/docker-cheat-sheet)
|
@@ -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"]
|
data/.docs/accuracy.md
ADDED
@@ -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::RequirementAffectedBuild",
|
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
|
+

|
95
|
+
|
96
|
+
and you'll get an email like
|
97
|
+

|
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
|
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) |
|