Skip to content

Builds: restart build commands before a new build #7999

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 18, 2021
Merged

Conversation

stsewd
Copy link
Member

@stsewd stsewd commented Mar 9, 2021

This avoids ending up with duplicate commands.
This can be tested by manually triggering a retry in any part of the
task.

The user may still see duplicate commands,
as our js always adds new commands to the end,
but after a refresh the correct number of commands are shown.

This avoids ending up with duplicate commands.
This can be tested by manually triggering a retry in any part of the
task.

The user may still see duplicate commands,
as our js always adds new commands to the end,
but after a refresh the correct number of commands are shown.
@stsewd stsewd requested a review from a team March 9, 2021 23:21
Copy link
Member

@humitos humitos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm suggesting to change the name of the endpoint so it doesn't suggest the build will be re-triggered, and also cleaning more fields.

@stsewd stsewd requested a review from humitos March 10, 2021 19:22
@stsewd stsewd force-pushed the fix-dup-commands branch from 65c5045 to 1552523 Compare March 10, 2021 19:22
@stsewd stsewd requested a review from a team March 10, 2021 19:22
Copy link
Member

@ericholscher ericholscher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should make the UX a bit nicer 👍

@@ -382,6 +382,7 @@ def setUp(self):
}
self.response_data = {
'build-concurrent': {'status_code': 403},
'build-reset': {'status_code': 403},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is useful anymore. Might be owrth removing this automation if we feel we have good test coverage over this stuff.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if they are that useful, but it doesn't hurt having more tests p:

permission_classes=[permissions.IsAdminUser],
methods=['post'],
)
def reset(self, request, **kwargs):
Copy link
Member

@ericholscher ericholscher Mar 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this should be a method on the model instead of the API? We can probably keep it here for now, but I could see other cases where it might be useful to have this functionality.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll move it to the model 👍

@@ -670,6 +670,8 @@ def run_setup(self, record=True):

Return True if successful.
"""
api_v2.build(self.build['id']).reset.post()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems we're calling this on every build? It would be best to run it only in the exception handler, but I'm not 100% sure that code will run properly, so this probably makes sense 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking more, it's probably fine to have it here. There are likely other cases where we want to clear out old build commands (eg. retrying a build if we implement that), so this is probably the most explicit way of handling it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also it would be weird for all commands to disappear till the build is re-triggered. But maybe I can check if the build has any commands build['commands'] before calling the API, let me know if that's better

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we have that data, it would be a good protection. I just worry about us reseting builds that already have important data in them in the future.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I'm not sure if a build with no commands can have other meta-data that could confuse the build

@stsewd stsewd merged commit 3efaa7b into master Mar 18, 2021
@stsewd stsewd deleted the fix-dup-commands branch March 18, 2021 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants