Message ID | 20170614161155.22882-2-kleber.souza@canonical.com |
---|---|
State | New |
Headers | show |
These two patches are actually independent and can be reviewed/applied separately.
On Thu, Jun 15, 2017 at 12:11 AM, Kleber Sacilotto de Souza <kleber.souza@canonical.com> wrote: > When the promote-to-updates tasks is set to invalid, set the workflow to > 'Fix Released' when all the other tasks have been completed. > > Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com> > --- > stable/wfl/wft/promote_to_updates.py | 38 ++++++++++++++++++++++++++++++++++++ > 1 file changed, 38 insertions(+) > > diff --git a/stable/wfl/wft/promote_to_updates.py b/stable/wfl/wft/promote_to_updates.py > index 5903394d..baf986ff 100644 > --- a/stable/wfl/wft/promote_to_updates.py > +++ b/stable/wfl/wft/promote_to_updates.py > @@ -19,6 +19,7 @@ class PromoteToUpdates(Promoter): > s.jumper['In Progress'] = s._verify_promotion > s.jumper['Fix Committed'] = s._verify_promotion > s.jumper['Fix Released'] = s._fix_released > + s.jumper['Invalid'] = s._invalid > > cleave(s.__class__.__name__ + '.__init__') > > @@ -128,4 +129,41 @@ class PromoteToUpdates(Promoter): > cleave(s.__class__.__name__ + '._fix_released (%s)' % retval) > return retval > > + # _invalid > + # > + def _invalid(s): > + """ > + """ > + center(s.__class__.__name__ + '._invalid') > + retval = False > + > + while True: > + if s.bug.packages_released: > + cinfo(' packages have been released, but the task is set to "Invalid"', 'yellow') > + break > + > + if s.bug.sru_workflow_project: > + if s.bug.tasks_by_name['security-signoff'] == "Fix Released": > + if not s.bug.packages_released_to_security: > + cinfo(' the packages have not been released to the security pocket', 'yellow') > + break > + > + if not s._testing_completed(): > + break > + > + # Since this is the one place where the master, project task is set Fix Released it needs to > + # do more than just look at the promote-to-updates. It needs to also look at promote-to-security. > + # > + promote_to_security = s.bug.tasks_by_name['promote-to-security'] > + if promote_to_security.status not in ['Invalid', 'Fix Released']: > + break > + > + s.bug.tasks_by_name[s.bug.workflow_project].status = 'Fix Released' > + msgbody = 'All tasks have been completed and the bug is being set to Fix Released\n' > + s.bug.add_comment('Workflow done!', msgbody) > + break > + > + cleave(s.__class__.__name__ + '._invalid (%s)' % retval) > + return retval The retval will always be False. > + > # vi: set ts=4 sw=4 expandtab syntax=python > -- > 2.11.0 > > > -- > kernel-team mailing list > kernel-team@lists.ubuntu.com > https://lists.ubuntu.com/mailman/listinfo/kernel-team
On 06/15/17 11:28, Po-Hsu Lin (Sam) wrote: > On Thu, Jun 15, 2017 at 12:11 AM, Kleber Sacilotto de Souza > <kleber.souza@canonical.com> wrote: >> When the promote-to-updates tasks is set to invalid, set the workflow to >> 'Fix Released' when all the other tasks have been completed. >> >> Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com> >> --- >> stable/wfl/wft/promote_to_updates.py | 38 ++++++++++++++++++++++++++++++++++++ >> 1 file changed, 38 insertions(+) >> >> diff --git a/stable/wfl/wft/promote_to_updates.py b/stable/wfl/wft/promote_to_updates.py >> index 5903394d..baf986ff 100644 >> --- a/stable/wfl/wft/promote_to_updates.py >> +++ b/stable/wfl/wft/promote_to_updates.py >> @@ -19,6 +19,7 @@ class PromoteToUpdates(Promoter): >> s.jumper['In Progress'] = s._verify_promotion >> s.jumper['Fix Committed'] = s._verify_promotion >> s.jumper['Fix Released'] = s._fix_released >> + s.jumper['Invalid'] = s._invalid >> >> cleave(s.__class__.__name__ + '.__init__') >> >> @@ -128,4 +129,41 @@ class PromoteToUpdates(Promoter): >> cleave(s.__class__.__name__ + '._fix_released (%s)' % retval) >> return retval >> >> + # _invalid >> + # >> + def _invalid(s): >> + """ >> + """ >> + center(s.__class__.__name__ + '._invalid') >> + retval = False >> + >> + while True: >> + if s.bug.packages_released: >> + cinfo(' packages have been released, but the task is set to "Invalid"', 'yellow') >> + break >> + >> + if s.bug.sru_workflow_project: >> + if s.bug.tasks_by_name['security-signoff'] == "Fix Released": >> + if not s.bug.packages_released_to_security: >> + cinfo(' the packages have not been released to the security pocket', 'yellow') >> + break >> + >> + if not s._testing_completed(): >> + break >> + >> + # Since this is the one place where the master, project task is set Fix Released it needs to >> + # do more than just look at the promote-to-updates. It needs to also look at promote-to-security. >> + # >> + promote_to_security = s.bug.tasks_by_name['promote-to-security'] >> + if promote_to_security.status not in ['Invalid', 'Fix Released']: >> + break >> + >> + s.bug.tasks_by_name[s.bug.workflow_project].status = 'Fix Released' >> + msgbody = 'All tasks have been completed and the bug is being set to Fix Released\n' >> + s.bug.add_comment('Workflow done!', msgbody) >> + break >> + >> + cleave(s.__class__.__name__ + '._invalid (%s)' % retval) >> + return retval > > The retval will always be False. Yes, but that's intentional in this case. This new function has the same behavior as PromoteToUpdates._fix_released() which is to always return False. This status returned is used on WorkflowManager.crank() to check if any task status has been changed, if so it will crank the same bug again until no more changes has been done. When the bug workflow is set to 'Fix Released' it is a task change, but in this case we are done with the bug and we don't need another crank round. > >> + >> # vi: set ts=4 sw=4 expandtab syntax=python >> -- >> 2.11.0 >> >> >> -- >> kernel-team mailing list >> kernel-team@lists.ubuntu.com >> https://lists.ubuntu.com/mailman/listinfo/kernel-team
On Wed, Jun 14, 2017 at 06:11:55PM +0200, Kleber Sacilotto de Souza wrote: > When the promote-to-updates tasks is set to invalid, set the workflow to > 'Fix Released' when all the other tasks have been completed. > > Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com> > --- > stable/wfl/wft/promote_to_updates.py | 38 ++++++++++++++++++++++++++++++++++++ > 1 file changed, 38 insertions(+) > > diff --git a/stable/wfl/wft/promote_to_updates.py b/stable/wfl/wft/promote_to_updates.py > index 5903394d..baf986ff 100644 > --- a/stable/wfl/wft/promote_to_updates.py > +++ b/stable/wfl/wft/promote_to_updates.py > @@ -19,6 +19,7 @@ class PromoteToUpdates(Promoter): > s.jumper['In Progress'] = s._verify_promotion > s.jumper['Fix Committed'] = s._verify_promotion > s.jumper['Fix Released'] = s._fix_released > + s.jumper['Invalid'] = s._invalid > > cleave(s.__class__.__name__ + '.__init__') > > @@ -128,4 +129,41 @@ class PromoteToUpdates(Promoter): > cleave(s.__class__.__name__ + '._fix_released (%s)' % retval) > return retval > > + # _invalid > + # > + def _invalid(s): > + """ > + """ > + center(s.__class__.__name__ + '._invalid') > + retval = False > + > + while True: > + if s.bug.packages_released: > + cinfo(' packages have been released, but the task is set to "Invalid"', 'yellow') > + break > + > + if s.bug.sru_workflow_project: > + if s.bug.tasks_by_name['security-signoff'] == "Fix Released": > + if not s.bug.packages_released_to_security: > + cinfo(' the packages have not been released to the security pocket', 'yellow') > + break As the current handling does not handle security-signoff specially we will mark the promote-to-security as Invalid and then complain that we have not copied these out to security if the security-signoff is not set appropriatly. I think this should more properly confirm that the package promote-to-security status matches the in pocket status, present for Fix Released and absent for Invalid. It should also confirm that the security-signoff has been completed. Finally it should confirm that the security-signoff and the status of the promote-to-security are in agreement. If any of that is incorrect we are not done. That also applied of course to _fix_released() equally. So if we also made the same changes to the promote-to-updates status as well then we would have mostly identicle code for the _fix_released and _invalid cases. We could and should then merge them. This all applied gives us the following _complete() callback (used for both Fix Released and Invalid): # _complete # def _complete(s): """ """ center(s.__class__.__name__ + '._complete') retval = False while True: # Check that the promote-to-updates status matches -updates pocket. promote_to_updates = s.bug.tasks_by_name['promote-to-updates'] #if promote_to_updates.status not in ['Invalid', 'Fix Released']: # break if promote_to_updates.status == 'Invalid' and s.bug.packages_released: cinfo(' packages have been released, but the task is set to "Invalid"', 'yellow') break elif promote_to_updates.status == 'Fix Released' and not s.bug.packages_released: cinfo(' packages have not been released, but the task is set to "Fix Released"', 'yellow') break # Since this is the one place where the master, project task is set Fix Released it needs to # do more than just look at the promote-to-updates. It needs to also look at promote-to-security, # confirm the testing is complete and that security signoff is completed. # Confirm we have completed all testing. if not s._testing_completed(): break # Confirm we have a valid security signoff. if not s._security_signoff_verified(): break if s.bug.sru_workflow_project: # Check that the promote-to-security status matches -security pocket. promote_to_security = s.bug.tasks_by_name['promote-to-security'] if promote_to_security.status not in ['Invalid', 'Fix Released']: cinfo(' promote-to-security is neither "Fix Released" nor "Invalid" (%s)' % (s.bug.tasks_by_name['promote-to-security'].status), 'yellow') break if promote_to_security.status == 'Invalid' and s.bug.packages_released_to_security: cinfo(' packages have been released to security, but the task is set to "Invalid"', 'yellow') break elif promote_to_security.status == 'Fix Released' and not s.bug.packages_released_to_security: cinfo(' packages have not been released to security, but the task is set to "Fix Released"', 'yellow') break # Check that the promote-to-security status matches that of the security-signoff. security_signoff = s.bug.tasks_by_name['security-signoff'] if promote_to_security.status != security_signoff.status: cinfo(' package promote-to-security status (%s) does not match security-signoff status (%s)' % (promote_to_security.status, security_signoff.status), 'yellow') break # All is completed so we can finally close out this workflow bug. s.bug.tasks_by_name[s.bug.workflow_project].status = 'Fix Released' if promote_to_updates.status == 'Invalid': msgbody = 'All tasks have been completed and the bug is being set to Fix Released\n' s.bug.add_comment('Workflow done!', msgbody) else: s.bug.phase = 'Released' msgbody = 'The package has been published and the bug is being set to Fix Released\n' s.bug.add_comment('Package Released!', msgbody) break cleave(s.__class__.__name__ + '._complete (%s)' % retval) return retval I propose to test this and apply make it so on top of yours if it passes. -apw
diff --git a/stable/wfl/wft/promote_to_updates.py b/stable/wfl/wft/promote_to_updates.py index 5903394d..baf986ff 100644 --- a/stable/wfl/wft/promote_to_updates.py +++ b/stable/wfl/wft/promote_to_updates.py @@ -19,6 +19,7 @@ class PromoteToUpdates(Promoter): s.jumper['In Progress'] = s._verify_promotion s.jumper['Fix Committed'] = s._verify_promotion s.jumper['Fix Released'] = s._fix_released + s.jumper['Invalid'] = s._invalid cleave(s.__class__.__name__ + '.__init__') @@ -128,4 +129,41 @@ class PromoteToUpdates(Promoter): cleave(s.__class__.__name__ + '._fix_released (%s)' % retval) return retval + # _invalid + # + def _invalid(s): + """ + """ + center(s.__class__.__name__ + '._invalid') + retval = False + + while True: + if s.bug.packages_released: + cinfo(' packages have been released, but the task is set to "Invalid"', 'yellow') + break + + if s.bug.sru_workflow_project: + if s.bug.tasks_by_name['security-signoff'] == "Fix Released": + if not s.bug.packages_released_to_security: + cinfo(' the packages have not been released to the security pocket', 'yellow') + break + + if not s._testing_completed(): + break + + # Since this is the one place where the master, project task is set Fix Released it needs to + # do more than just look at the promote-to-updates. It needs to also look at promote-to-security. + # + promote_to_security = s.bug.tasks_by_name['promote-to-security'] + if promote_to_security.status not in ['Invalid', 'Fix Released']: + break + + s.bug.tasks_by_name[s.bug.workflow_project].status = 'Fix Released' + msgbody = 'All tasks have been completed and the bug is being set to Fix Released\n' + s.bug.add_comment('Workflow done!', msgbody) + break + + cleave(s.__class__.__name__ + '._invalid (%s)' % retval) + return retval + # vi: set ts=4 sw=4 expandtab syntax=python
When the promote-to-updates tasks is set to invalid, set the workflow to 'Fix Released' when all the other tasks have been completed. Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com> --- stable/wfl/wft/promote_to_updates.py | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)