#NEWLINE# def search_artifacts( jenkinsurl , jobid , artifact_ids = None ) : #NEWLINE# #INDENT# '\n    Search the entire history of a jenkins job for a list of artifact names. If same_build\n    is true then ensure that all artifacts come from the same build of the job\n    ' #NEWLINE# if ( ( len ( artifact_ids ) == 0 ) or ( artifact_ids is None ) ) : #NEWLINE# #INDENT# return [ ] #NEWLINE# #UNINDENT# jenkinsci = Jenkins ( jenkinsurl ) #NEWLINE# job = jenkinsci [ jobid ] #NEWLINE# build_ids = job . get_build_ids ( ) #NEWLINE# for build_id in build_ids : #NEWLINE# #INDENT# build = job . get_build ( build_id ) #NEWLINE# artifacts = build . get_artifact_dict ( ) #NEWLINE# if set ( artifact_ids ) . issubset ( set ( artifacts . keys ( ) ) ) : #NEWLINE# #INDENT# return dict ( ( ( a , artifacts [ job ] ) for a in artifact_ids ) ) #NEWLINE# #UNINDENT# missing_artifacts = ( set ( artifact_ids ) - set ( artifacts . keys ( ) ) ) #NEWLINE# log . debug ( ( 'Artifacts %s missing from %s #%i' % ( ', ' . join ( missing_artifacts ) , jobid , build_id ) ) ) #NEWLINE# #UNINDENT# raise ArtifactsMissing ( missing_artifacts )