You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by kn...@apache.org on 2021/04/12 16:02:47 UTC
[flink-jira-bot] branch master updated (647197b -> ad9bbe7)
This is an automated email from the ASF dual-hosted git repository.
knaufk pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git.
from 647197b Initial commit with the ASL
new f5aa96e [FLINK-22032] add Makefile and requirements.txt
new bf4c4c1 [FINK-22032] add freeze target to Makefile
new c343d83 [FLINK-22032] add confuse for YAML configuration parsing
new 6f4e13c [FLINK-22032] add Rule 3 (logging only)
new 0561a81 [FLINK-22032] introduce dry-run mode and add actual actions to rule 3
new 1709d04 [FLINK-22032] add minimal README
new 3cfda47 [FLINK-22023] add license headers
new ad9bbe7 Merge pull request #1 from knaufk/FLINK-22032
The 9 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.gitignore | 19 ++++++
Makefile | 54 +++++++++++++++
README.md | 55 ++++++++++++++++
config.yaml | 26 ++++++++
flink_jira_bot.py | 192 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
requirements.txt | 41 ++++++++++++
6 files changed, 387 insertions(+)
create mode 100644 .gitignore
create mode 100644 Makefile
create mode 100644 README.md
create mode 100644 config.yaml
create mode 100644 flink_jira_bot.py
create mode 100644 requirements.txt
[flink-jira-bot] 03/09: [FINK-22032] add freeze target to Makefile
Posted by kn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git
commit bf4c4c1144ce3f9f7fca5cccb8ce05b8541efe28
Author: Konstantin Knauf <kn...@gmail.com>
AuthorDate: Fri Apr 9 11:34:34 2021 +0200
[FINK-22032] add freeze target to Makefile
---
Makefile | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Makefile b/Makefile
index a9c933b..40ca9f7 100644
--- a/Makefile
+++ b/Makefile
@@ -17,6 +17,9 @@ run: venv
format: venv
./$(VENV)/bin/python3 -m black .
+freeze: venv
+ ./$(VENV)/bin/pip freeze > requirements.txt
+
clean:
rm -rf $(VENV)
find . -type f -name '*.pyc' -delete
[flink-jira-bot] 06/09: [FLINK-22032] introduce dry-run mode and
add actual actions to rule 3
Posted by kn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git
commit 0561a81f9b9d7db4a277db1465090b97a0c21936
Author: Konstantin Knauf <kn...@gmail.com>
AuthorDate: Fri Apr 9 14:15:15 2021 +0200
[FLINK-22032] introduce dry-run mode and add actual actions to rule 3
---
Makefile | 6 ++++
config.yaml | 6 ++--
flink_jira_bot.py | 102 +++++++++++++++++++++++++++++++++++++++++++++++++-----
requirements.txt | 4 ++-
4 files changed, 106 insertions(+), 12 deletions(-)
diff --git a/Makefile b/Makefile
index 677c9cc..adfff3d 100644
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,12 @@ $(VENV)/bin/activate: requirements.txt
# venv is a shortcut target
venv: $(VENV)/bin/activate
+help: venv
+ ./$(VENV)/bin/python3 flink_jira_bot.py --help
+
+dry-run: venv
+ ./$(VENV)/bin/python3 flink_jira_bot.py -d
+
run: venv
./$(VENV)/bin/python3 flink_jira_bot.py
diff --git a/config.yaml b/config.yaml
index d77f815..727da38 100644
--- a/config.yaml
+++ b/config.yaml
@@ -1,6 +1,8 @@
stale_minor:
stale_days: 180
warning_days: 7
- label: "stale-minor"
- comment: 'This issue (and any of its Sub-Tasks) has not been updated for {stale_days} days. So, it has been labeled "{label}". If you are still affected by this bug or are still interested in this issue, please give an update and remove the label. In {warning_days} days the issue will be closed automatically.'
+ warning_label: "stale-minor"
+ warning_comment: 'This issue and all of its Sub-Tasks have not been updated for {stale_days} days. So, it has been labeled "{warning_label}". If you are still affected by this bug or are still interested in this issue, please give an update and remove the label. In {warning_days} days the issue will be closed automatically.'
+ done_label: "auto-closed"
+ done_comment: 'This issue has been labeled "{warning_label}" for {warning_days} days. It is closed now. If you are still affected by this or would like to raise the priority of this ticket please re-open, removing the label "{done_label}" and raise the ticket priority accordingly.'
diff --git a/flink_jira_bot.py b/flink_jira_bot.py
index a092399..05541ca 100644
--- a/flink_jira_bot.py
+++ b/flink_jira_bot.py
@@ -3,14 +3,18 @@ import logging
import confuse
import os
import abc
+import sys
+from argparse import ArgumentParser
+from pathlib import Path
class FlinkJiraRule:
__metaclass__ = abc.ABCMeta
- def __init__(self, jira_client, config):
+ def __init__(self, jira_client, config, is_dry_run):
self.jira_client = jira_client
self.config = config
+ self.is_dry_run = is_dry_run
def has_recently_updated_subtask(self, parent, updated_within_days):
find_subtasks_updated_within = (
@@ -19,18 +23,54 @@ class FlinkJiraRule:
issues = self.jira_client.jql(find_subtasks_updated_within, limit=1)
return issues["total"] > 0
+ def add_label(self, issue, label):
+ labels = issue["fields"]["labels"] + [label]
+ fields = {"labels": labels}
+ key = issue["key"]
+
+ if not self.is_dry_run:
+ self.jira.update_issue_field(key, fields)
+ else:
+ logging.info(f'DRY RUN ({key}): Adding label "{label}".')
+
+ def replace_label(self, issue, old_label, new_label):
+ labels = issue["fields"]["labels"] + [new_label]
+ labels.remove(old_label)
+ fields = {"labels": labels}
+ key = issue["key"]
+
+ if not self.is_dry_run:
+ self.jira.update_issue_field(key, fields)
+ else:
+ logging.info(
+ f'DRY RUN ({key}): Replace label "{old_label}" for "{new_label}".'
+ )
+
+ def add_comment(self, key, comment):
+ if not self.is_dry_run:
+ jira.issue_add_comment(key, comment)
+ else:
+ logging.info(f'DRY_RUN ({key}): Adding comment "{comment}".')
+
+ def close_issue(self, key):
+ if not self.is_dry_run:
+ jira.issue_transition(key, "Closed")
+ else:
+ logging.info(f"DRY_RUN (({key})): Closing.")
+
@abc.abstractmethod
def run(self):
return
class Rule3(FlinkJiraRule):
- def __init__(self, jira_client, config):
- super().__init__(jira_client, config)
+ def __init__(self, jira_client, config, is_dry_run):
+ super().__init__(jira_client, config, is_dry_run)
self.stale_days = config["stale_minor"]["stale_days"].get()
self.warning_days = config["stale_minor"]["warning_days"].get()
- self.label = config["stale_minor"]["label"].get()
- self.comment = config["stale_minor"]["comment"].get()
+ self.warning_label = config["stale_minor"]["warning_label"].get()
+ self.done_label = config["stale_minor"]["done_label"].get()
+ self.warning_comment = config["stale_minor"]["warning_comment"].get()
def run(self):
self.close_tickets_marked_stale()
@@ -38,7 +78,7 @@ class Rule3(FlinkJiraRule):
def close_tickets_marked_stale(self):
- minor_tickets_marked_stale = f'project=FLINK AND Priority = Minor AND resolution = Unresolved AND labels in ("{self.label}") AND updated < startOfDay(-{self.warning_days}d)'
+ minor_tickets_marked_stale = f'project=FLINK AND Priority = Minor AND resolution = Unresolved AND labels in ("{self.warning_label}") AND updated < startOfDay(-{self.warning_days}d)'
logging.info(
f"Looking for minor tickets, which were previously marked as stale: {minor_tickets_marked_stale}"
)
@@ -50,6 +90,16 @@ class Rule3(FlinkJiraRule):
f"Found https://issues.apache.org/jira/browse/{key}. It is now closed due to inactivity."
)
+ formatted_comment = self.done_comment.format(
+ warning_days=self.warning_days,
+ warning_label=self.warning_label,
+ done_label=self.done_label,
+ )
+
+ self.add_comment(key, formatted_comment)
+ self.replace_label(issue, self.warning_label, self.done_label)
+ self.close_issue(key)
+
def mark_stale_tickets_stale(self):
stale_minor_tickets = f"project = FLINK AND Priority = Minor AND resolution = Unresolved AND updated < startOfDay(-{self.stale_days}d)"
@@ -66,19 +116,53 @@ class Rule3(FlinkJiraRule):
logging.info(
f"Found https://issues.apache.org/jira/browse/{key}. It is marked stale now."
)
+ formatted_comment = self.warning_comment.format(
+ stale_days=self.stale_days,
+ warning_days=self.warning_days,
+ warning_label=self.warning_label,
+ )
+
+ self.add_label(issue, self.warning_label)
+ self.add_comment(key, formatted_comment)
else:
- logging.debug(
+ logging.info(
f"Found https://issues.apache.org/jira/browse/{key}, but is has recently updated Subtasks. Ignoring for now."
)
+def is_dry_run():
+ opts = [opt for opt in sys.argv[1:] if opt.startswith("-")]
+ return "-d" in opts
+
+
+def get_args():
+ parser = ArgumentParser(description="Apache Flink Jira Bot")
+ parser.add_argument(
+ "-d",
+ "--dry-run",
+ dest="dryrun",
+ action="store_true",
+ help="no action on Jira, only logging",
+ )
+ parser.add_argument(
+ "-c",
+ "--config",
+ type=Path,
+ default=Path("config.yaml"),
+ help="path to config file (default: config.yaml)",
+ )
+ return parser.parse_args()
+
+
if __name__ == "__main__":
logging.getLogger().setLevel(logging.INFO)
+ args = get_args()
+
config = confuse.Configuration("flink-jira-bot", __name__)
- config.set_file("config.yaml")
+ config.set_file(args.config)
jira = Jira(
url="https://issues.apache.org/jira",
@@ -86,5 +170,5 @@ if __name__ == "__main__":
password=os.environ["JIRA_PASSWORD"],
)
- rule_3 = Rule3(jira, config)
+ rule_3 = Rule3(jira, config, args.dryrun)
rule_3.run()
diff --git a/requirements.txt b/requirements.txt
index c5e1dd1..336352b 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,6 +1,6 @@
appdirs==1.4.4
atlassian-python-api==3.8.0
-black @ git+git://github.com/psf/black@e114ef5514e95cb9908b38c2397978f2070c1b0e
+black==20.8b1
certifi==2020.12.5
chardet==4.0.0
click==7.1.2
@@ -17,5 +17,7 @@ requests==2.25.1
requests-oauthlib==1.3.0
six==1.15.0
toml==0.10.2
+typed-ast==1.4.3
+typing-extensions==3.7.4.3
urllib3==1.26.4
wrapt==1.12.1
[flink-jira-bot] 05/09: [FLINK-22032] add Rule 3 (logging only)
Posted by kn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git
commit 6f4e13c295cd09789d509db49496956751e7d9cd
Author: Konstantin Knauf <kn...@gmail.com>
AuthorDate: Fri Apr 9 13:42:42 2021 +0200
[FLINK-22032] add Rule 3 (logging only)
---
Makefile | 2 +-
README.md | 0
config.yaml | 6 ++++
flink_jira_bot.py | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 97 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 40ca9f7..677c9cc 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,7 @@ $(VENV)/bin/activate: requirements.txt
venv: $(VENV)/bin/activate
run: venv
- ./$(VENV)/bin/python3 flink_jira_bot/flink_jira_bot.py
+ ./$(VENV)/bin/python3 flink_jira_bot.py
format: venv
./$(VENV)/bin/python3 -m black .
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..e69de29
diff --git a/config.yaml b/config.yaml
new file mode 100644
index 0000000..d77f815
--- /dev/null
+++ b/config.yaml
@@ -0,0 +1,6 @@
+stale_minor:
+ stale_days: 180
+ warning_days: 7
+ label: "stale-minor"
+ comment: 'This issue (and any of its Sub-Tasks) has not been updated for {stale_days} days. So, it has been labeled "{label}". If you are still affected by this bug or are still interested in this issue, please give an update and remove the label. In {warning_days} days the issue will be closed automatically.'
+
diff --git a/flink_jira_bot.py b/flink_jira_bot.py
new file mode 100644
index 0000000..a092399
--- /dev/null
+++ b/flink_jira_bot.py
@@ -0,0 +1,90 @@
+from atlassian import Jira
+import logging
+import confuse
+import os
+import abc
+
+
+class FlinkJiraRule:
+ __metaclass__ = abc.ABCMeta
+
+ def __init__(self, jira_client, config):
+ self.jira_client = jira_client
+ self.config = config
+
+ def has_recently_updated_subtask(self, parent, updated_within_days):
+ find_subtasks_updated_within = (
+ f"parent = {parent} AND updated > startOfDay(-{updated_within_days}d)"
+ )
+ issues = self.jira_client.jql(find_subtasks_updated_within, limit=1)
+ return issues["total"] > 0
+
+ @abc.abstractmethod
+ def run(self):
+ return
+
+
+class Rule3(FlinkJiraRule):
+ def __init__(self, jira_client, config):
+ super().__init__(jira_client, config)
+ self.stale_days = config["stale_minor"]["stale_days"].get()
+ self.warning_days = config["stale_minor"]["warning_days"].get()
+ self.label = config["stale_minor"]["label"].get()
+ self.comment = config["stale_minor"]["comment"].get()
+
+ def run(self):
+ self.close_tickets_marked_stale()
+ self.mark_stale_tickets_stale()
+
+ def close_tickets_marked_stale(self):
+
+ minor_tickets_marked_stale = f'project=FLINK AND Priority = Minor AND resolution = Unresolved AND labels in ("{self.label}") AND updated < startOfDay(-{self.warning_days}d)'
+ logging.info(
+ f"Looking for minor tickets, which were previously marked as stale: {minor_tickets_marked_stale}"
+ )
+ issues = jira.jql(minor_tickets_marked_stale, limit=10000)
+
+ for issue in issues["issues"]:
+ key = issue["key"]
+ logging.info(
+ f"Found https://issues.apache.org/jira/browse/{key}. It is now closed due to inactivity."
+ )
+
+ def mark_stale_tickets_stale(self):
+
+ stale_minor_tickets = f"project = FLINK AND Priority = Minor AND resolution = Unresolved AND updated < startOfDay(-{self.stale_days}d)"
+ logging.info(
+ f"Looking for minor tickets, which are stale: {stale_minor_tickets}"
+ )
+ issues = self.jira_client.jql(stale_minor_tickets, limit=10000)
+
+ for issue in issues["issues"]:
+ key = issue["key"]
+ issue = self.jira_client.get_issue(key)
+
+ if not self.has_recently_updated_subtask(key, self.stale_days):
+ logging.info(
+ f"Found https://issues.apache.org/jira/browse/{key}. It is marked stale now."
+ )
+
+ else:
+ logging.debug(
+ f"Found https://issues.apache.org/jira/browse/{key}, but is has recently updated Subtasks. Ignoring for now."
+ )
+
+
+if __name__ == "__main__":
+
+ logging.getLogger().setLevel(logging.INFO)
+
+ config = confuse.Configuration("flink-jira-bot", __name__)
+ config.set_file("config.yaml")
+
+ jira = Jira(
+ url="https://issues.apache.org/jira",
+ username="flink-jira-bot",
+ password=os.environ["JIRA_PASSWORD"],
+ )
+
+ rule_3 = Rule3(jira, config)
+ rule_3.run()
[flink-jira-bot] 04/09: [FLINK-22032] add confuse for YAML
configuration parsing
Posted by kn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git
commit c343d837f21aec32cf9696be3db1308c8de70c88
Author: Konstantin Knauf <kn...@gmail.com>
AuthorDate: Fri Apr 9 11:34:48 2021 +0200
[FLINK-22032] add confuse for YAML configuration parsing
---
requirements.txt | 2 ++
1 file changed, 2 insertions(+)
diff --git a/requirements.txt b/requirements.txt
index d058698..c5e1dd1 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -4,12 +4,14 @@ black @ git+git://github.com/psf/black@e114ef5514e95cb9908b38c2397978f2070c1b0e
certifi==2020.12.5
chardet==4.0.0
click==7.1.2
+confuse==1.4.0
Deprecated==1.2.12
idna==2.10
mypy-extensions==0.4.3
oauthlib==3.1.0
pathspec==0.8.1
pycparser==2.20
+PyYAML==5.4.1
regex==2021.4.4
requests==2.25.1
requests-oauthlib==1.3.0
[flink-jira-bot] 01/09: Initial commit with the ASL
Posted by kn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git
commit 647197b3f5c1ab663fd81db383d39fc537553437
Author: Robert Metzger <rm...@apache.org>
AuthorDate: Wed Apr 7 20:40:13 2021 +0200
Initial commit with the ASL
---
LICENSE | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 201 insertions(+)
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
[flink-jira-bot] 08/09: [FLINK-22023] add license headers
Posted by kn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git
commit 3cfda47472ddf6c4efe449b333637a0e578c7593
Author: Konstantin Knauf <kn...@gmail.com>
AuthorDate: Fri Apr 9 14:34:48 2021 +0200
[FLINK-22023] add license headers
---
.gitignore | 18 ++++++++++++++++++
Makefile | 19 +++++++++++++++++++
config.yaml | 18 ++++++++++++++++++
flink_jira_bot.py | 18 ++++++++++++++++++
requirements.txt | 18 ++++++++++++++++++
5 files changed, 91 insertions(+)
diff --git a/.gitignore b/.gitignore
index 5ceb386..4b8ee1e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,19 @@
+################################################################################
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+
venv
diff --git a/Makefile b/Makefile
index adfff3d..7e2cc73 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,22 @@
+################################################################################
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+
+
# define the name of the virtual environment directory
VENV := venv
diff --git a/config.yaml b/config.yaml
index 727da38..1afae72 100644
--- a/config.yaml
+++ b/config.yaml
@@ -1,3 +1,21 @@
+################################################################################
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+
stale_minor:
stale_days: 180
warning_days: 7
diff --git a/flink_jira_bot.py b/flink_jira_bot.py
index 05541ca..72f13fe 100644
--- a/flink_jira_bot.py
+++ b/flink_jira_bot.py
@@ -1,3 +1,21 @@
+################################################################################
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+
from atlassian import Jira
import logging
import confuse
diff --git a/requirements.txt b/requirements.txt
index 336352b..4f3ae54 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,21 @@
+################################################################################
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+
appdirs==1.4.4
atlassian-python-api==3.8.0
black==20.8b1
[flink-jira-bot] 02/09: [FLINK-22032] add Makefile and
requirements.txt
Posted by kn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git
commit f5aa96e9fddf0607471fc587147db6e7037a198c
Author: Konstantin Knauf <kn...@gmail.com>
AuthorDate: Fri Apr 9 11:30:03 2021 +0200
[FLINK-22032] add Makefile and requirements.txt
---
.gitignore | 1 +
Makefile | 26 ++++++++++++++++++++++++++
requirements.txt | 19 +++++++++++++++++++
3 files changed, 46 insertions(+)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..5ceb386
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+venv
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..a9c933b
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,26 @@
+# define the name of the virtual environment directory
+VENV := venv
+
+# default target, when make executed without arguments
+all: venv
+
+$(VENV)/bin/activate: requirements.txt
+ python3 -m venv $(VENV)
+ ./$(VENV)/bin/pip install -r requirements.txt
+
+# venv is a shortcut target
+venv: $(VENV)/bin/activate
+
+run: venv
+ ./$(VENV)/bin/python3 flink_jira_bot/flink_jira_bot.py
+
+format: venv
+ ./$(VENV)/bin/python3 -m black .
+
+clean:
+ rm -rf $(VENV)
+ find . -type f -name '*.pyc' -delete
+
+
+
+.PHONY: all venv run clean
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..d058698
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,19 @@
+appdirs==1.4.4
+atlassian-python-api==3.8.0
+black @ git+git://github.com/psf/black@e114ef5514e95cb9908b38c2397978f2070c1b0e
+certifi==2020.12.5
+chardet==4.0.0
+click==7.1.2
+Deprecated==1.2.12
+idna==2.10
+mypy-extensions==0.4.3
+oauthlib==3.1.0
+pathspec==0.8.1
+pycparser==2.20
+regex==2021.4.4
+requests==2.25.1
+requests-oauthlib==1.3.0
+six==1.15.0
+toml==0.10.2
+urllib3==1.26.4
+wrapt==1.12.1
[flink-jira-bot] 07/09: [FLINK-22032] add minimal README
Posted by kn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git
commit 1709d0456fc50530f3b84dd7d2c4a29193b0aaec
Author: Konstantin Knauf <kn...@gmail.com>
AuthorDate: Fri Apr 9 14:23:23 2021 +0200
[FLINK-22032] add minimal README
---
README.md | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/README.md b/README.md
index e69de29..befa400 100644
--- a/README.md
+++ b/README.md
@@ -0,0 +1,55 @@
+# Apache Flink Jira Bot
+
+The Flink Jira enforces some of the rules outlined in [the Apache Flink Confluence](https://cwiki.apache.org/confluence/display/FLINK/Flink+Jira+Process).
+
+## Usage
+
+```
+./venv/bin/python3 flink_jira_bot.py --help
+usage: flink_jira_bot.py [-h] [-d] [-c CONFIG]
+
+Apache Flink Jira Bot
+
+optional arguments:
+ -h, --help show this help message and exit
+ -d, --dry-run no action on Jira, only logging
+ -c CONFIG, --config CONFIG
+ path to config file (default: config.yaml)
+```
+
+There are also `make` targets for the important actions:
+
+### Run
+```
+make run
+```
+
+### Dry-Run
+
+The dry-run does not make any changes to the Apache Flink Jira, but instead only logs the actions it would do.
+
+```
+make dry-run
+```
+
+### Configuration
+
+Both `make run` and `make dry-run` look for the password of `flink-jira-bot` in an environment variable called `JIRA_PASSWORD`.
+
+The configuration of the rules can be found in [config.yaml](config.yaml).
+
+## About the Rules
+
+### Rule 1 (not implemented yet)
+
+### Rule 2 (not implemented yet)
+
+### Rule 3
+
+An unresolved Minor ticket without an update for {stale.minor.stale_days} is closed after a warning period of {stale.minor.warning_days} with a comment that encourages users to watch, comment and simply reopen with a higher priority if the problem insists.
+
+## About Apache Flink
+
+Apache Flink is an open source project of The Apache Software Foundation (ASF).
+
+Flink is distributed data processing framework with powerful stream and batch processing capabilities. Learn more about Flink at http://flink.apache.org/
\ No newline at end of file
[flink-jira-bot] 09/09: Merge pull request #1 from
knaufk/FLINK-22032
Posted by kn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git
commit ad9bbe7575797603b95e63ccfecfa13f4d68dac0
Merge: 647197b 3cfda47
Author: Konstantin Knauf <me...@konstantin-knauf.de>
AuthorDate: Mon Apr 12 18:02:41 2021 +0200
Merge pull request #1 from knaufk/FLINK-22032
[Flink-22032] Adding Bot with Initial Rule
.gitignore | 19 ++++++
Makefile | 54 +++++++++++++++
README.md | 55 ++++++++++++++++
config.yaml | 26 ++++++++
flink_jira_bot.py | 192 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
requirements.txt | 41 ++++++++++++
6 files changed, 387 insertions(+)