def register(deployed=nil)
      # Describe the version we're currently running.
      if deployed
        existing = Ecs.describe_task_definition(deployed)
          .fetch("taskDefinition")
      else
        existing = nil
      end

      # Register the new version.  We always need to do this, so that we
      # can compare two officially normalized versions of the same task,
      # including any fields added by Amazon.
      new = register_new.fetch("taskDefinition")

      # Decide whether we can re-use the existing registration.
      if existing && Compare.task_definitions_match?(existing, new) && !force?
        rev1 = "#{existing.fetch('family')}:#{existing.fetch('revision')}"
        rev2 = "#{new.fetch('family')}:#{new.fetch('revision')}"
        puts "Running copy of #{rev1} looks good; not updating to #{rev2}."
        Plugins.plugins.each {|p| p.notify_skipping_deploy(existing, new) }
        wanted = existing
      else
        wanted = new
      end
      "#{wanted.fetch('family')}:#{wanted.fetch('revision')}"
    end
def register(deployed=nil)
      # Describe the version we're currently running.
      if deployed
        existing = Ecs.describe_task_definition(deployed)
          .fetch("taskDefinition")
      else
        existing = nil
      end

      # Register the new version.  We always need to do this, so that we
      # can compare two officially normalized versions of the same task,
      # including any fields added by Amazon.
      new = register_new.fetch("taskDefinition")

      # Decide whether we can re-use the existing registration.
      if existing && Compare.task_definitions_match?(existing, new) && !force?
        rev1 = "#{existing.fetch('family')}:#{existing.fetch('revision')}"
        rev2 = "#{new.fetch('family')}:#{new.fetch('revision')}"
        puts "Running copy of #{rev1} looks good; not updating to #{rev2}."
        Plugins.plugins.each {|p| p.notify_skipping_deploy(existing, new) }
        wanted = existing
      else
        wanted = new
      end
      "#{wanted.fetch('family')}:#{wanted.fetch('revision')}"
    end
Create a new TaskDefinition.  The type should be either `:task` or
 `:service`, the name should be both the name of the ECS task
 definition and the corresponding ECS service (if any), and the YAML
 should be `docker-compose`-format YAML describing the containers
 associated with this task.
 Register this task definition with ECS if it isn't already
 registered.  Will create the task definition if it doesn't exist, and
 add a new version of the task.  Returns a string of the form
 `"name:revision"` identifying the task we registered, or an existing
 task with the same properties.