Sha256: 86011ba28660f30885af9ad68d24ffd3384ad1e5f10e715837e0cfe663039d81

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

module Hatchet
  # used for deploying a test app to heroku via git
  class GitApp < App
    def git_repo
      "https://git.heroku.com/#{name}.git"
    end


    def push_without_retry!
      output = ""

      ShellThrottle.new(platform_api: @platform_api).call do
        output = git_push_heroku_yall
      rescue FailedDeploy => e
        if e.output.match?(/reached the API rate limit/)
          throw(:throttle)
        elsif @allow_failure
          output = e.output
        else
          raise e
        end
      end

      return output
    end

    private def git_push_heroku_yall
      output = `git push #{git_repo} HEAD:main 2>&1`

      if !$?.success?
        raise FailedDeployError.new(self, "Buildpack: #{@buildpack.inspect}\nRepo: #{git_repo}", output: output)
      end

      releases = platform_api.release.list(name)
      if releases.last["status"] == "failed"
        commit! # An empty commit allows us to deploy again
        raise FailedReleaseError.new(self, "Buildpack: #{@buildpack.inspect}\nRepo: #{git_repo}", output: output)
      end

      return output
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
heroku_hatchet-7.2.0 lib/hatchet/git_app.rb
heroku_hatchet-7.1.3 lib/hatchet/git_app.rb
heroku_hatchet-7.1.2 lib/hatchet/git_app.rb