Class: Dependabot::Nix::UpdateChecker::ChannelVersionFinder

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/nix/update_checker/channel_version_finder.rb

Overview

Finds the latest NixOS channel and its revision: channels come from the channels.nixos.org S3 listing, revisions from each channel's git-revision marker.

Constant Summary collapse

CHANNELS_BASE_URL =
"https://channels.nixos.org"
CHANNEL_KEY_PATTERN =
%r{<Key>([^<]+)</Key>}
SHA_PATTERN =
/\A[0-9a-f]{40}\z/

Instance Method Summary collapse

Constructor Details

#initialize(current_channel:, credentials:, ignored_versions: [], extension: Channel::DEFAULT_EXTENSION) ⇒ ChannelVersionFinder

Returns a new instance of ChannelVersionFinder.



31
32
33
34
35
36
37
38
# File 'lib/dependabot/nix/update_checker/channel_version_finder.rb', line 31

def initialize(current_channel:, credentials:, ignored_versions: [], extension: Channel::DEFAULT_EXTENSION)
  @current_channel = T.let(Channel.new(current_channel), Channel)
  @credentials = credentials
  @ignored_versions = ignored_versions
  @extension = extension
  @available_channels = T.let(nil, T.nilable(T::Array[String]))
  @ignore_filter = T.let(nil, T.nilable(IgnoreFilter))
end

Instance Method Details

#current_channel_revisionObject



57
58
59
# File 'lib/dependabot/nix/update_checker/channel_version_finder.rb', line 57

def current_channel_revision
  resolve_revision(current_channel.name)
end

#latest_channelObject



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/dependabot/nix/update_checker/channel_version_finder.rb', line 43

def latest_channel
  return unless current_channel.versioned?

  candidate = newest_candidate
  return unless candidate

  rev = resolve_revision(candidate.name)
  return unless rev

  { channel: candidate.name, url: Channel.url_for(candidate.name, extension: extension), commit_sha: rev }
end