Skip to content

Commit 95078ed

Browse files
committed
Merge pull request #41 from totem/develop
0.3.7 Release
2 parents 8be1033 + a090fba commit 95078ed

File tree

9 files changed

+22
-21
lines changed

9 files changed

+22
-21
lines changed

conf/appconfig.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@
219219
HOOK_TYPE_CI = 'ci'
220220
HOOK_TYPE_BUILDER = 'builder'
221221
HOOK_TYPE_SCM_PUSH = 'scm-push'
222+
HOOK_TYPE_SCM_CREATE = 'scm-create'
222223

223224
# Store Settings
224225
DEFAULT_STORE_NAME = 'mongo'

dev-requirements.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ Sphinx==1.2.3
77
freezegun==0.2.8
88

99
# Code Coverage
10-
coveralls
10+
coveralls
11+
12+
flower==0.7.2

orchestrator/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from celery.signals import setup_logging
33
import orchestrator.logger
44

5-
__version__ = '0.3.6'
5+
__version__ = '0.3.7'
66
__author__ = 'sukrit'
77

88
orchestrator.logger.init_logging()

orchestrator/services/job.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,7 @@ def create_job(job_config, owner, repo, ref, commit=None, force_deploy=False,
168168
state_in=[JOB_STATE_NEW, JOB_STATE_SCHEDULED])
169169
if existing_jobs:
170170
job = existing_jobs[0]
171-
if not commit:
172-
job = reset_hook_status(job)
173-
job['config'] = job_config
174-
elif commit not in job['meta-info']['git']['commit-set']:
171+
if commit and commit not in job['meta-info']['git']['commit-set']:
175172
job['meta-info']['git']['commit-set'].append(commit)
176173
job['meta-info']['git']['commit'] = commit
177174
job = reset_hook_status(job)

orchestrator/tasks/job.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -349,15 +349,13 @@ def _handle_hook(job, hook_type, hook_name, hook_status, hook_result,
349349
git_meta['ref'], False)
350350
store.add_event(EVENT_SETUP_APPLICATION_COMPLETE,
351351
search_params=search_params)
352-
# Even though we unfreeze the application, we will consider this
353-
# job to be noop as no deployment will be created.
354-
noop = True
352+
frozen = False
355353
else:
356-
noop = job_service.is_frozen(git_meta['owner'], git_meta['repo'],
357-
git_meta['ref'])
354+
frozen = job_service.is_frozen(git_meta['owner'], git_meta['repo'],
355+
git_meta['ref'])
358356

359357
if not job_config['enabled'] or not builder_hooks or \
360-
not job_config['deployers'] or noop:
358+
not job_config['deployers'] or frozen:
361359
return _handle_noop(job)
362360

363361
job = prepare_job(job, hook_type, hook_name, hook_status, hook_result,

orchestrator/views/hooks.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,19 @@ def post(self, request_data=None, **kwargs):
171171
not request_data.get('deleted'):
172172
ref = basename(request_data['ref'])
173173
commit = request_data['after']
174-
task = handle_callback_hook.delay(
175-
owner, repo, ref, 'scm-push', 'github-push', commit=commit)
174+
# Delay processing of github push event ( eventual consistency)
175+
task = handle_callback_hook.apply_async(
176+
(owner, repo, ref, 'scm-push', 'github-push'),
177+
kwargs={'commit': commit}, countdown=10)
176178
return created_task(task)
177179
elif request.headers.get('X-GitHub-Event') == 'create' and \
178180
request_data.get('ref_type') == 'branch' and \
179181
request_data.get('ref'):
180182
ref = basename(request_data['ref'])
181-
task = handle_callback_hook.delay(
182-
owner, repo, ref, 'scm-create', 'github-create')
183+
# Delay processing of github create event ( eventual consistency)
184+
task = handle_callback_hook.apply_async(
185+
(owner, repo, ref, 'scm-create', 'github-create'),
186+
countdown=10)
183187
return created_task(task)
184188
else:
185189
# Ignore all other hooks

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ future==0.15.0
77
PyYAML==3.11
88
boto==2.34.0
99
pymongo==3.0.3
10-
flower==0.7.2
1110
Jinja2==2.7.3
1211
requests[security]==2.7.0
1312
urllib3==1.11

tests/unit/orchestrator/services/test_job.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def test_create_job_when_exists_with_no_commit_info(m_get_store):
307307
'hooks': {
308308
'ci': {
309309
'ci1': {
310-
'status': HOOK_STATUS_PENDING
310+
'status': HOOK_STATUS_SUCCESS
311311
}
312312
},
313313
'builder': {

tests/unit/orchestrator/views/test_hooks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,9 @@ def test_post_for_create_branch_event(self, m_handle_callback_hook):
223223

224224
# Then: Expected response is returned
225225
eq_(resp.status_code, 202)
226-
m_handle_callback_hook.delay.assert_called_once_with(
227-
u'mock_owner', u'mock_repo', u'develop', u'scm-create',
228-
u'github-create')
226+
m_handle_callback_hook.apply_async.assert_called_once_with(
227+
(u'mock_owner', u'mock_repo', u'develop', u'scm-create',
228+
u'github-create'), countdown=10)
229229

230230
@patch('orchestrator.views.hooks.handle_callback_hook')
231231
def test_post_for_create_non_branch_event(self, m_handle_callback_hook):

0 commit comments

Comments
 (0)