Skip to content

Commit

Permalink
Add commit id in json info file
Browse files Browse the repository at this point in the history
  • Loading branch information
t0mab committed Jun 5, 2020
1 parent 2e9668f commit e950b5c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions pydiploy/require/releases_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@

import fabric
import fabtools
from fabric.api import env, hide, warn_only

import pydiploy
from fabric.api import env, warn_only
from pydiploy.decorators import do_verbose


Expand Down Expand Up @@ -116,6 +117,12 @@ def deploy_code():
# remove existing extracted dir from tarball
if os.path.exists('%s/%s' % (env.local_tmp_dir, archive_prefix)):
fabric.api.local('rm -rf %s' % archive_prefix)
# use tarball to get commit id
with warn_only():
env.commit_id = fabric.api.local(
'zcat %s | git get-tar-commit-id' % os.path.basename(tarball),
capture=True,
)
fabric.api.local('tar xvf %s' % os.path.basename(tarball))
# add deployed.json file
with open(
Expand All @@ -124,12 +131,13 @@ def deploy_code():
data = {}
data['info'] = [
{
'tag': env.tag,
'app_host': env.host_string,
'repo_url': env.remote_repo_url,
'python_version': env.remote_python_version,
'local_user': env.local_user,
'app_host': env.host_string,
'socket_port': env.socket_port,
'repo_url': env.remote_repo_url,
'tag': env.tag,
'commit_id': env.commit_id,
}
]

Expand Down

0 comments on commit e950b5c

Please sign in to comment.