summaryrefslogtreecommitdiff
path: root/app/controllers/projects/images_controller.rb
blob: 5b10746aa0db64bdb5760fcabb54ee26968b95e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class Projects::ImagesController < Projects::ApplicationController
  before_action :authorize_read_image!
  before_action :authorize_update_image!, only: [:destroy]
  before_action :tag, except: [:index]
  layout 'project'

  def index
    @tags = registry.tags
  end

  def destroy
    # registry.destroy_tag(tag['fsLayers'].first['blobSum'])
    registry.destroy_tag(registry.tag_digest(params[:id]))
    redirect_to namespace_project_images_path(project.namespace, project)
  end

  private

  def registry
    @registry ||= project.registry
  end

  def tag
    @tag ||= registry.tag(params[:id])
  end
end