Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion press/press/doctype/bench_update/bench_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,15 @@ def deploy(
run_will_fail_check=False,
validate_pre_candidate_checks: bool = True,
create_build: bool = True,
ignore_permissions_check: bool = False,
) -> str:
"""Creates and returns candidate name or build name depending on the point of invocation."""
rg: ReleaseGroup = frappe.get_doc("Release Group", self.group)
candidate = rg.create_deploy_candidate(
apps_to_update=self.apps,
run_will_fail_check=run_will_fail_check,
validate_pre_candidate_checks=validate_pre_candidate_checks,
ignore_permissions_check=ignore_permissions_check,
)

self.candidate = candidate.name
Expand All @@ -110,7 +112,7 @@ def deploy(
# In case we are not scheduling build from here (eg. new build flow) return candidate name here
return candidate.name

deploy = candidate.schedule_build_and_deploy()
deploy = candidate.schedule_build_and_deploy(ignore_permissions_check=ignore_permissions_check)

return deploy["name"]

Expand Down
3 changes: 2 additions & 1 deletion press/press/doctype/deploy_candidate/deploy_candidate.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ def schedule_build_and_deploy(
run_now: bool = True,
scheduled_time: datetime | None = None,
retry_count: int = 0,
ignore_permissions_check: bool = False,
):
if run_now and not is_suspended():
return {"error": False, "name": self.build_and_deploy()}
Comment thread
Aradhya-Tripathi marked this conversation as resolved.
Outdated
Expand All @@ -253,7 +254,7 @@ def schedule_build_and_deploy(
scheduled_time=scheduled_time or now(),
retry_count=retry_count,
)
deploy_candidate_build.insert()
deploy_candidate_build.insert(ignore_permissions=ignore_permissions_check)
return {"error": False, "name": deploy_candidate_build.name}

def build_and_deploy(self, no_cache: bool = False) -> str:
Expand Down
8 changes: 6 additions & 2 deletions press/press/doctype/release_group/release_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,11 @@ def check_auto_scales(self) -> None:

@frappe.whitelist()
def create_deploy_candidate(
self, apps_to_update=None, run_will_fail_check=False, validate_pre_candidate_checks: bool = True
self,
apps_to_update=None,
run_will_fail_check=False,
validate_pre_candidate_checks: bool = True,
ignore_permissions_check: bool = False,
) -> "DeployCandidate | None":
if not self.enabled:
return None
Expand Down Expand Up @@ -782,7 +786,7 @@ def create_deploy_candidate(

check_if_update_will_fail(self, new_dc)

new_dc.insert()
new_dc.insert(ignore_permissions=ignore_permissions_check)
return new_dc

def validate_dc_apps_against_rg(self, dc_apps) -> None:
Expand Down
1 change: 1 addition & 0 deletions press/press/doctype/release_pipeline/release_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ def create_deploy_candidate(
run_will_fail_check=run_will_fail_check,
validate_pre_candidate_checks=False,
create_build=create_deploy,
ignore_permissions_check=True,
)

@task(queue=_get_task_execution_queue())
Expand Down
8 changes: 4 additions & 4 deletions press/press/doctype/release_pipeline/test_release_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def tearDown(self):
@classmethod
def setUpClass(cls):
super().setUpClass()
server = create_test_server(use_for_build=True)
cls.server = create_test_server(use_for_build=True)
cls.test_frappe_app = create_test_app("frappe")
cls.test_erpnext_app = create_test_app("erpnext", "Erpnext App")
cls.test_frappe_release = create_test_app_release(
Expand All @@ -112,15 +112,15 @@ def setUpClass(cls):
cls.test_release_group = create_test_release_group(
apps=[cls.test_frappe_app, cls.test_erpnext_app],
frappe_version="Version 15",
servers=[server.name],
servers=[cls.server.name],
)
frappe.db.set_single_value("Press Settings", "build_directory", "/tmp/test-build-dir/")
frappe.db.set_single_value("Press Settings", "clone_directory", "/tmp/test-clone-dir/")
frappe.db.set_single_value("Press Settings", "use_new_deploy_flow", 1)

def create_deploy_and_update(self):
def create_deploy_and_update(self, release_group_name=None):
deploy_and_update(
self.test_release_group.name,
release_group_name or self.test_release_group.name,
apps=[
{
"app": "frappe",
Expand Down
Loading