mirror of https://github.com/axmolengine/axmol.git
Merge branch 'v3' of https://github.com/cocos2d/cocos2d-x into v3-jsb-merge
This commit is contained in:
commit
03ef9b962a
3
AUTHORS
3
AUTHORS
|
@ -1100,6 +1100,9 @@ Developers:
|
|||
|
||||
matsuokah
|
||||
Fixed the bug that JNI illegal start byte error causes crashing error on Android 5.0
|
||||
|
||||
babcca
|
||||
Fixed crashing when playing streamed MP4 file on iOS
|
||||
|
||||
Retired Core Developers:
|
||||
WenSheng Yang
|
||||
|
|
|
@ -4,6 +4,7 @@ cocos2d-x-3.6 ??
|
|||
[NEW] WP8: remove WP8 support because Angle don't support WP8 any more
|
||||
|
||||
[FIX] JNI: JNI illegal start byte error which causes crashing error on Android 5.0
|
||||
[FIX] UI:VideoPlayer: crashed when playing streamed MP4 file on iOS
|
||||
|
||||
cocos2d-x-3.6beta0 Apr.14 2015
|
||||
[NEW] 3rd: update Spine runtime to v2.1.25
|
||||
|
|
12
README.md
12
README.md
|
@ -4,10 +4,10 @@
|
|||
cocos2d-x
|
||||
=========
|
||||
|
||||
| |iOS|Mac|Linux|Win32|Android|WP8|Win8.1-Universal|
|
||||
| ----|----|----- | ---|----|---|---- |---|
|
||||
|v3|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v3/node=ios)](http://45.56.80.45:8080/job/daily-build-v3/node=ios)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v3/node=mac)](http://45.56.80.45:8080/job/daily-build-v3/node=mac)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v3/node=linux)](http://45.56.80.45:8080/job/daily-build-v3/node=linux)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v3/node=win32)](http://45.56.80.45:8080/job/daily-build-v3/node=win32)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v3/node=android)](http://45.56.80.45:8080/job/daily-build-v3/node=android)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v3/node=wp8)](http://45.56.80.45:8080/job/daily-build-v3/node=wp8)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v3/node=windows-universal)](http://45.56.80.45:8080/job/daily-build-v3/node=windows-universal)|
|
||||
|v4|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v4/node=ios)](http://45.56.80.45:8080/job/daily-build-v4/node=ios)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v4/node=mac)](http://45.56.80.45:8080/job/daily-build-v4/node=mac)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v4/node=linux)](http://45.56.80.45:8080/job/daily-build-v4/node=linux)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v4/node=win32)](http://45.56.80.45:8080/job/daily-build-v4/node=win32)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v4/node=android)](http://45.56.80.45:8080/job/daily-build-v4/node=android)|NA|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v4/node=windows-universal)](http://45.56.80.45:8080/job/daily-build-v4/node=windows-universal)|
|
||||
| |iOS|Mac|Linux|Win32|Android|Win8.1-Universal|
|
||||
| ----|----|----- | ---|----|------|---|
|
||||
|v3|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v3/node=ios)](http://45.56.80.45:8080/job/daily-build-v3/node=ios)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v3/node=mac)](http://45.56.80.45:8080/job/daily-build-v3/node=mac)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v3/node=linux)](http://45.56.80.45:8080/job/daily-build-v3/node=linux)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v3/node=win32)](http://45.56.80.45:8080/job/daily-build-v3/node=win32)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v3/node=android)](http://45.56.80.45:8080/job/daily-build-v3/node=android)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v3/node=windows-universal)](http://45.56.80.45:8080/job/daily-build-v3/node=windows-universal)|
|
||||
|v4|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v4/node=ios)](http://45.56.80.45:8080/job/daily-build-v4/node=ios)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v4/node=mac)](http://45.56.80.45:8080/job/daily-build-v4/node=mac)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v4/node=linux)](http://45.56.80.45:8080/job/daily-build-v4/node=linux)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v4/node=win32)](http://45.56.80.45:8080/job/daily-build-v4/node=win32)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v4/node=android)](http://45.56.80.45:8080/job/daily-build-v4/node=android)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v4/node=windows-universal)](http://45.56.80.45:8080/job/daily-build-v4/node=windows-universal)|
|
||||
|
||||
|
||||
|
||||
|
@ -61,7 +61,7 @@ Example:
|
|||
### Build and run a new project for iOS ###
|
||||
|
||||
$ cocos run -p ios
|
||||
|
||||
|
||||
### Build and run a new project for OSX ###
|
||||
|
||||
$ cocos run -p mac
|
||||
|
@ -78,7 +78,7 @@ Then
|
|||
|
||||
$ cd NEW_PROJECTS_DIR/MyGame
|
||||
$ cocos run -p linux
|
||||
|
||||
|
||||
Run
|
||||
|
||||
$ bin/MyGame
|
||||
|
|
|
@ -1770,12 +1770,8 @@
|
|||
50ED2BDB19BE76D500A0AB90 /* UIVideoPlayer-ios.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3EA0FB6A191C841D00B170C8 /* UIVideoPlayer-ios.mm */; };
|
||||
50ED2BE019BEAF7900A0AB90 /* UIEditBoxImpl-win32.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ED2BDC19BEAF7900A0AB90 /* UIEditBoxImpl-win32.h */; };
|
||||
50ED2BE119BEAF7900A0AB90 /* UIEditBoxImpl-win32.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ED2BDC19BEAF7900A0AB90 /* UIEditBoxImpl-win32.h */; };
|
||||
50ED2BE219BEAF7900A0AB90 /* UIEditBoxImpl-wp8.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ED2BDD19BEAF7900A0AB90 /* UIEditBoxImpl-wp8.h */; };
|
||||
50ED2BE319BEAF7900A0AB90 /* UIEditBoxImpl-wp8.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ED2BDD19BEAF7900A0AB90 /* UIEditBoxImpl-wp8.h */; };
|
||||
50ED2BE419BEAF7900A0AB90 /* UIEditBoxImpl-win32.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ED2BDE19BEAF7900A0AB90 /* UIEditBoxImpl-win32.cpp */; };
|
||||
50ED2BE519BEAF7900A0AB90 /* UIEditBoxImpl-win32.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ED2BDE19BEAF7900A0AB90 /* UIEditBoxImpl-win32.cpp */; };
|
||||
50ED2BE619BEAF7900A0AB90 /* UIEditBoxImpl-wp8.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ED2BDF19BEAF7900A0AB90 /* UIEditBoxImpl-wp8.cpp */; };
|
||||
50ED2BE719BEAF7900A0AB90 /* UIEditBoxImpl-wp8.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ED2BDF19BEAF7900A0AB90 /* UIEditBoxImpl-wp8.cpp */; };
|
||||
52B47A2E1A5349A3004E4C60 /* HttpAsynConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 52B47A291A5349A3004E4C60 /* HttpAsynConnection.h */; };
|
||||
52B47A2F1A5349A3004E4C60 /* HttpAsynConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 52B47A2A1A5349A3004E4C60 /* HttpAsynConnection.m */; };
|
||||
52B47A301A5349A3004E4C60 /* HttpClient-apple.mm in Sources */ = {isa = PBXBuildFile; fileRef = 52B47A2B1A5349A3004E4C60 /* HttpClient-apple.mm */; };
|
||||
|
@ -3545,9 +3541,7 @@
|
|||
50E6D33218E174130051CA34 /* UIVBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIVBox.cpp; sourceTree = "<group>"; };
|
||||
50E6D33318E174130051CA34 /* UIVBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIVBox.h; sourceTree = "<group>"; };
|
||||
50ED2BDC19BEAF7900A0AB90 /* UIEditBoxImpl-win32.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIEditBoxImpl-win32.h"; sourceTree = "<group>"; };
|
||||
50ED2BDD19BEAF7900A0AB90 /* UIEditBoxImpl-wp8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIEditBoxImpl-wp8.h"; sourceTree = "<group>"; };
|
||||
50ED2BDE19BEAF7900A0AB90 /* UIEditBoxImpl-win32.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "UIEditBoxImpl-win32.cpp"; sourceTree = "<group>"; };
|
||||
50ED2BDF19BEAF7900A0AB90 /* UIEditBoxImpl-wp8.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "UIEditBoxImpl-wp8.cpp"; sourceTree = "<group>"; };
|
||||
50FCEB6A18C72017004AD434 /* ButtonReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ButtonReader.cpp; sourceTree = "<group>"; };
|
||||
50FCEB6B18C72017004AD434 /* ButtonReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ButtonReader.h; sourceTree = "<group>"; };
|
||||
50FCEB6D18C72017004AD434 /* CheckBoxReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CheckBoxReader.cpp; sourceTree = "<group>"; };
|
||||
|
@ -5216,9 +5210,7 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
50ED2BDC19BEAF7900A0AB90 /* UIEditBoxImpl-win32.h */,
|
||||
50ED2BDD19BEAF7900A0AB90 /* UIEditBoxImpl-wp8.h */,
|
||||
50ED2BDE19BEAF7900A0AB90 /* UIEditBoxImpl-win32.cpp */,
|
||||
50ED2BDF19BEAF7900A0AB90 /* UIEditBoxImpl-wp8.cpp */,
|
||||
292DB12F19B4574100A80320 /* UIEditBox.cpp */,
|
||||
292DB13019B4574100A80320 /* UIEditBox.h */,
|
||||
292DB13119B4574100A80320 /* UIEditBoxImpl.h */,
|
||||
|
@ -6767,7 +6759,6 @@
|
|||
1A57011D180BC90D0088DEC7 /* CCGrabber.h in Headers */,
|
||||
B665E3C81AA80A6600DDB1C5 /* CCPUScaleVelocityAffector.h in Headers */,
|
||||
B29A7E2B19EE1B7700872B35 /* AtlasAttachmentLoader.h in Headers */,
|
||||
50ED2BE219BEAF7900A0AB90 /* UIEditBoxImpl-wp8.h in Headers */,
|
||||
B665E3781AA80A6500DDB1C5 /* CCPUParticleFollowerTranslator.h in Headers */,
|
||||
15AE1B6819AADA9900C27E9E /* UIScale9Sprite.h in Headers */,
|
||||
1A570121180BC90D0088DEC7 /* CCGrid.h in Headers */,
|
||||
|
@ -7744,7 +7735,6 @@
|
|||
15AE1A9519AAD40300C27E9E /* b2BlockAllocator.h in Headers */,
|
||||
5034CA48191D591100CE6051 /* ccShader_Label_normal.frag in Headers */,
|
||||
15AE183F19AAD2F700C27E9E /* CCSkeleton3D.h in Headers */,
|
||||
50ED2BE319BEAF7900A0AB90 /* UIEditBoxImpl-wp8.h in Headers */,
|
||||
50ABBD531925AB0000A911A9 /* Quaternion.h in Headers */,
|
||||
15AE19B119AAD39700C27E9E /* ScrollViewReader.h in Headers */,
|
||||
503DD8E81926736A00CD74DD /* CCES2Renderer-ios.h in Headers */,
|
||||
|
@ -8607,7 +8597,6 @@
|
|||
B665E20A1AA80A6500DDB1C5 /* CCPUBaseColliderTranslator.cpp in Sources */,
|
||||
B665E3E61AA80A6600DDB1C5 /* CCPUSineForceAffectorTranslator.cpp in Sources */,
|
||||
15AE1B5119AADA9900C27E9E /* UIPageView.cpp in Sources */,
|
||||
50ED2BE619BEAF7900A0AB90 /* UIEditBoxImpl-wp8.cpp in Sources */,
|
||||
15AE18EC19AAD35000C27E9E /* CCActionObject.cpp in Sources */,
|
||||
296BF6181A4405CB0038EC44 /* UIShaders.cpp in Sources */,
|
||||
B665E2821AA80A6500DDB1C5 /* CCPUDoStopSystemEventHandler.cpp in Sources */,
|
||||
|
@ -8897,7 +8886,6 @@
|
|||
B665E3471AA80A6500DDB1C5 /* CCPUOnExpireObserverTranslator.cpp in Sources */,
|
||||
15AE1AA519AAD40300C27E9E /* b2Fixture.cpp in Sources */,
|
||||
B29A7DE219EE1B7700872B35 /* MeshAttachment.c in Sources */,
|
||||
50ED2BE719BEAF7900A0AB90 /* UIEditBoxImpl-wp8.cpp in Sources */,
|
||||
B6D38B8F1AC3AFAC00043997 /* CCTextureCube.cpp in Sources */,
|
||||
15AE1BAD19AADFDF00C27E9E /* UILayoutParameter.cpp in Sources */,
|
||||
3823843E1A259140002C4610 /* SingleNodeReader.cpp in Sources */,
|
||||
|
|
|
@ -134,8 +134,9 @@ using namespace cocos2d::experimental::ui;
|
|||
}
|
||||
|
||||
if (videoSource == 1) {
|
||||
self.moviePlayer = [[[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@(videoUrl.c_str())]] autorelease];
|
||||
self.moviePlayer = [[[MPMoviePlayerController alloc] init] autorelease];
|
||||
self.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming;
|
||||
[self.moviePlayer setContentURL:[NSURL URLWithString:@(videoUrl.c_str())]];
|
||||
} else {
|
||||
NSString *path = [UIVideoViewWrapperIos fullPathFromRelativePath:@(videoUrl.c_str())];
|
||||
self.moviePlayer = [[[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:path]] autorelease];
|
||||
|
|
|
@ -104,7 +104,7 @@ void VideoPlayerTest::menuOnlineVideoCallback(Ref* sender)
|
|||
{
|
||||
if (_videoPlayer)
|
||||
{
|
||||
_videoPlayer->setURL("http://video001.smgbb.cn/gslb/program/FDN/FDN1190949/HLSVodService.m3u8?_mdCode=6065719&_cdnCode=B2B_XL_TEST&_type=0&_rCode=TerOut_18865&_userId=020341000456068&_categoryCode=SMG_HUAYU&_categoryPath=SMG_1002,SMG_HUAYU,&_adPositionId=01001000&_adCategorySource=0&_flag=.m3u8&_enCode=m3u8&taskID=ysh_ps_002-ott_1397459105893_020341000456068&_client=103&_cms=ctv&_CDNToken=76C043FD4969501754DC19E54EC8DC2C");
|
||||
_videoPlayer->setURL("http://benchmark.cocos2d-x.org/cocosvideo.mp4");
|
||||
_videoPlayer->play();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,9 +7,9 @@ import traceback
|
|||
import urllib2
|
||||
|
||||
http_proxy = ''
|
||||
if(os.environ.has_key('HTTP_PROXY')):
|
||||
if('HTTP_PROXY' in os.environ):
|
||||
http_proxy = os.environ['HTTP_PROXY']
|
||||
proxyDict = {'http':http_proxy,'https':http_proxy}
|
||||
proxyDict = {'http': http_proxy, 'https': http_proxy}
|
||||
|
||||
def main():
|
||||
#get payload from os env
|
||||
|
@ -23,8 +23,8 @@ def main():
|
|||
#get pull number
|
||||
pr_num = issue['number']
|
||||
print 'pr_num:' + str(pr_num)
|
||||
payload_forword = {"number":pr_num}
|
||||
|
||||
payload_forword = {"number": pr_num}
|
||||
|
||||
comment = payload['comment']
|
||||
#get comment body
|
||||
comment_body = comment['body']
|
||||
|
@ -38,12 +38,12 @@ def main():
|
|||
if searchCI is None and searchConsole is None:
|
||||
print 'skip build for pull request #' + str(pr_num)
|
||||
return(0)
|
||||
|
||||
|
||||
#build for pull request action 'open' and 'synchronize', skip 'close'
|
||||
action = issue['state']
|
||||
print 'action: ' + action
|
||||
payload_forword['action'] = action
|
||||
|
||||
|
||||
pr = issue['pull_request']
|
||||
url = pr['html_url']
|
||||
print "url:" + url
|
||||
|
@ -74,20 +74,22 @@ def main():
|
|||
|
||||
#set commit status to pending
|
||||
target_url = os.environ['JOB_PULL_REQUEST_BUILD_URL']
|
||||
|
||||
if(action == 'closed' or action == 'assigned'):
|
||||
print 'pull request #' + str(pr_num) + ' is '+action+', no build triggered'
|
||||
|
||||
if(action == 'closed' or action == 'assigned' or branch == 'v2'):
|
||||
print 'pull request #' + str(pr_num) + ' is ' + action + ', no build triggered'
|
||||
return(0)
|
||||
|
||||
data = {"state":"pending", "target_url":target_url, "context":"Jenkins CI", "description":"Wait available build machine..."}
|
||||
|
||||
data = {"state": "pending", "target_url": target_url, "context": "Jenkins CI",
|
||||
"description": "Wait available build machine..."}
|
||||
access_token = os.environ['GITHUB_ACCESS_TOKEN']
|
||||
Headers = {"Authorization":"token " + access_token}
|
||||
Headers = {"Authorization": "token " + access_token}
|
||||
|
||||
try:
|
||||
if searchCI:
|
||||
ciOper = searchCI.group()
|
||||
if('rebuild' in ciOper):
|
||||
requests.post(statuses_url, data=json.dumps(data), headers=Headers, proxies = proxyDict)
|
||||
ciOper = searchCI.group()
|
||||
if('rebuild' in ciOper):
|
||||
requests.post(statuses_url, data=json.dumps(data),
|
||||
headers=Headers, proxies=proxyDict)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
|
||||
|
@ -95,15 +97,15 @@ def main():
|
|||
if searchCI:
|
||||
ciOper = searchCI.group()
|
||||
if('rebuild' in ciOper):
|
||||
job_trigger_url = os.environ['JOB_PULL_REQUEST_BUILD_TRIGGER_URL']
|
||||
job_trigger_url = os.environ['JOB_PULL_REQUEST_BUILD_TRIGGER_URL']
|
||||
if('emptytest' in ciOper):
|
||||
job_trigger_url = os.environ['JOB_EMPTYTEST_TRIGGER_URL']
|
||||
job_trigger_url = os.environ['JOB_EMPTYTEST_TRIGGER_URL']
|
||||
if('release' in ciOper):
|
||||
searchTag = re.search('\[ci release (.*)\]', ciOper)
|
||||
if searchTag:
|
||||
ci_tag = searchTag.group(1)
|
||||
payload_forword['tag'] = ci_tag
|
||||
job_trigger_url = os.environ['JOB_RELEASE_TRIGGER_URL']
|
||||
searchTag = re.search('\[ci release (.*)\]', ciOper)
|
||||
if searchTag:
|
||||
ci_tag = searchTag.group(1)
|
||||
payload_forword['tag'] = ci_tag
|
||||
job_trigger_url = os.environ['JOB_RELEASE_TRIGGER_URL']
|
||||
if searchConsole:
|
||||
consoleOper = searchConsole.group()
|
||||
job_trigger_url = os.environ['JOB_CONSOLE_TEST_TRIGGER_URL']
|
||||
|
@ -112,19 +114,19 @@ def main():
|
|||
|
||||
#send trigger and payload
|
||||
if('tag' in payload_forword):
|
||||
post_data = {'tag':""}
|
||||
post_data['tag'] = payload_forword['tag']
|
||||
post_data = {'tag': ""}
|
||||
post_data['tag'] = payload_forword['tag']
|
||||
else:
|
||||
post_data = {'payload':""}
|
||||
post_data['payload']= json.dumps(payload_forword)
|
||||
requests.post(job_trigger_url, data=post_data, proxies = proxyDict)
|
||||
post_data = {'payload': ""}
|
||||
post_data['payload'] = json.dumps(payload_forword)
|
||||
requests.post(job_trigger_url, data=post_data, proxies=proxyDict)
|
||||
|
||||
return(0)
|
||||
|
||||
# -------------- main --------------
|
||||
if __name__ == '__main__':
|
||||
sys_ret = 0
|
||||
try:
|
||||
try:
|
||||
sys_ret = main()
|
||||
except:
|
||||
traceback.print_exc()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#Github pull reqest builder for Jenkins
|
||||
#Github pull reqest builder for Jenkins
|
||||
|
||||
import json
|
||||
import re
|
||||
|
@ -9,33 +9,34 @@ import traceback
|
|||
from jenkinsapi.jenkins import Jenkins
|
||||
|
||||
access_token = os.environ['GITHUB_ACCESS_TOKEN']
|
||||
Headers = {"Authorization":"token " + access_token}
|
||||
Headers = {"Authorization": "token " + access_token}
|
||||
|
||||
http_proxy = ''
|
||||
if(os.environ.has_key('HTTP_PROXY')):
|
||||
if('HTTP_PROXY' in os.environ):
|
||||
http_proxy = os.environ['HTTP_PROXY']
|
||||
proxyDict = {'http':http_proxy,'https':http_proxy}
|
||||
proxyDict = {'http': http_proxy, 'https': http_proxy}
|
||||
|
||||
def check_queue_build(action, pr_num, statuses_url):
|
||||
username = os.environ['JENKINS_ADMIN']
|
||||
password = os.environ['JENKINS_ADMIN_PW']
|
||||
jenkins_url = os.environ['JENKINS_URL']
|
||||
J = Jenkins(jenkins_url,username,password)
|
||||
J = Jenkins(jenkins_url, username, password)
|
||||
queues = J.get_queue()
|
||||
for key,queue in queues.iteritems():
|
||||
q_payload_str = queue.get_parameters()['payload'].decode('utf-8','ignore')
|
||||
q_payload = json.loads(q_payload_str)
|
||||
q_pr_num = q_payload['number']
|
||||
q_statuses_url = q_payload['statuses_url']
|
||||
if(q_pr_num == pr_num):
|
||||
if(action == 'closed') or (q_statuses_url != statuses_url):
|
||||
queues.delete_item(queue)
|
||||
target_url = os.environ['JOB_PULL_REQUEST_BUILD_URL']
|
||||
data = {"state":"error", "target_url":target_url}
|
||||
try:
|
||||
requests.post(statuses_url, data=json.dumps(data), headers=Headers, proxies = proxyDict)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
for key, queue in queues.iteritems():
|
||||
q_payload_str = queue.get_parameters()['payload'].decode('utf-8', 'ignore')
|
||||
q_payload = json.loads(q_payload_str)
|
||||
q_pr_num = q_payload['number']
|
||||
q_statuses_url = q_payload['statuses_url']
|
||||
if(q_pr_num == pr_num):
|
||||
if(action == 'closed') or (q_statuses_url != statuses_url):
|
||||
queues.delete_item(queue)
|
||||
target_url = os.environ['JOB_PULL_REQUEST_BUILD_URL']
|
||||
data = {"state": "error", "target_url": target_url}
|
||||
try:
|
||||
requests.post(statuses_url, data=json.dumps(data),
|
||||
headers=Headers, proxies=proxyDict)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
|
||||
def main():
|
||||
#get payload from os env
|
||||
|
@ -46,18 +47,18 @@ def main():
|
|||
#get pull number
|
||||
pr_num = payload['number']
|
||||
print 'pr_num:' + str(pr_num)
|
||||
payload_forword = {"number":pr_num}
|
||||
|
||||
payload_forword = {"number": pr_num}
|
||||
|
||||
#build for pull request action 'open' and 'synchronize', skip 'close'
|
||||
action = payload['action']
|
||||
print 'action: ' + action
|
||||
payload_forword['action'] = action
|
||||
|
||||
|
||||
pr = payload['pull_request']
|
||||
url = pr['html_url']
|
||||
print "url:" + url
|
||||
payload_forword['html_url'] = url
|
||||
|
||||
|
||||
#get statuses url
|
||||
statuses_url = pr['statuses_url']
|
||||
payload_forword['statuses_url'] = statuses_url
|
||||
|
@ -69,18 +70,19 @@ def main():
|
|||
#set commit status to pending
|
||||
target_url = os.environ['JOB_PULL_REQUEST_BUILD_URL']
|
||||
|
||||
try:
|
||||
try:
|
||||
check_queue_build(action, pr_num, statuses_url)
|
||||
except:
|
||||
print 'Can not find build in queue'
|
||||
|
||||
if(action == 'closed' or action == 'labeled' or action == 'assigned' or action == 'unlabeled'):
|
||||
print 'pull request #' + str(pr_num) + ' is '+action+', no build triggered'
|
||||
|
||||
if(action == 'closed' or action == 'labeled'
|
||||
or action == 'assigned' or action == 'unlabeled' or branch == 'v2'):
|
||||
print 'pull request #' + str(pr_num) + ' is ' + action + ', no build triggered'
|
||||
return(0)
|
||||
|
||||
r = requests.get(pr['url']+"/commits", headers=Headers, proxies = proxyDict)
|
||||
|
||||
r = requests.get(pr['url'] + "/commits", headers=Headers, proxies=proxyDict)
|
||||
commits = r.json()
|
||||
last_commit = commits[len(commits)-1]
|
||||
last_commit = commits[len(commits) - 1]
|
||||
message = last_commit['commit']['message']
|
||||
|
||||
pattern = re.compile("\[ci(\s+)skip\]", re.I)
|
||||
|
@ -91,27 +93,29 @@ def main():
|
|||
if result_commit_title is not None or result_pr_title is not None:
|
||||
print 'skip build for pull request #' + str(pr_num)
|
||||
return(0)
|
||||
|
||||
data = {"state":"pending", "target_url":target_url, "context":"Jenkins CI", "description":"Waiting available build machine..."}
|
||||
|
||||
|
||||
data = {"state": "pending", "target_url": target_url,
|
||||
"context": "Jenkins CI",
|
||||
"description": "Waiting available build machine..."}
|
||||
|
||||
try:
|
||||
requests.post(statuses_url, data=json.dumps(data), headers=Headers, proxies = proxyDict)
|
||||
requests.post(statuses_url, data=json.dumps(data),
|
||||
headers=Headers, proxies=proxyDict)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
|
||||
job_trigger_url = os.environ['JOB_TRIGGER_URL']
|
||||
#send trigger and payload
|
||||
post_data = {'payload':""}
|
||||
post_data['payload']= json.dumps(payload_forword)
|
||||
requests.post(job_trigger_url, data=post_data, proxies = proxyDict)
|
||||
post_data = {'payload': ""}
|
||||
post_data['payload'] = json.dumps(payload_forword)
|
||||
requests.post(job_trigger_url, data=post_data, proxies=proxyDict)
|
||||
|
||||
return(0)
|
||||
|
||||
# -------------- main --------------
|
||||
if __name__ == '__main__':
|
||||
sys_ret = 0
|
||||
try:
|
||||
try:
|
||||
sys_ret = main()
|
||||
except:
|
||||
traceback.print_exc()
|
||||
|
|
Loading…
Reference in New Issue