Closed Bug 1097661 Opened 10 years ago Closed 10 years ago

Update ship-it to add the capability to tag a release as shipped or not

Categories

(Release Engineering :: Release Automation, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: Sylvestre, Assigned: Sylvestre)

References

Details

Attachments

(1 file, 4 obsolete files)

Necessary to implement bug 1083718, we need add the information that we shipped a build or not. It is common that we do several builds for a release and not always the last one it used...
Comment on attachment 8521404 [details] [diff] [review] 0001-Bug-1097661-Update-ship-it-to-add-the-capability-to-.patch Review of attachment 8521404 [details] [diff] [review]: ----------------------------------------------------------------- ::: kickoff/__init__.py @@ +56,4 @@ > app.add_url_rule('/releases/<releaseName>/l10n', view_func=ReleaseL10nAPI.as_view('release_l10n_api'), methods=['GET']) > app.add_url_rule('/releases/<releaseName>/status', view_func=StatusAPI.as_view('status_api'), methods=['GET', 'POST']) > app.add_url_rule('/releases/<releaseName>/comment', view_func=ReleaseCommentAPI.as_view('comment_api'), methods=['GET']) > +app.add_url_rule('/releasesShipped/<releaseName>/', view_func=ReleasesShippedAPI.as_view('releases_api'), methods=['GET']) Being shipped or not is an attribute of a release, you shouldn't need a special endpoint for this because we already have /releases/<releaseName>. More on that below. ::: kickoff/model.py @@ +31,4 @@ > enUSPlatforms = db.Column(db.String(500), default=None, nullable=True) > comment = db.Column(db.Text, default=None, nullable=True) > starter = db.Column(db.String(250), nullable=True) > + shipped = db.Column(db.Boolean(), nullable=False, default=False) This is something that should be part of "status" - it doesn't need its own column. IIRC, Zeller and I decided that when a release's status is "postrelease", it can be considered shipped. You could also add a new state if you'd like, though. Doing it this way also means that you don't need any new endpoints - you can POST to existing /releases/<releaseName> endpoint to update the status. If you need to query for only shipped releases, that should be done through /releases, with some code added to filter by shipped or not if it can't already do that. ::: kickoff/templates/includes/releases_reviewed.html @@ +1,2 @@ > +<script type='text/javascript'> > +function updateShip(e) { This needs to be changed in accordance with the above comments, but please also move it to kickoff.js or another external js file to keep things organized. @@ +42,4 @@ > <th>Partial Versions</th> > <th>Update Prompt Wait Time</th> > <th>Comment</th> > + <th>Shipped</th> nit: "Shipped?" would be better here, since it implies boolean.
Attachment #8521404 - Flags: review?(bhearsum) → review-
I tried but I failed. I am trying to use ajax to avoid any useless refresh. However, Ajax + CSRF is only available in flask wtf from version 0.9 (and we use 0.8). http://flask-wtf.readthedocs.org/en/latest/csrf.html The attached patch is implementing: * Use ajax post * points to /releases/<releaseName> instead of /releasesShipped/<releaseName>/ However, it is failing on ReleaseAPIForm.validate because of "CSRF token missing"
Comment on attachment 8525346 [details] [diff] [review] 0001-Bug-1097661-Update-ship-it-to-add-the-capability-to-.patch Review of attachment 8525346 [details] [diff] [review]: ----------------------------------------------------------------- ::: kickoff/templates/includes/releases_reviewed.html @@ +6,5 @@ > +<!-- if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type) && !this.crossDomain) { --> > +<!-- xhr.setRequestHeader("X-CSRFToken", csrftoken) --> > +<!-- } --> > +<!-- } --> > +<!-- }) --> I'm pretty sure that reason this doesn't work is because the csrf token doesn't exist anywhere in this page, so the $() call on line 2 doesn't find anything. You're going to need to store it somewhere when you build this page up. The best bet is probably to add a <form>, and then call hidden_tag like we do for other forms. I'd suggesting avoiding the magic above too -- that's meant to be an app-wide thing. Since this isn't a real AJAX app, that could cause issues with other form submissions. Instead, you can just grab the csrf token inside of updateShip, and pass it in the request body (I think that's the "data" argument). You're also going to need to pass whatever you want the new value of "status" to be, otherwise the submission won't change update anything! @@ +101,5 @@ > {% endif %} > </td> > + <td> > + <div id="divshipped-{{rel.name|replace(".","-")}}" {% if rel.status != "postrelease" %} style="display: none;" {% endif %} >Shipped</div> > + <div id="divnotshipped-{{rel.name|replace(".","-")}}" {% if rel.status == "postrelease" %} style="display: none;" {% endif %}>Not shipped</div> I'm a bit confused about this - why is there two divs? It seems like the "if" block should be before the <div> creation.
Sorry, top stuff was left to show what is recommended by upstream. I removed it in this patch. I will give it a try to your form proposal but I still think that it is overkill/waste of time compared to my initial proposition...
Attachment #8521404 - Attachment is obsolete: true
Attachment #8525346 - Attachment is obsolete: true
Depends on: 1102267
More your taste?
Attachment #8525366 - Attachment is obsolete: true
Attachment #8526141 - Flags: review?(bhearsum)
Comment on attachment 8526141 [details] [diff] [review] 0001-Bug-1097661-Update-ship-it-to-add-the-capability-to-.patch Review of attachment 8526141 [details] [diff] [review]: ----------------------------------------------------------------- Yup, this looks right. I assume you've tested it? ;)
Attachment #8526141 - Flags: review?(bhearsum) → review+
Assignee: nobody → sledru
Moved to "Running/Complete"
Attachment #8526141 - Attachment is obsolete: true
Attachment #8532598 - Flags: review?(bhearsum)
Attachment #8532598 - Flags: review?(bhearsum) → review+
I pushed this to prod this morning.
Depends on: 1111410
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: