clone_gitproject(project, \
'%s.git' % os.path.join(gerrit_env.gitcache, project), \
gerrit_hostname=gerrit_env.hostname, \
- gerrit_username=gerrit_env.username, \
+ gerrit_username=os.getenv('ABS_GERRIT_USERNAME'), \
gerrit_sshport=gerrit_env.sshport, \
bare=True)
print 'Cloning clone %s' % src_root
if not clone_gitproject(project, \
src_root, \
gerrit_hostname=gerrit_env.hostname, \
- gerrit_username=gerrit_env.username, \
+ gerrit_username=os.getenv('ABS_GERRIT_USERNAME'), \
gerrit_sshport=gerrit_env.sshport):
raise LocalError('Error cloning project %s' % project)
mailer.add_message('\n\nGit push branch %s failed %s' % (new_branch, push_err_msg))
return
- if data.get('gerrit_infra', '').startswith('public_gerrit'):
- gerrit_env = GerritEnv('PUBLIC_')
- else:
- gerrit_env = GerritEnv('')
- remote = 'ssh://%s@%s:%d/%s' % (gerrit_env.username, \
+ gerrit_env = GerritEnv(data.get('gerrit_infra', ''))
+ remote = 'ssh://%s@%s:%d/%s' % (os.getenv('ABS_GERRIT_USERNAME'), \
gerrit_env.hostname, \
int(gerrit_env.sshport), \
data.get('project'))
# Adjust arguments
data = set_gerrit_event(fields)
- if fields.get('gerrit_infra').startswith('public_gerrit'):
+ print '\n"Title": "%s/%s"\n' % (os.path.basename(data.get('project')), data.get('tag'))
+
+ if fields.get('gerrit_infra').startswith('PUBLIC_'):
gerrit_env = GerritEnv('PUBLIC_')
+ data['gerrit_infra'] = 'PUBLIC_'
build = BuildService(os.getenv('PUBLIC_OBS_API_URL'), \
os.getenv('PUBLIC_OBS_API_USERNAME'), \
os.getenv('PUBLIC_OBS_API_PASSWD'))
# Regular gerrit event (Dispatcher)
elif os.getenv('GERRIT_PROJECT', None):
- gerrit_infra = ''
if os.getenv('GERRIT_NAME').startswith('public_gerrit'):
gerrit_infra = 'PUBLIC_'
+ else:
+ gerrit_infra = ''
gerrit_env = GerritEnv(gerrit_infra)
project = os.getenv('GERRIT_PROJECT')