Do not execute hook mercurial repository on version 0.3.3

Issue #289 new
maxvinokuroff
created an issue

Text hgrc

[hooks]
changegroup = /srv/kallithea/repos/puppet/maxhope/.hg/sync_maxhope_to_pm1.sh

Text sync_maxhope_to_pm1.sh

#!/bin/sh

server_git="repo:5000"
server1="pm1"
#server2="pm2"
server_dir1="/etc/puppet/environments/production"
server_dir2="/etc/puppet/environments/testing"
server_user="root"
group_repo="puppet"
repo="maxhope"
BRANCH=$(hg log --template '{branch}' -r $HG_NODE)
#BRANCH=testing

case "$BRANCH" in 
        "production")
        /usr/bin/ssh $server_user@$server1 "cd $server_dir1; /usr/bin/hg pull -u -f -b $BRANCH http://$server_git/$group_repo/$repo"
    ;;

        "testing")
        /usr/bin/ssh $server_user@$server1 "cd $server_dir2; /usr/bin/hg pull -u -f -b $BRANCH http://$server_git/$group_repo/$repo"
    ;;
esac

This hook executed on version 0.3.2 very well, but not execute on version 0.3.3.

Comments (11)

  1. maxvinokuroff reporter
    repo ~ # uname -a
    Linux repo.hid.maxhope.in.ua 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2+deb8u1 (2017-06-18) x86_64 GNU/Linux
    repo ~ # dpkg -l | grep mercurial
    ii  mercurial                  3.1.2-2+deb8u3                   amd64        easy-to-use, scalable distributed version control system
    ii  mercurial-common           3.1.2-2+deb8u3                   all          easy-to-use, scalable distributed version control system (common files)
    

    I use Debian 8 old-stable, version mercurial from main repository. All time since 2015 made two security update. Link Text I think version mercurial in this case don't make sense.

  2. domruf

    I now tried to reproduce the problem on windows and on ubuntu 17.04. But on both systems changegroup and prechangegroup hooks got executed when configured in hgrc file. So I'm afraid I need more information.

    How did you install and run Kallithea?

    Did you use virtualenv?

    Did you upgrade from an old Kallithea version or was this a new installation?

    Are there any other differences between the 0.3.3 and the 0.3.2 installation?

    Can you try it with the following, very simple hook?

    [hooks]
    prechangegroup = (>&2 echo "my message") && /bin/false
    
  3. maxvinokuroff reporter

    I install Kallithea use puppet module

      "name": "rauch-kallithea",
      "version": "0.3.0",
      "author": "Robert Rauch (GNS Systems)",
      "summary": "Manage Kallithea, a free source code management system",
      "license": "Apache-2.0",
      "source": "https://github.com/rauchrob/puppet-kallithea",
    

    That module create virtualenv in home directory user kallithea path /srv/kallithea. Create site.pp next parameters:

    class { 'kallithea':
      version     => '0.3.2',
      admin_mail  => 'kallithea@exempla.org',
      admin_pass  => 'admin_passwd',
      manage_git  => true,
      seed_db     => true,
      config_hash => {
        'DEFAULT'     => {
          'debug'          => false,
          'app_email_from' => 'Kallithea <kallithea@exempla.org>',
          'smtp_server'    => 'smtp.exempla.org',
          'smtp_username'  => 'kallithea@exempla.org',
          'smtp_password'  => 'passwd_smtp',
          'smtp_port'      => '25',
          'smtp_auth'      => 'PLAIN',
        },
        'server:main' => {
          'host' => '172.16.30.3',
          'port' => '5000',
        },
        'app:main'    => {
          'force_https'        => true,
          'use_htsts'          => true,
          #'lang'               => 'ru',
          'sqlalchemy.db1.url' => 'postgresql://user_db:passw_db@ip_db/name_db',
        },
      }
    }
    

    With this module you can exactly replicate my environment. Install the puppet. Create directory 'modules' copy the module in that directory and run about this command

    puppet apply site.pp --modulepath=./modules
    
  4. domruf

    I still can't reproduce your problem.

    I did the following on my ubuntu system:

    1. puppet module install rauch/kallithea
    2. create kallithea.pp like above but I used a sqlite database, used version 0.3.3 and host 0.0.0.0
    3. sudo puppet apply kallithea.pp --modulepath=./.puppet/etc/code/modules/ There were some warnings and an error but I continued
    4. cd /srv/kallithea/
    5. . venv/bin/activate
    6. since I have no ssl I changed force_https = false in kallithea.ini
    7. paster serve kallithea.ini
    8. create a repository
    9. create /srv/kallithea/repos/myrepo/.hg/hgrc with
    [hooks]
    prechangegroup = (>&2 echo "my message") && /bin/false
    

    Now when trying to push something to the repository it correctly fails because of the hook.

  5. maxvinokuroff reporter

    How did you install and run Kallithea? I install in clean new lxc container with Puppet deployment instruments.

    Did you use virtualenv? Yes, this module create virtualenv.

    Did you upgrade from an old Kallithea version or was this a new installation? No, I install new instance.

    Are there any other differences between the 0.3.3 and the 0.3.2 installation? I will install two node, and make diff.

  6. Log in to comment