Skip to content

Commit a035a13

Browse files
committed
three more hasty typing sessions
1 parent 36b5d0f commit a035a13

File tree

6 files changed

+553
-128
lines changed

6 files changed

+553
-128
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ wheels/
2424
pip-log.txt
2525
pip-delete-this-directory.txt
2626

27-
# Credentials
28-
/personal-config.ini
27+
# Credentials and other configurations
28+
config/

Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ FROM python:3.6
22

33
ADD jira-dependency-graph.py /jira/
44
ADD requirements.txt /jira/
5-
ADD personal-config.ini /jira/
65
WORKDIR /jira
76
RUN apt-get update \
87
&& apt-get install -y --no-install-recommends graphviz \

README.md

Lines changed: 95 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -165,47 +165,105 @@ Notes:
165165
======
166166
Based on: [draw-chart.py](https://developer.atlassian.com/download/attachments/4227078/draw-chart.py) and [Atlassian JIRA development documentation](https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Version+2+Tutorial#JIRARESTAPIVersion2Tutorial-Example#1:GraphingImageLinks), which seemingly was no longer compatible with JIRA REST API Version 2.
167167

168-
Apologies and Messy Changes:
169-
======
170-
This single commit for the sake of sharing immediately, is less than awesome. I'd love to come back and clean both the code and the comments, especially since there are other tweaks to come.
171-
172-
Things included in this messy single commit:
173-
174-
1. Getting started, you'll need to create then update `personal-config.ini` with your Jira credentials. **BEWARE**: do not commit this file, so you don't accidentally share your creds!
175-
```bash
176-
echo "[EXAMPLE]\nJIRA_HOST = https://example.atlassian.net\nJIRA_USER = [email protected]\nJIRA_PASS = # Create an API key at https://id.atlassian.com/manage-profile/security/api-tokens\n" > personal-config.ini
177-
```
178-
179-
2. For access to multiple organizations, add those additional creds in `personal-config.ini` then specify on the command line with the `--org` option. The script will default to the first org it finds, unless `--org` is specified.
180-
```bash
181-
--org=EXAMPLE
182-
```
183-
184-
2. Once you've added your creds, if you are aimed at using the docker version, you'll need to build the docker image. **BEWARE**: This image will contain a copy of your `personal-config.ini` (which contains your Jira creds), so don't share this image unless you intend to share your credentials!
185-
```bash
186-
> docker build -t jira .
187-
```
188-
189-
5. If you prefer to use your own installation of graphviz, you can pipe the output of using `--local` to it, such as
190-
```bash
191-
> docker run -v $PWD/out:/out jira python jira-dependency-graph.py --show-directions=outward --local --word-wrap VOICE-123 | dot -Tpng > ~/Desktop/VOICE-123-graph.png
192-
```
193168

194-
6. The non-`--local` version seemed broken since google isn't handling that endpoint anymore, so Graphviz is now included in the docker image. i.e., no longer required to use --local then pipe to dot (graphviz) on your host machine.
195-
```bash
196-
> docker run -v $PWD/out:/out jira python jira-dependency-graph.py --show-directions=outward --word-wrap VOICE-123
197-
```
198-
199-
7. An additional artifact when this script is executed without `--local`, will be a PDF version of the diagram, where each node on the diagram hyperlinks you to its corresponding card on jira
169+
Apologies and Messy Changes (gfaza customizations WIP):
170+
======
171+
These hasty and large commits for the sake of sharing quickly, are less than congenial. I'd love to come back and clean both the code and the comments, especially since there are other tweaks to come.
200172

173+
**Please Note:** Backward compatibility with the above hasn't been asserted.
201174

202-
8. A new command line option, to automatically update a card with your diagram. destination card can be any card, whether or not it's related to the diagram:
175+
**FWIW:** These changes were developed and utilized with the following suggested runtime options:
203176
```bash
204-
--issue-update=<jira-card-key>
177+
-show-directions=outward --word-wrap --include-state --include-labels
205178
```
206179

207-
Wishlist/Upcoming changes:
180+
Things included in these changes:
181+
182+
1. Getting started, you'll need to create then update `personal-config.ini` with your Jira credentials. **BEWARE**: do not commit this file, so you don't accidentally share your creds! Additionally, you'll likely enjoy updating the domain-specific configuration template in order to stylize your output.
183+
```bash
184+
> ./initialize-organization-configuration.sh
185+
```
186+
or in case that fails, the following:
187+
```bash
188+
> mkdir ./config
189+
> echo "[EXAMPLE]\nJIRA_HOST = https://example.atlassian.net\nJIRA_USER = [email protected]\nJIRA_PASS = # Create an API key at https://id.atlassian.com/manage-profile/security/api-tokens\n\n" > ./config/personal-config.ini
190+
> echo "### define the color scheme and state color progression to use. ###\ncolor-setting:\n color-scheme: ylgn9\n fill-colors: [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ]\n font-colors: [None, None, None, None, None, None, white, white, white ]\n### define any graph attributes particular to specific node types ###\nnodes:\n - name: [ epic ]\n node-options:\n shape: cylinder\n labelloc: b\n edge-options:\n color: orange\n - name: [ label ]\n node-options:\n shape: cds\n edge-options:\n color: grey85\n### define any graph attributes particular to specific edge types ###\nedges:\n - name: [ epic ]\n edge-options:\n color: orange\n - name: [ subtask ]\n edge-options:\n color: blue\n label: subtask\n - name: [ block ]\n edge-options:\n color: red\n### define the issue states to be colored according to the custom color scheme progression. any omitted will show according to the status category: yellow ('In Progress'), green ('Complete'), else (no color/white) ###\nworkflows:\n - issue-types: [ epic ]\n states:\n # - backlog\n - in progress\n - completed\n - issue-types: [ story, bug ]\n states:\n # - backlog\n # - ready for development\n - in development\n - ready for testing\n - in testing\n - ready for release\n - released\n### consolidate groups of labels to a single alias ###\nlabels:\n - name: Defect\n group: [ defect, bug, staging-bug, production-bug ]\n - name: Research & Development\n group: [ spike, arch, architecture, research, r&d ]\n ### labels to omit from diagrams ###\n - ignore: [ documentation, testing, tech-debt ]\n" > ./config/example-config.yml
191+
```
192+
193+
3. For access to multiple organizations, add those additional creds in `personal-config.ini` then specify on the command line with the `--org` option. The script will default to the first `[SECTION]` it finds in your `personal-config.ini`, unless `--org` is specified.
194+
```bash
195+
--org=SOME_ADDITIONAL_ORGANIZATION_I_BELONG_TO
196+
```
197+
198+
4. If you are aiming to use the docker version, you'll need to build the docker image. This is recommended if you're concerned about ruining your local Python environment or hesitant about installing Graphviz on your local machine.
199+
```bash
200+
> docker build -t jira .
201+
```
202+
203+
5. When using the config directory, you'll need to add the share to that directory by adding the following to your command:
204+
```bash
205+
$PWD/config:/config
206+
```
207+
208+
6. If you prefer to use your own installation of Graphviz, you can pipe the output of using `--local` to it, such as
209+
```bash
210+
> docker run -v $PWD/config:/config -v $PWD/out:/out jira python jira-dependency-graph.py --local STORY-123 | dot -Tpng > ~/Desktop/STORY-123-graph.png
211+
```
212+
213+
7. The non-`--local` version seemed broken since google isn't handling that endpoint anymore, so Graphviz is now included in the docker image. i.e., we're no longer required to use --local then pipe to dot (Graphviz) on your host machine.
214+
```bash
215+
> docker run -v $PWD/config:/config -v $PWD/out:/out jira python jira-dependency-graph.py STORY-123
216+
```
217+
218+
8. An additional artifact when this script is executed without `--local`, will be a PDF version of the diagram, where each node on the diagram hyperlinks you to its corresponding card on Jira
219+
220+
221+
8. New command line option: To automatically update a card with your diagram, specify a destination card. This destination can be any card, whether or not it's related to the diagram. The card specified will receive attachments of the PNG and PDF graphs, and will have it's description updated to include the graph as an embedded image:
222+
```bash
223+
--issue-update=<jira-card-key>
224+
```
225+
226+
9. New command line option: Include issue status/state on your node's label:
227+
```bash
228+
--include-state
229+
```
230+
231+
10. New command line option: Include issue labels as additional nodes on the graph. Can be a useful way of further helping the layout algorithm:
232+
```bash
233+
--include-labels
234+
```
235+
236+
11. New command line option: Include the script command line arguments as the title of your graph:
237+
```bash
238+
--include-arguments
239+
```
240+
241+
12. New command line option: Limit the depth of issues visited, from the issues searched:
242+
```bash
243+
--depth-limit=<some-int>
244+
```
245+
246+
13. Graph configuration yaml: A default yaml will be generated along with the `personal-config.ini`, as a template for customizing the color scheme and other elements of the graphs. be sure to keep the org name in sync with your `personal-config.ini`. e.g., if your `personal-config.ini` section reads `[EXAMPLE]`, then the corresponding yaml file must be named `example-config.yml`.
247+
1. ***color-setting:*** The name of the Graphviz color scheme to use (https://graphviz.org/doc/info/colors.html), and the ordered list of colors to use when rendering issues, as they progress through their given workflow.
248+
1. e.g., `color-setting: { color-scheme: set16, fill-colors: [1, 5, 6, 3, 2, 4] }` would produce graphs in (close to) pride colors.
249+
2. ***nodes:*** Customizations for rendering Epics and Labels (optionally included in diagrams).
250+
3. ***edges:*** Customizations for rendering edges related to Epic, Subtask, and Blocking issues.
251+
4. ***workflows:*** Definitions for your organization's issue types, and the ordered statuses for their respective workflows.
252+
5. ***labels:*** A means of consolidating similar labels to simplify graphing, as well as a means of ignoring/omitting certain labels from appearing.
253+
6. Executing the command for a value of `color-demo` in place of an issue key will produce a partial preview of the graph configuration.
254+
```bash
255+
> docker run -v $PWD/config:/config -v $PWD/out:/out jira python jira-dependency-graph.py color-demo
256+
```
257+
258+
259+
Wishlist/Planned changes:
208260
======
209-
* Improve authentication mechanism, so tokens aren't stored in the clear
210-
* Allow choice of color scheme
211-
* Allow colors to reflect status in the workflow beyond "in progress" and "done" and "else"
261+
* Verify backward and forward compatibility, in both docker and non-docker operation (i.e., ensure enhancements are strictly optional).
262+
* Update/improve documentation.
263+
* Improve output file naming.
264+
* Investigate whether jira issue description embedded PNG can open PDF attachment on click (i.e., embedding PNG to serve as thumbnail href to the PDF).
265+
* Investigate automating updates to a specified confluence page, similar to how this automates updates to jira issues.
266+
* Investigate automatically opening the graph on the local machine after rendering.
267+
* Consider prevent issues from being missed only because the story leading to them is ignored (distinguish ignore vs traverse).
268+
* Develop further flexibility via the configuration yaml.
269+
* Revisit dependencies, and whether they can be reduced/simplified.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
3+
init_org()
4+
{
5+
echo "Initialzing configurations for '${1}'."
6+
uc=$(printf "%s" "$1" | tr '[:lower:]' '[:upper:]')
7+
lc=$(printf "%s" "$1" | tr '[:upper:]' '[:lower:]')
8+
printf "[$uc]\nJIRA_HOST = https://$lc.atlassian.net\nJIRA_USER = # Likely your email address, e.g., alice@$lc.com\nJIRA_PASS = # Create an API key at https://id.atlassian.com/manage-profile/security/api-tokens\n\n" >> ./config/personal-config.ini
9+
printf "### define the color scheme and state color progression to use. ###\ncolor-setting:\n color-scheme: ylgn9\n fill-colors: [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ]\n font-colors: [None, None, None, None, None, None, white, white, white ]\n### define any graph attributes particular to specific node types ###\nnodes:\n - name: [ epic ]\n node-options:\n shape: cylinder\n labelloc: b\n edge-options:\n color: orange\n - name: [ label ]\n node-options:\n shape: cds\n edge-options:\n color: grey85\n### define any graph attributes particular to specific edge types ###\nedges:\n - name: [ epic ]\n edge-options:\n color: orange\n - name: [ subtask ]\n edge-options:\n color: blue\n label: subtask\n - name: [ block ]\n edge-options:\n color: red\n### define the issue states to be colored according to the custom color scheme progression. any omitted will show according to the status category: yellow ('In Progress'), green ('Complete'), else (no color/white) ###\nworkflows:\n - issue-types: [ epic ]\n states:\n # - backlog\n - in progress\n - completed\n - issue-types: [ story, bug ]\n states:\n # - backlog\n # - ready for development\n - in development\n - ready for testing\n - in testing\n - ready for release\n - released\n### consolidate groups of labels to a single alias ###\nlabels:\n - name: Defect\n group: [ defect, bug, staging-bug, production-bug ]\n - name: Research & Development\n group: [ spike, arch, architecture, research, r&d ]\n ### labels to omit from diagrams ###\n - ignore: [ documentation, testing, tech-debt ]\n" > ./config/$lc-config.yml
10+
echo "Please open and update the '[$uc]' section of './config/personal-config.ini' with your credentials, and './config/$lc-config.yml' as desired for graph customization."
11+
}
12+
13+
mkdir -p ./config
14+
15+
echo "Please enter the domain of your jira organization, to initialize a configuration for it. e.g., If your organization's url is 'example.atlassian.net', then enter 'example' as the domain."
16+
read domain
17+
init_org $domain

0 commit comments

Comments
 (0)