From 6f1c3a8e0edff952d47625d26262555e87daa15c Mon Sep 17 00:00:00 2001 From: Ivan Lausuch Date: Tue, 26 Apr 2022 12:36:51 +0200 Subject: [PATCH] Add aging table --- .github/workflows/backlog_checker.yml | 52 +++++++++++++++++++++++++++ backlog_checker.py | 30 ++++++++++++++++ 2 files changed, 82 insertions(+) diff --git a/.github/workflows/backlog_checker.yml b/.github/workflows/backlog_checker.yml index 4dd606633a..5f3f8f002d 100644 --- a/.github/workflows/backlog_checker.yml +++ b/.github/workflows/backlog_checker.yml @@ -890,6 +890,58 @@ jobs: header: "Public Cloud Epics" + # Aging + - name: aging containers + if: always() + run: | + python backlog_checker.py aging tb_start + env: + key: ${{ secrets.REDMINE_API_KEY }} + query: "Finished In The Last 30 Days: Containers" + header: "Aging tickets finished in the last 30 days" + category: "Aging of tickets" + category_description: | + Mesures the time since the ticket is created and the ticket is resolved + rowText: "Containers" + head: "Days to complete (Adv)" + - name: aging JeOS + if: always() + run: | + python backlog_checker.py aging + env: + key: ${{ secrets.REDMINE_API_KEY }} + query: "Finished In The Last 30 Days: JeOS" + rowText: "JeOS" + head: "Days to complete (Adv)" + - name: aging WSL + if: always() + run: | + python backlog_checker.py aging + env: + key: ${{ secrets.REDMINE_API_KEY }} + query: "Finished In The Last 30 Days: WSL" + rowText: "WSL" + head: "Days to complete (Adv)" + - name: aging Public Cloud + if: always() + run: | + python backlog_checker.py aging + env: + key: ${{ secrets.REDMINE_API_KEY }} + query: "Finished In The Last 30 Days: Public Cloud" + rowText: "Public Cloud" + head: "Days to complete (Adv)" + - name: aging SLE Micro + if: always() + run: | + python backlog_checker.py aging tb_end + env: + key: ${{ secrets.REDMINE_API_KEY }} + query: "Finished In The Last 30 Days: SLE Micro" + rowText: "SLE Micro" + head: "Days to complete (Adv)" + + - name: Footer if: always() run: | diff --git a/backlog_checker.py b/backlog_checker.py index d519142b0e..045140f9cb 100644 --- a/backlog_checker.py +++ b/backlog_checker.py @@ -311,6 +311,34 @@ def gha_epics(): table_end_to_md() print_footer() +def gha_aging(): + initialize_queries() + + root = query_base(os.environ['query']) + + sum = 0 + count = 0 + for i in root['issues']: + created_on = datetime.strptime(i['created_on'], '%Y-%m-%dT%H:%M:%SZ').timestamp() + closed_on = datetime.strptime(i['closed_on'], '%Y-%m-%dT%H:%M:%SZ').timestamp() + difference = (closed_on - created_on) / (60*60*24) + sum = sum + difference + count = count + 1 + + adv = sum / count + + gha_table([ + { + "header": "Backlog Query", + "text": os.environ["rowText"] + }, + { + "header": os.environ['head'], + "text": str(adv), + "link": query_links[os.environ['query']] + } + ]) + def gha_description(): text = os.environ['text'] toMD(text) @@ -325,5 +353,7 @@ def gha_description(): gha_comp_2() elif "description" in sys.argv: gha_description() +elif "aging" in sys.argv: + gha_aging() else: gha_check()