From 8776ec2327d71470783666f523ab302c57848d1b Mon Sep 17 00:00:00 2001 From: Ammar Askar Date: Mon, 12 Aug 2019 12:25:22 -0400 Subject: [PATCH] [infra] Publish build badges on status page (#2513) * [infra] Publish build badges on status page * Address feedback from github PR * Change success badge to 'fuzzing' and failing badge to 'build failing' --- infra/gcb/badge_images/building.png | Bin 0 -> 3020 bytes infra/gcb/badge_images/building.svg | 1 + infra/gcb/badge_images/coverage_failing.png | Bin 0 -> 4160 bytes infra/gcb/badge_images/coverage_failing.svg | 1 + infra/gcb/badge_images/failing.png | Bin 0 -> 3465 bytes infra/gcb/badge_images/failing.svg | 1 + infra/gcb/builds_status.py | 44 ++++++++++++++++++++ 7 files changed, 47 insertions(+) create mode 100644 infra/gcb/badge_images/building.png create mode 100644 infra/gcb/badge_images/building.svg create mode 100644 infra/gcb/badge_images/coverage_failing.png create mode 100644 infra/gcb/badge_images/coverage_failing.svg create mode 100644 infra/gcb/badge_images/failing.png create mode 100644 infra/gcb/badge_images/failing.svg diff --git a/infra/gcb/badge_images/building.png b/infra/gcb/badge_images/building.png new file mode 100644 index 0000000000000000000000000000000000000000..9e7e73447367e2b5445b1ba55df5e837ffe170fe GIT binary patch literal 3020 zcmZ|Rc|26>{{Zka(->QpbaU;7BnmSa+gKW+D8?i=W9&PH#?mm^hIADfm7T^=WXqN$ zTa+Z%k|ok5OS+aAyX<`D%zwW>e(&>op3gbwIiJ^go#%X>^E&tOxQl!|Vmtr<@R^w! zTd|@ytNkGeXZ5PS`2<#gc^O(50zg#~@16?>>loo?YGnZcx8(tV8VdkBtW(rk0Jwz$ zfM3o4fXM)WKS@vOujsJ`;I5Z18nYtH_W6b=R^TR?+6J*Ak=;lq-$bx>ID^eBOgN|D z;!ts&y!ike0PsYb85>%M{>!wBFi-v}cG$!mS?v=rAm$^kDSRI`){>F6={9iZw-qUs zJ8E_0nUYNMJ9+h3MBnI%cc?ptuRplAig-Q=;`L0(?2_k^u3k>x^J_~!QX=fTXHodfcQ~m6$8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?ES%}Q>4OcdAh9|dSq`nT6-uS|EH_Y%Ij zO=rVKf(!=8!62pPYFn^G-g7C+f?_B*#>VLGK%;)x?}cyGaUBTo6Q+rD$auSYXjgW+ z*+M?fEmDd=AZZH=XFQIJd>i2A{$Dr9lOxK724Y zf0IAM``IomJ$`<29}ZvNng1F+lap-P-w#w}bUN6VczLvaJd>K!zRU1H)Vr5ffV{|f z{u<*_i)Y;nb`byv-gDVQGE-O9;Kntl6PKIl*yzHUb^C`PMYhd z>x%I?qXM9IsuQZ$1~(6CrRs$Ho5S z0|#8uQC`dZH=C7{2Zx~ITJdcajnGPh3U_x;micXc(ggKFb(oej>cdBsa&%+c@imiQ zhvLwHHGW3;)4`!Zh~~(`3nE`{`j7P!+)3#fvn6Qzbb+@q`SHcBC4|EB;{W!_KiV3Z z1RBp{v12lFaw@d8z#4(6Z9PWu2Tl7urk2pzO6XY}gWQz+vVWYPb3zgdT}9qQ2Bg)@ zt^2%wVK<~aKXm=R|I_T*>9xM3$o2MiH=e5*tJ9%U)N{^N`2~rI+avL(IjuPzjZ$$J zn=YY`9cq&w9M-6BZjNs*?w^huvYpj@6ohB}oSq6cAq2a-1bblI0zFs(P(!KeD5Er$ z)wHZpXpEW`Mnmf?N)3ZT>6_yw|4)M7O?Mwp%Kx8We(bjcD?t^!LlD^u oss-fuzzoss-fuzzfuzzingfuzzing \ No newline at end of file diff --git a/infra/gcb/badge_images/coverage_failing.png b/infra/gcb/badge_images/coverage_failing.png new file mode 100644 index 0000000000000000000000000000000000000000..85abe2352c67ee782a49491e6eea2d1cbcf3d30a GIT binary patch literal 4160 zcmZ|Sc{o&U*Z}Y|j6wFuOAE@_vM;Y?>>+!0+1HRPql`g@nMuSeWvP(0>@T9E>_$Yr zWXVppCM4U~$1r?ze1Cm^e7|#@xz9Os-RE4_JokC-XA&)M7_yx?e+B>mHe(}wYg){t z?L3??+UI2<@pf8(`steM0>Im+EJvOUv~wYEBWrU2xGxF-xQ75hp&}B0ASxX*4MR-m|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z-P4v=`mLa(sNCvd6*J z7o*0-?j>zww`!I1%ZFj%&Q*lYha-qAK9RE=9PEq^&6#iB+S*Mwcq>3E>_2y%i5sf! z?hObI4#>^~D($nAUyqNmlQB*lv7Ujw!G4NxSZr)zAsu93a&qw1SZ!TdX689bw@3!k zE*ta2duG1#|5jvUGL>x9bLRVUOGJ|xm{^=^aNV?)kecwd*Ux))_QdU`p8_N?ad7b3 zW#>Zgx!XUi+Gh*`uxr(ed*h1Tc1u*DF`b#O9~awZWg8``Ao4Nt;;xV~ss&P#$I* zlN)lvU$E$YzyN``$V?#~Ol{P5gs-{3&bIW@L&`EU@L1+(nOpSs=LhIbhp??PeobED zf0z=H=oC&-y6IZ{#`>n6{aHKxb5Qe9PHNxDFaI;kw20f2>;q~aiv=rPKOY& z{14evhG)eIq&zlA77C8K;@{D`NT~7M=XLea6sMiMEM}R@A=RI zpdcr&CM~BdEw5-RuY~wp6``agEvJN#liMt_bof6BLC9PFzLEcb0&e&BFIs{e_=Hfj zAHvHs)JHn(o oss-fuzzoss-fuzzcoverage failingcoverage failing \ No newline at end of file diff --git a/infra/gcb/badge_images/failing.png b/infra/gcb/badge_images/failing.png new file mode 100644 index 0000000000000000000000000000000000000000..0d2bb4701f22f7ef4bea7fc8f116d49bfdb176c9 GIT binary patch literal 3465 zcmZ|Sc|26>{{ZkagOPobB4ewBTWQ8N7~9zQ<;u-kc4G^dv5X~y+h&_2TNqm<$-XyX zBG-0J2_Z{LC|iR;NWOFCpWk1<_c_n`oO7P@c|EV!InQ~{bMDz#8S`!|3FgboZ znV9Jb!}$7)ezTAkO>!+ZQkPRmRod%tN9QS{&k5eNLw{4t(97jJ*2*)u)YY}#HM>hX zAXk^Htd|D+tOws#Z&=b?A}`GsED>m7ktNr82?}3(;2C`@56AzgxngKIs_ZYSBCjRx z*r%6G5)k|8>@j$%F3N3AH|#UD8@kN-E1zIpB~gP*P2K3r2tWk?%&XtrsyJD7(aFAX zeKJXYB2k_|5P0+_XJAq{L@fmA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o8$cvY)DkEAZhU-p_JdDcT=fxc|I|Ik{%hU2={Azi zY!gq^VqVMa$CoEjqLi0Gv+Vo(7);P~t*cc)tZ!4`fP995aVH%L7u~06NZ#x_b%4iU z%i5ST3QO#TER*T!^=4NY*_MUhlr5ytGXC(8nx}NID=f@bSGTv<)8jJS*nZe6`L+PU z3qxnt*}K}Afszj|phb9LNePwvnYT;_EY>H!ZW-*~lWKy78n@)kiuO6P*}f^r4b8M5 z3e6w;^!WTCbDmIQ6B3)j+iN>a8v|u!_Fj#C@Yx};Ns?`BJQDBQgvAo`^Ba_k$I??p z(p-)s7LL1Tud)m-Y z&UyFV#`ZRSZv9L4K9`P{cwH`YRuk0T-27U%UE*%q_HJjUXUjh+!jzZ$2a}~mDLhgc z$JmvJykSE_ad8-N6#Cy&8vOyfCHKRL`uc$bS^=l>Pdj{JzGWvUZ+d1Ns~d2WgyG?M z^7u$MN{GXyb9QWOYH-`w;F3#j0dG{ak+IIM*t;o8EYi!Xme7BuD?_ft>oC8PE38#Ugln)=UN_iGCnH5*d1hbym$w@R8^H0F;uthb( z;d9H&U*9xkyRCE-%e}hOm#^v<)s2`nPOm*7egyyOo&e5@t=}omjN**b=}F7rva?E7Uh5){^sUC>c7S1;<+fPIdMWK zwrfG>N5_F{g7Wd>Zg8hc=AXrRyrBc$%N_5H@eK8520#&|pe~O>%PXqdp_DO-Xbej2 zB1#d1LIuh=gTFujmvAH4%g=}K|0jsY%&#*O6u=h3B5)WF_b_ky@K8U%$1l(ugG3_n vH$sp%+;M)M0rCpUY6=R`UWOJPmPStcp~`wk??d#N$$+V$l|i+hTjKu!{MCPt literal 0 HcmV?d00001 diff --git a/infra/gcb/badge_images/failing.svg b/infra/gcb/badge_images/failing.svg new file mode 100644 index 000000000..ed0f8621e --- /dev/null +++ b/infra/gcb/badge_images/failing.svg @@ -0,0 +1 @@ + oss-fuzzoss-fuzzbuild failingbuild failing \ No newline at end of file diff --git a/infra/gcb/builds_status.py b/infra/gcb/builds_status.py index 0b2fe15ef..eb98ac166 100755 --- a/infra/gcb/builds_status.py +++ b/infra/gcb/builds_status.py @@ -20,6 +20,7 @@ import build_project STATUS_BUCKET = 'oss-fuzz-build-logs' SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) +BADGE_DIR = 'badges/' RETRY_COUNT = 3 RETRY_WAIT = 5 MAX_BUILD_RESULTS = 2000 @@ -173,6 +174,45 @@ def update_build_status( upload_status(successes, failures, status_filename) +def update_build_badges(builds, projects, build_tag, coverage_tag): + for project in projects: + last_build = find_last_build(builds, project, build_tag) + last_coverage_build = find_last_build(builds, project, coverage_tag) + if not last_build or not last_coverage_build: + continue + + badge = 'building' + if not is_build_successful(last_coverage_build): + badge = 'coverage_failing' + if not is_build_successful(last_build): + badge = 'failing' + + print("[badge] {}: {}".format(project, badge)) + + storage_client = storage.Client() + status_bucket = storage_client.get_bucket(STATUS_BUCKET) + + # Supported image types for badges + image_types = { + 'svg': 'image/svg+xml', + 'png': 'image/png' + } + for extension, mime_type in image_types.items(): + badge_name = '{badge}.{extension}'.format( + badge=badge, extension=extension) + # Retrieve the image relative to this script's location + badge_file = os.path.join( + SCRIPT_DIR, 'badge_images', image_directory, badge_name) + + # The uploaded blob name should look like `badges/project.png` + blob_name = '{badge_dir}{project_name}.{extension}'.format( + badge_dir=BADGE_DIR, project_name=project, + extension=extension) + + badge_blob = status_bucket.blob(blob_name) + badge_blob.upload_from_filename(badge_file, content_type=mime_type) + + def main(): if len(sys.argv) != 2: usage() @@ -190,6 +230,10 @@ def main(): build_and_run_coverage.COVERAGE_BUILD_TAG, status_filename='status-coverage.json') + update_build_badges(builds, projects, + build_tag=build_project.FUZZING_BUILD_TAG, + coverage_tag=build_and_run_coverage.COVERAGE_BUILD_TAG) + if __name__ == '__main__': main()