# GOV.UK Mini Environment Admin # Copyright © 2018 Christopher Baines # # This file is part of the GOV.UK Mini Environment Admin. # # The GOV.UK Mini Environment Admin is free software: you can # redistribute it and/or modify it under the terms of the GNU Affero # General Public License as published by the Free Software Foundation, # either version 3 of the License, or (at your option) any later # version. # # The GOV.UK Mini Environment Admin is distributed in the hope that it # will be useful, but WITHOUT ANY WARRANTY; without even the implied # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public # License along with the GOV.UK Mini Environment Admin. If not, see # . class GovukGuix::RevisionsController < ApplicationController def show @revision = GovukGuix::Revision.find(params['id']) end def destroy @revision = GovukGuix::Revision.find(params['id']) @revision.update(archived: true) flash[:info] = "Archived #{@revision.commit_hash}..." render :show end def enqueue_fetch_revision revision = params.require('revision') # Attempt to check if this can be performed locally if Guix.available_locally? options = {} else # Assume that the AWS backend is in use backend = Backends::TerraformAws.first options = { backend_type_and_id: backend.type_and_id } end GovukGuix::FetchRevisionJob.enqueue(revision, options) flash[:info] = "Fetching govuk-guix revision (#{revision})..." redirect_to setup_path end end