Bläddra i källkod

Merge branch 'master' of https://github.com/meolu/walle-web

Alenx 6 år sedan
förälder
incheckning
f65975e038
2 ändrade filer med 4 tillägg och 19 borttagningar
  1. 2 0
      admin.sh
  2. 2 19
      walle/service/deployer.py

+ 2 - 0
admin.sh

@@ -19,6 +19,8 @@ function init() {
     if [ ! -d "venv" ]; then
         virtualenv --no-site-packages venv # 注意:安装失败请指定python路径. mac 可能会有用anaconda的python. 请不要mac试用, 麻烦多多
     fi
+    echo "安装/更新可能缺少的依赖: mysql-community-devel gcc gcc-c++ python-devel"
+    sudo yum install -y mysql-community-devel gcc gcc-c++ python-devel
     source ./venv/bin/activate
     pip install -r ./requirements/prod.txt
     if [ $? != "0"  ]; then

+ 2 - 19
walle/service/deployer.py

@@ -142,22 +142,6 @@ class Deployer:
         self.stage = self.stage_deploy
         self.sequence = 2
 
-        current_app.logger.info('git dir: %s', self.dir_codebase_project + '/.git')
-        # 如果项目底下有 .git 目录则认为项目完整,可以直接检出代码
-        # TODO 不标准
-        if os.path.exists(self.dir_codebase_project + '/.git'):
-            with self.localhost.cd(self.dir_codebase_project):
-                command = 'pwd && git pull'
-                result = self.localhost.local(command, wenv=self.config())
-
-        else:
-            # 否则当作新项目检出完整代码
-            with self.localhost.cd(self.dir_codebase_project):
-                command = 'pwd && git clone %s .' % (self.project_info['repo_url'])
-                current_app.logger.info('cd %s  command: %s  ', self.dir_codebase_project, command)
-
-                result = self.localhost.local(command, wenv=self.config())
-
         # copy to a local version
         self.release_version = '%s_%s_%s' % (
             self.project_name, self.task_id, time.strftime('%Y%m%d_%H%M%S', time.localtime(time.time())))
@@ -235,8 +219,7 @@ class Deployer:
 
         # TODO md5
         # 传送到版本库 release
-        current_app.logger.info('/tmp/walle/codebase/' + self.release_version_tar)
-        result = waller.put('/tmp/walle/codebase/' + self.release_version_tar,
+        result = waller.put(self.local_codebase + self.release_version_tar,
                             remote=self.project_info['target_releases'], wenv=self.config())
         current_app.logger.info('command: %s', dir(result))
 
@@ -432,7 +415,7 @@ class Deployer:
             self.localhost.local(command, wenv=self.config())
 
         with self.localhost.cd(self.dir_codebase_project):
-            is_git_dir = self.localhost.local('git status', exception=False, wenv=self.config())
+            is_git_dir = self.localhost.local('[ -d ".git" ] && git status', exception=False, wenv=self.config())
 
         if is_git_dir.exited != Code.Ok:
             # 否则当作新项目检出完整代码