Skip to content

Commit

Permalink
[ews] Make S3 upload failure a hard failure
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=268081

Reviewed by Jonathan Bedard.

Make S3 upload failure a hard failure on ews-build.webkit.org.
Remove the fallback to uploading to the build-master, as that seems to overload the server.

* Tools/CISupport/ews-build/steps.py:
(UploadFileToS3):
(UploadFileToS3.run):
(UploadFileToS3.getResultSummary):
* Tools/CISupport/ews-build/steps_unittest.py:
(TestUploadFileToS3.test_success):

Canonical link: https://commits.webkit.org/273509@main
  • Loading branch information
aj062 committed Jan 25, 2024
1 parent 9af27cf commit 15355e2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
17 changes: 11 additions & 6 deletions Tools/CISupport/ews-build/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -4924,20 +4924,18 @@ def getResultSummary(self):
class UploadFileToS3(shell.ShellCommandNewStyle, AddToLogMixin):
name = 'upload-file-to-s3'
descriptionDone = name
haltOnFailure = False
flunkOnFailure = False
haltOnFailure = True
flunkOnFailure = True

def __init__(self, **kwargs):
super().__init__(timeout=31 * 60, logEnviron=False, **kwargs)

@defer.inlineCallbacks
def run(self):
s3url = self.build.s3url
steps_to_add = [UploadBuiltProduct(), TransferToS3()]
if not s3url:
rc = FAILURE
yield self._addToLog('stdio', f'Failed to get s3url: {s3url}')
self.build.addStepsAfterCurrentStep(steps_to_add)
return defer.returnValue(rc)

self.env = dict(UPLOAD_URL=s3url)
Expand All @@ -4946,13 +4944,20 @@ def run(self):

self.command = ['python3', 'Tools/Scripts/upload-file-to-url', '--filename', workersrc]
rc = yield super().run()
if rc in [FAILURE, EXCEPTION]:
self.build.addStepsAfterCurrentStep(steps_to_add)
return defer.returnValue(rc)

def doStepIf(self, step):
return CURRENT_HOSTNAME == EWS_BUILD_HOSTNAME

def getResultSummary(self):
if self.results == FAILURE:
return {'step': 'Failed to upload archive to S3. Please inform an admin.'}
if self.results == SKIPPED:
return {'step': 'Skipped upload to S3'}
if self.results in [SUCCESS, WARNINGS]:
return {'step': 'Uploaded archive to S3'}
return super().getResultSummary()


class GenerateS3URL(master.MasterShellCommandNewStyle):
name = 'generate-s3-url'
Expand Down
8 changes: 5 additions & 3 deletions Tools/CISupport/ews-build/steps_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4733,6 +4733,8 @@ def configureStep(self):

def test_success(self):
self.configureStep()
self.assertEqual(UploadFileToS3.haltOnFailure, True)
self.assertEqual(UploadFileToS3.flunkOnFailure, True)
self.expectRemoteCommands(
ExpectShell(workdir='wkdir',
env=dict(UPLOAD_URL='https://test-s3-url'),
Expand All @@ -4742,7 +4744,7 @@ def test_success(self):
)
+ 0,
)
self.expectOutcome(result=SUCCESS, state_string='upload-file-to-s3')
self.expectOutcome(result=SUCCESS, state_string='Uploaded archive to S3')
with current_hostname(EWS_BUILD_HOSTNAME):
return self.runStep()

Expand All @@ -4760,13 +4762,13 @@ def test_failure(self):
exit 1''')
+ 2,
)
self.expectOutcome(result=FAILURE, state_string='upload-file-to-s3 (failure)')
self.expectOutcome(result=FAILURE, state_string='Failed to upload archive to S3. Please inform an admin.')
with current_hostname(EWS_BUILD_HOSTNAME):
return self.runStep()

def test_skipped(self):
self.configureStep()
self.expectOutcome(result=SKIPPED, state_string='upload-file-to-s3 (skipped)')
self.expectOutcome(result=SKIPPED, state_string='Skipped upload to S3')
with current_hostname('something-other-than-steps.EWS_BUILD_HOSTNAME'):
return self.runStep()

Expand Down

0 comments on commit 15355e2

Please sign in to comment.