Skip to content

Commit

Permalink
Specify branch when updating from repository
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarno Luoma-Nirva committed May 12, 2024
1 parent b56a17a commit 5ae253a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ def deploy(context, user, host):
virtualenv = os.path.join(site_folder, "virtualenv")
python = virtualenv + "/bin/python"
pip = virtualenv + "/bin/pip"
connection = Connection(host=host, user=user)
aws_key_file_path = os.environ.get("AWS_KEY_FILE_PATH", '')
if aws_key_file_path:
connection = Connection(host=host, user=user, connect_kwargs={'key_filename': aws_key_file_path})
else:
connection = Connection(host=host, user=user)
_create_directory_structure_if_necessary(connection, site_folder)
_init_virtualenv(connection, site_folder)
_get_latest_source(connection, source_folder)
Expand Down Expand Up @@ -53,7 +57,7 @@ def _get_latest_source(c, source_folder):
# Note: This may fail until cloned once manually
c.run("cd {} && git config pull.rebase false".format(source_folder))
else:
c.run("cd {} && git pull".format(source_folder))
c.run("cd {} && git pull origin main".format(source_folder))


def _install_virtualenv_libraries(c, source_folder, pip):
Expand Down

0 comments on commit 5ae253a

Please sign in to comment.