403Webshell
Server IP : 188.151.22.197  /  Your IP : 216.73.217.74
Web Server : Apache/2.4.62 (Rocky Linux) OpenSSL/3.5.5
System : Linux wsten.se 5.14.0-687.30.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Jul 27 13:09:21 UTC 2026 x86_64
User : apache ( 48)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /opt/gitlab/embedded/service/gitlab-rails/scripts/setup/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/gitlab/embedded/service/gitlab-rails/scripts/setup/gitaly_version_checker.rb
# frozen_string_literal: true

class GitalyVersionChecker
  # parse_gitlab_version parses the content of the VERSION
  # file and return the GitLab version
  def parse_gitlab_version(content)
    # Extract only the semver part (MAJOR.MINOR.PATCH)
    # And strip everything else (ex: `-pre` suffix)
    stripped_content = content.strip
    semver = stripped_content[/^(\d+\.\d+\.\d+)/, 1]

    abort "No valid semantic version found in: '#{content}'" unless semver

    Gem::Version.new(semver)
  end

  # parse_gitaly_version parses the content of the
  # Gemfile.lock file and returns the Gitaly version
  # used in the Gemfile.
  def parse_gitaly_version(content)
    # Find the gitaly gem entry in Gemfile.lock
    # Format: "    gitaly (18.8.1)"
    match = content.match(/^\s{4}gitaly \(([^)]+)\)/)

    if match
      Gem::Version.new(match[1])
    else
      abort "Gitaly gem not found in Gemfile.lock"
    end
  rescue ArgumentError => e
    abort "Invalid Gitaly version format: #{e.message}"
  end

  def version_allowed?(gitlab_version, gitaly_version)
    gitlab_segments = gitlab_version.segments
    gitaly_segments = gitaly_version.segments

    gitlab_major = gitlab_segments[0]
    gitlab_minor = gitlab_segments[1]

    gitaly_major = gitaly_segments[0]
    gitaly_minor = gitaly_segments[1]

    # Gitaly must be at least 1 minor version behind GitLab
    # This means Gitaly's minor version must be strictly less than GitLab's minor version
    # (assuming same major version)
    if gitaly_major != gitlab_major
      # Different major versions - Gitaly should not be ahead
      gitaly_major < gitlab_major
    else
      # Same major version - Gitaly minor must be strictly less than GitLab minor
      gitaly_minor < gitlab_minor
    end
  end
end

Youez - 2016 - github.com/yon3zu
LinuXploit