Commit e2da32cf authored by Grant's avatar Grant
Browse files

fetcher: allow tracking issue to be created and queried even in dry run

parent a4526fc5
Loading
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -148,9 +148,7 @@ def _build_tracking_body(rows_dict):
		return "".join(lines)

	def _ensure_tracking_issue(self):
		"""Find or create the tracking issue. Returns iid, or -1 on dry_run."""
		if self.dry_run:
			return -1
		"""Find or create the tracking issue. Returns iid"""
		return self.forge.find_or_create_tracking_issue()

	def is_post_failed(self, post_id, body):
+0 −14
Original line number Diff line number Diff line
@@ -50,10 +50,6 @@ def set_mr_description(self, branch_name, description):
		if mr is None:
			raise Exception("No MR found for branch {}".format(branch_name))

		if self.dry_run:
			print("DRY RUN: would update MR {} description".format(mr["web_url"]))
			return

		url = "https://{}/api/v4/projects/{}/merge_requests/{}".format(
			self.domain, self.project_id, mr["iid"]
		)
@@ -83,9 +79,6 @@ def find_or_create_tracking_issue(self):
			"| Post | URL | Comment | Error |\n"
			"|------|-----|---------|-------|\n"
		)
		if self.dry_run:
			print("DRY RUN: would create tracking issue '{}'".format(self.TRACKING_ISSUE_TITLE))
			return -1

		url = "https://{}/api/v4/projects/{}/issues".format(self.domain, self.project_id)
		req = requests.post(url, json={
@@ -99,8 +92,6 @@ def find_or_create_tracking_issue(self):

	def get_issue_description(self, iid):
		"""Get the description (body) of an issue."""
		if self.dry_run and iid == -1:
			return ""
		url = "https://{}/api/v4/projects/{}/issues/{}".format(
			self.domain, self.project_id, iid
		)
@@ -110,9 +101,6 @@ def get_issue_description(self, iid):

	def set_issue_description(self, iid, description):
		"""Update the description (body) of an issue."""
		if self.dry_run:
			print("DRY RUN: would update tracking issue #{} description".format(iid))
			return
		url = "https://{}/api/v4/projects/{}/issues/{}".format(
			self.domain, self.project_id, iid
		)
@@ -123,8 +111,6 @@ def set_issue_description(self, iid, description):

	def reopen_issue(self, iid):
		"""Ensure the tracking issue is open (not closed)."""
		if self.dry_run:
			return
		url = "https://{}/api/v4/projects/{}/issues/{}".format(
			self.domain, self.project_id, iid
		)