Skip to content

Allow setting http proxy in Windows updater #6332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 11 additions & 3 deletions .ci/update_windows/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import shutil
import filecmp

def pull(repo, remote_name='origin', branch='master'):
def pull(repo, remote_name='origin', branch='master', proxy=None):
for remote in repo.remotes:
if remote.name == remote_name:
remote.fetch()
remote.fetch(proxy=proxy)
remote_master_id = repo.lookup_reference('refs/remotes/origin/%s' % (branch)).target
merge_result, _ = repo.merge_analysis(remote_master_id)
# Up to date, do nothing
Expand Down Expand Up @@ -46,6 +46,14 @@ def pull(repo, remote_name='origin', branch='master'):

pygit2.option(pygit2.GIT_OPT_SET_OWNER_VALIDATION, 0)
repo_path = str(sys.argv[1])
proxy = None
if '--proxy' in sys.argv:
proxy_index = sys.argv.index('--proxy')
if proxy_index + 1 < len(sys.argv):
proxy = sys.argv[proxy_index + 1]
if len(proxy)<=0:
proxy = None

repo = pygit2.Repository(repo_path)
ident = pygit2.Signature('comfyui', 'comfy@ui')
try:
Expand Down Expand Up @@ -73,7 +81,7 @@ def pull(repo, remote_name='origin', branch='master'):
repo.checkout(ref)

print("pulling latest changes") # noqa: T201
pull(repo)
pull(repo, proxy=proxy)

if "--stable" in sys.argv:
def latest_tag(repo):
Expand Down
6 changes: 4 additions & 2 deletions .ci/update_windows/update_comfyui.bat
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
@echo off
..\python_embeded\python.exe .\update.py ..\ComfyUI\
:: Set the http proxy here like `set proxy="http://127.0.0.1:888/"`. No spacebar allowed.
set proxy=""
..\python_embeded\python.exe .\update.py ..\ComfyUI\ --proxy %proxy%
if exist update_new.py (
move /y update_new.py update.py
echo Running updater again since it got updated.
..\python_embeded\python.exe .\update.py ..\ComfyUI\ --skip_self_update
..\python_embeded\python.exe .\update.py ..\ComfyUI\ --skip_self_update --proxy %proxy%
)
if "%~1"=="" pause
6 changes: 4 additions & 2 deletions .ci/update_windows/update_comfyui_stable.bat
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
@echo off
..\python_embeded\python.exe .\update.py ..\ComfyUI\ --stable
:: Set the http proxy here like `set proxy="http://127.0.0.1:888/"`. No spacebar allowed.
set proxy=""
..\python_embeded\python.exe .\update.py ..\ComfyUI\ --proxy %proxy% --stable
if exist update_new.py (
move /y update_new.py update.py
echo Running updater again since it got updated.
..\python_embeded\python.exe .\update.py ..\ComfyUI\ --skip_self_update --stable
..\python_embeded\python.exe .\update.py ..\ComfyUI\ --skip_self_update --proxy %proxy% --stable
)
if "%~1"=="" pause