@@ -866,7 +866,7 @@ func (mgr *Manager) uploadCoverReport() error {
866866 }
867867 defer resp .Body .Close ()
868868 if directUpload {
869- return uploadFile (mgr .cfg .CoverUploadPath , mgr .name + ".html" , resp .Body , mgr .cfg .PublishGCS )
869+ return uploadFile (context . Background (), mgr .cfg .CoverUploadPath , mgr .name + ".html" , resp .Body , mgr .cfg .PublishGCS )
870870 }
871871 // Upload via the asset storage.
872872 newAsset , err := mgr .storage .UploadBuildAsset (resp .Body , mgr .name + ".html" ,
@@ -881,8 +881,8 @@ func (mgr *Manager) uploadCoverReport() error {
881881 return nil
882882}
883883
884- func (mgr * Manager ) uploadCoverJSONLToGCS (mgrSrc , gcsDest string , curTime time.Time , publish , compress bool ,
885- f func (io.Writer , * json.Decoder ) error ) error {
884+ func (mgr * Manager ) uploadCoverJSONLToGCS (ctx context. Context , mgrSrc , gcsDest string , curTime time.Time ,
885+ publish , compress bool , f func (io.Writer , * json.Decoder ) error ) error {
886886 if ! mgr .managercfg .Cover || gcsDest == "" {
887887 return nil
888888 }
@@ -932,7 +932,7 @@ func (mgr *Manager) uploadCoverJSONLToGCS(mgrSrc, gcsDest string, curTime time.T
932932 mgr .mgrcfg .DashboardClient ,
933933 mgr .name , curTime .Format (time .DateOnly ),
934934 curTime .Hour (), curTime .Minute ())
935- if err := uploadFile (gcsDest , fileName , pr , publish ); err != nil {
935+ if err := uploadFile (ctx , gcsDest , fileName , pr , publish ); err != nil {
936936 return fmt .Errorf ("failed to uploadFileGCS(): %w" , err )
937937 }
938938 return nil
@@ -943,7 +943,8 @@ func (mgr *Manager) uploadCoverStat(fuzzingMinutes int) error {
943943 // In the syz-ci context report generation won't be used after this point,
944944 // so tell manager to flush report generator.
945945 curTime := time .Now ()
946- if err := mgr .uploadCoverJSONLToGCS ("/cover?jsonl=1&flush=1" ,
946+ if err := mgr .uploadCoverJSONLToGCS (context .Background (),
947+ "/cover?jsonl=1&flush=1" ,
947948 mgr .cfg .CoverPipelinePath ,
948949 curTime ,
949950 false ,
@@ -974,7 +975,8 @@ func (mgr *Manager) uploadCoverStat(fuzzingMinutes int) error {
974975}
975976
976977func (mgr * Manager ) uploadProgramsWithCoverage () error {
977- if err := mgr .uploadCoverJSONLToGCS ("/coverprogs?jsonl=1" ,
978+ if err := mgr .uploadCoverJSONLToGCS (context .Background (),
979+ "/coverprogs?jsonl=1" ,
978980 mgr .cfg .CoverProgramsPath ,
979981 time .Now (),
980982 mgr .cfg .PublishGCS ,
@@ -1005,7 +1007,7 @@ func (mgr *Manager) uploadCorpus() error {
10051007 return err
10061008 }
10071009 defer f .Close ()
1008- return uploadFile (mgr .cfg .CorpusUploadPath , mgr .name + "-corpus.db" , f , mgr .cfg .PublishGCS )
1010+ return uploadFile (context . Background (), mgr .cfg .CorpusUploadPath , mgr .name + "-corpus.db" , f , mgr .cfg .PublishGCS )
10091011}
10101012
10111013func (mgr * Manager ) uploadBenchData () error {
@@ -1023,15 +1025,15 @@ func (mgr *Manager) uploadBenchData() error {
10231025 return fmt .Errorf ("failed to open bench file: %w" , err )
10241026 }
10251027 defer f .Close ()
1026- err = uploadFile (mgr .cfg .BenchUploadPath + "/" + mgr .name ,
1028+ err = uploadFile (context . Background (), mgr .cfg .BenchUploadPath + "/" + mgr .name ,
10271029 mgr .lastRestarted .Format ("2006-01-02_15h.json" ), f , false )
10281030 if err != nil {
10291031 return fmt .Errorf ("failed to upload the bench file: %w" , err )
10301032 }
10311033 return nil
10321034}
10331035
1034- func uploadFile (dstPath , name string , file io.Reader , publish bool ) error {
1036+ func uploadFile (ctx context. Context , dstPath , name string , file io.Reader , publish bool ) error {
10351037 URL , err := url .Parse (dstPath )
10361038 if err != nil {
10371039 return fmt .Errorf ("failed to parse upload path: %w" , err )
@@ -1043,7 +1045,7 @@ func uploadFile(dstPath, name string, file io.Reader, publish bool) error {
10431045 strings .HasPrefix (URLStr , "https://" ) {
10441046 return uploadFileHTTPPut (URLStr , file )
10451047 }
1046- return gcs .UploadFile (context . Background () , file , URLStr , publish )
1048+ return gcs .UploadFile (ctx , file , URLStr , publish )
10471049}
10481050
10491051func uploadFileHTTPPut (URL string , file io.Reader ) error {
0 commit comments