2016-05-08 16:50:30 -04:00
|
|
|
class Projects::ContainerRegistryController < Projects::ApplicationController
|
2016-05-18 13:28:48 -04:00
|
|
|
before_action :verify_registry_enabled
|
2016-05-14 19:26:26 -04:00
|
|
|
before_action :authorize_read_container_image!
|
|
|
|
before_action :authorize_update_container_image!, only: [:destroy]
|
2016-05-08 16:50:30 -04:00
|
|
|
layout 'project'
|
|
|
|
|
|
|
|
def index
|
2016-05-09 15:14:46 -04:00
|
|
|
@tags = container_registry_repository.tags
|
2016-05-08 16:50:30 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
2016-05-18 12:22:28 -04:00
|
|
|
url = namespace_project_container_registry_index_path(project.namespace, project)
|
|
|
|
|
2016-05-08 16:50:30 -04:00
|
|
|
if tag.delete
|
2016-05-18 12:22:28 -04:00
|
|
|
redirect_to url
|
2016-05-08 16:50:30 -04:00
|
|
|
else
|
2016-05-18 12:22:28 -04:00
|
|
|
redirect_to url, alert: 'Failed to remove tag'
|
2016-05-08 16:50:30 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2016-05-18 13:28:48 -04:00
|
|
|
def verify_registry_enabled
|
|
|
|
render_404 unless Gitlab.config.registry.enabled
|
|
|
|
end
|
|
|
|
|
2016-05-09 15:14:46 -04:00
|
|
|
def container_registry_repository
|
|
|
|
@container_registry_repository ||= project.container_registry_repository
|
2016-05-08 16:50:30 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def tag
|
2016-05-17 14:20:11 -04:00
|
|
|
@tag ||= container_registry_repository.tag(params[:id])
|
2016-05-08 16:50:30 -04:00
|
|
|
end
|
|
|
|
end
|