From: Hyokeun Jeon Date: Mon, 2 Sep 2019 09:54:19 +0000 (+0900) Subject: Sync trbs scripts X-Git-Tag: accepted/tizen/devbase/services/20190930.043253~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F85%2F213185%2F1;p=services%2Fjenkins-scripts.git Sync trbs scripts Change-Id: I0ac042c522124854e82e2afb330ad6d6ffaa4038 --- diff --git a/abs/job_abs_backend.py b/abs/job_abs_backend.py index 277c17b..0e10bea 100755 --- a/abs/job_abs_backend.py +++ b/abs/job_abs_backend.py @@ -726,11 +726,16 @@ def update_dashboard(stage, triggerCause, \ print repr(err) print 'Updating Dashboard Failed' -def start_build(): +def start_build(options): """ Running build using Tizen Studio """ print 'ENTER start_build' + print options + option = 'normal' + if len(options) >= 1: + option = options[1] + sourceData, confData, ciData = make_data() print '\n"Title": "%s/%s"\n' % (os.path.basename(sourceData.get('GIT_PATH')), \ @@ -795,9 +800,19 @@ def start_build(): (rs_ver, fail_title, fail_log, ts_version, ts_distribution) statusCode = 'PASS' + if tizenStudioInst.build_result != 0 or fail_title != None: statusCode = 'FAIL' + if option == 'check': + with open('abs_build_result_code.env', 'w') as output_return: + output_return.write(statusCode) + return else: + if option == 'check': + with open('abs_build_result_code.env', 'w') as output_return: + output_return.write(statusCode) + return + if ciData.get('BUILD_CAUSE') == 'GIT': postData = post_processing(tizenStudioInst, src_git, project_properties, \ sourceData, confData, ciData, builddir) @@ -820,13 +835,13 @@ def start_build(): with open('abs_build_result_code.env', 'w') as output_return: output_return.write(statusCode) -def main(): +def main(options): """ Script entry point. """ - return start_build() + return start_build(options) if __name__ == '__main__': - sys.exit(main()) + sys.exit(main(sys.argv)) diff --git a/abs/job_abs_frontend.sh b/abs/job_abs_frontend.sh index 5edf139..08211f6 100755 --- a/abs/job_abs_frontend.sh +++ b/abs/job_abs_frontend.sh @@ -10,7 +10,7 @@ export -p > ${DOCKER_VOL}/envs chmod +x ${DOCKER_VOL}/envs sed --quiet 's/^\(export \)*//' ${DOCKER_VOL}/envs -sudo docker pull ${ABS_TIZEN_STUDIO_DOCKER_IMAGE} +#sudo docker pull ${ABS_TIZEN_STUDIO_DOCKER_IMAGE} sudo docker run -t -d -w /share \ -v `pwd`/`basename ${SCRIPT_PATH}`:${SCRIPT_PATH} \ -v `pwd`/${DOCKER_VOL}:/share:rw \ @@ -23,7 +23,7 @@ source /share/envs chown build:build -R /share -su build -c '"python ${SCRIPT_PATH}/abs/job_abs_backend.py"' +su build -c '"python ${SCRIPT_PATH}/abs/job_abs_backend.py $1"' """ > ${DOCKER_VOL}/build.sh chmod +x ${DOCKER_VOL}/build.sh diff --git a/job_buildlogs.py b/job_buildlogs.py index 32f5e23..3b6452b 100755 --- a/job_buildlogs.py +++ b/job_buildlogs.py @@ -48,7 +48,7 @@ def update_buildlog_in_buildmonitor(package_build_dict, download_url, data['pkgs'][arch][pkg_name] = os.path.join(arch, status, "%s.buildlog.txt" % pkg_name) - trigger_next("BUILD-MONITOR-%s" % repo, data, compress=True) + trigger_next("BUILD-MONITOR-%s" % repo, data) def restructure_output_dir(package_build_dict, target_path): """ Put the logs in request structure diff --git a/job_create_sdkrootstrap.py b/job_create_sdkrootstrap.py index 5ade3ec..36da946 100755 --- a/job_create_sdkrootstrap.py +++ b/job_create_sdkrootstrap.py @@ -326,7 +326,8 @@ def make_rs_snapshot_private(git_prj, git_cache, mygit, fields, profile, vm_imag return status -def make_rs_snapshot_public(git_prj, git_cache, mygit, fields, profile, vm_image, specific_branch=None): +def make_rs_snapshot_public(git_prj, git_cache, mygit, fields, profile, vm_image, \ + specific_branch=None, specific_cmd=None): """ Make Rootstrap snapshot(public api) """ @@ -337,16 +338,21 @@ def make_rs_snapshot_public(git_prj, git_cache, mygit, fields, profile, vm_image else: git_branch = profile['git_branch'] + if specific_cmd is not None: + cmd_to_use = specific_cmd + else: + cmd_to_use = profile['public_cmd'] + print '\n\n===========' print 'CREATING ROOTSTRAP FOR' print ' [%s] [%s] [%s] [%s] [%s]' \ % (profile.get('project'), 'PUBLIC', \ - profile.get('git_branch'), profile.get('public_cmd'), git_branch) + profile.get('git_branch'), cmd_to_use, git_branch) print '===========\n' mygit.checkout(git_branch) - rs = os.path.join(git_cache, git_prj, profile['public_cmd']) + rs = os.path.join(git_cache, git_prj, cmd_to_use) if not os.path.isfile(rs): print '%s is not found' % rs return 'failed' @@ -380,7 +386,7 @@ def make_rs_snapshot_public(git_prj, git_cache, mygit, fields, profile, vm_image str_64_cmd = '' if profile.get('support_64') != 'False': str_64_cmd = '$WORKDIR/$SDKIMAGE/%s -u %s -b %s\n' % \ - (profile["public_cmd"].replace('.sh', '_64.sh'), + (cmd_to_use.replace('.sh', '_64.sh'), os.path.join(profile["base_url"],profile["repo_path"],build_id), os.path.join(profile["base_url"],profile["base_repo_path"],'latest')) @@ -393,7 +399,7 @@ def make_rs_snapshot_public(git_prj, git_cache, mygit, fields, profile, vm_image '%s\n' \ 'cp -r $WORKDIR/$RS/ $BUILDDIR\n' % \ (git_cmd, - profile["public_cmd"], + cmd_to_use, os.path.join(profile["base_url"],profile["repo_path"],build_id), os.path.join(profile["base_url"],profile["base_repo_path"],'latest'), str_64_cmd) @@ -534,6 +540,7 @@ def main(): status = 'succeeded' reason = 'ok' + if profile.get('private_cmd', 'False') != 'False': #### Make Rootstrap Snapshot (PRIVATE)#### status = make_rs_snapshot_private(git_prj, git_cache, mygit, fields, profile, vm_image) @@ -560,9 +567,15 @@ def main(): #### Misc public rootstraps #### if profile.get('misc_branches'): for mb in profile.get('misc_branches'): - status_1 = make_rs_snapshot_public(git_prj, git_cache, mygit, fields, profile, vm_image, specific_branch=mb) + status_1 = make_rs_snapshot_public(git_prj, git_cache, mygit, fields, profile, \ + vm_image, specific_branch=mb) if status_1 != 'succeeded': status = status_1 + if profile.get('public_misc_cmds'): + for mc in profile.get('public_misc_cmds'): + print 'MISC command: %s' % mc + make_rs_snapshot_public(git_prj, git_cache, mygit, fields, profile, \ + vm_image, specific_cmd=mc) if status == 'succeeded': print "The RBS(Public) build was successful." diff --git a/job_submit.py b/job_submit.py index 28820ec..9020bf9 100755 --- a/job_submit.py +++ b/job_submit.py @@ -539,6 +539,16 @@ def main(build_type, build, event, sr_count): obs_stg_prj = item['OBS_staging_project'] obs_pkg = item['OBS_package'] obs_use_specname = item['OBS_use_specname'] + + if build_type == 'prerelease': + if obs_stg_prj == 'abs' and git_branch.endswith('_tpk'): + print 'Create ABS prerelease project...' + elif obs_stg_prj != 'prerelease': + print "%s is not 'prerelease' project in git-obs-mapping.xml." \ + "It has been switched to submitobs workflow." \ + "Skipping ..." % obs_stg_prj + continue + if 'config' in item and item['config'] is not None and item['config'].enable == 'false': print 'SR for %s is not enabled' % (obs_target_prj) continue @@ -568,13 +578,6 @@ def main(build_type, build, event, sr_count): print 'package name = %s' %(package) if build_type == 'prerelease': - if obs_stg_prj == 'abs' and git_branch.endswith('_tpk'): - print 'Create ABS prerelease project...' - elif obs_stg_prj != 'prerelease': - print "%s is not 'prerelease' project in git-obs-mapping.xml." \ - "It has been switched to submitobs workflow." \ - "Skipping ..." % obs_stg_prj - continue if not prerelease_enabled(backenddb, obs_target_prj): print 'Skipping %s as prerelease is not enabled for it' % \ obs_target_prj