• BAIRE Anthony's avatar
    derive docker tags names from WebappVersion.id · b7b30d3e
    BAIRE Anthony authored
    With this change docker images are no longer
    named as: <Webapp.docker_name>:<WebappVersion.number>
    but       <Webapp.docker_name>:id</WebappVersion.id>
    
    This is only for storage, for the user we still present the image as
    <Webapp.docker_name>:<WebappVersion.number>
    
    There are multiple reasons to do that:
    - this simplifies the controller design, because docker images are no
      longer replaced (once an image is committed with tag, 'id<SOMETHING>'
      it won't be modified anymore) -> thus it is no longer necessary to
      track the image state carefully (when pushing/pulling from/to the
      registry)
    - this prevent reusing dangling images from a removed webapp (because we
      now have a strong guarantee that the image tags are unique)
    - this will avoid nasty race conditions when we implement direct 'push'
      to the registry (because we then assign the new image id before the
      manifest is actually pushed, if a push and commit are done in the same
      time we will keep the latest one, i.e. with the highest id)
    - this will make easy to implement image recovery: we can keep removed
      images in the registry for some time (eg: 1 month) before they are
      really deleted
    
    Note: the REPLACED state is no longer transient (since we now keep the
    replaced images in the db and since we may still have remaining
    job/sandboxes using them). Maybe we can rename it as DELETED when we
    implement #265.
    b7b30d3e
controller.py 75.5 KB