def write_downstream_parameters(repos_under_test, parameters_file): params = {} params['REPOS_UNDER_TEST'] = ','.join(repos_under_test) repos_need_unit_test = [] for repo_name in repos_under_test: if repo_name in [ "on-core", "on-tasks", "on-http", "on-tftp", "on-dhcp-proxy", "on-taskgraph", "on-syslog" ]: repos_need_unit_test.append(repo_name) if repo_name == "on-core": repos_depends = [ "on-tasks", "on-http", "on-tftp", "on-dhcp-proxy", "on-taskgraph", "on-syslog" ] repos_need_unit_test.extend(repos_depends) if repo_name == "on-tasks": repos_depends = ["on-http", "on-taskgraph"] repos_need_unit_test.extend(repos_depends) repos_need_unit_test = list(set(repos_need_unit_test)) if len(repos_need_unit_test) > 0: params['REPOS_NEED_UNIT_TEST'] = ','.join(repos_need_unit_test) common.write_parameters(parameters_file, params)
def write_downstream_parameter_file(build_directory, manifest_file, is_official_release, parameter_file): try: params = {} # Add rackhd version to downstream parameters rackhd_repo_dir = os.path.join(build_directory, "RackHD") version_generator = VersionGenerator(rackhd_repo_dir) rackhd_version = version_generator.generate_package_version(is_official_release) if rackhd_version != None: params['RACKHD_VERSION'] = rackhd_version else: raise RuntimeError("Version of {0} is None. Maybe the repository doesn't contain debian directory ".format(rackhd_repo_dir)) # Add the commit of repository RackHD/RackHD to downstream parameters manifest = Manifest(manifest_file) # commit of repository RackHD/RackHD rackhd_commit = '' for repo in manifest.repositories: repository = repo['repository'].lower() if repository.endswith('rackhd') or repository.endswith('rackhd.git'): rackhd_commit = repo['commit-id'] if rackhd_commit != '': params['RACKHD_COMMIT'] = rackhd_commit else: raise RuntimeError("commit-id of RackHD is None. Please check the manifest {0}".format(manifest_file)) # Write downstream parameters to downstream parameter file. common.write_parameters(parameter_file, params) except Exception, e: raise RuntimeError("Failed to write downstream parameter file \ndue to {0}".format(e))
def main(): # parse arguments args = parse_command_line(sys.argv[1:]) jira_operator = JIRAOperator(args.jira_server,args.username,args.password) report = {} p1_bugs = jira_operator.search_open_bugs_by_priority("RACKHD", "P1") report["P1_ISSUES_COUNT"] = len(p1_bugs) # Create a java properties file to pass down parameters to downstream pipeline steps common.write_parameters(args.parameters_file, report)
def write_downstream_parameters(repos_under_test, parameters_file): params = {} params['REPOS_UNDER_TEST'] = ','.join(repos_under_test) # Can add customized fiter here if necessary, this is just a sample. repos_need_unit_test = [] repos_need_unit_test = repos_under_test if len(repos_need_unit_test) > 0: params['REPOS_NEED_UNIT_TEST'] = ','.join(repos_need_unit_test) common.write_parameters(parameters_file, params)
def main(): # parse arguments args = parse_command_line(sys.argv[1:]) jira_operator = JIRAOperator(args.jira_server, args.username, args.password) report = {} p1_bugs = jira_operator.search_open_bugs_by_priority("RACKHD", "P1") report["P1_ISSUES_COUNT"] = len(p1_bugs) # Create a java properties file to pass down parameters to downstream pipeline steps common.write_parameters(args.parameters_file, report)
def main(): args = parse_args(sys.argv[1:]) try: sub_builds = get_sub_builds(args.build_url, args.jenkins_url) # Replace the special character of job name with _ # Because these parameters are going to used as linux environment variables # whose variable name may permit some characters which are allowed in jenkins job name, # such as: white space, -, .. parameters = {} for key, value in sub_builds.items(): job_name = re.sub(r'[\W_]+', '_', key) parameters[job_name] = value common.write_parameters(args.parameter_file, parameters) except Exception as e: print e sys.exit(1)
def generate_version_file(repo_dir, is_official_release): """ Generate the version file for rackhd repository :param repo_dir: The directory of rackhd repository :param is_official_release: If true, this release is official release :return: True if succeed to compute version and write it into version file. Otherwise, False. """ try: version_generator = VersionGenerator(repo_dir) version = version_generator.generate_package_version(is_official_release) if version != None: params = {} params['PKG_VERSION'] = version repo_name = os.path.basename(repo_dir) version_file = "{0}.version".format(repo_name) version_path = os.path.join(repo_dir, version_file) common.write_parameters(version_path, params) return True except Exception, e: raise RuntimeError("Failed to generate version file for {0} \ndue to {1}".format(repo_dir, e))