lib/release_tools/release_metadata.rb
# Adds the version data for all components included in a GitLab auto-deploy.
#
# The `mapping` argument is a `Hash` that maps component version files (e.g.
# `VERSION`) to the corresponding version identifiers for that component.
# For example:
#
#     { 'GITALY_SERVER_VERSION' => '456abc' }
# rubocop: disable Metrics/MethodLength
Adds the version data for all components included in a GitLab auto-deploy.
The `mapping` argument is a `Hash` that maps component version files  to the corresponding version identifiers for that component.
For example.

{ 'GITALY_SERVER_VERSION' => '456abc' }
rubocop: disable Metrics/MethodLength
Adds the version data for all components included in a GitLab auto - deploy . The ` mapping ` argument is a ` Hash ` that maps component version files to the corresponding version identifiers for that component . For example . { ' GITALY_SERVER_VERSION ' = > ' 456abc ' } rubocop : disable Metrics / MethodLength
def add_auto_deploy_components(mapping)
      mapping.each do |version_file, version|
        next if IGNORED_AUTO_DEPLOY_COMPONENTS.include?(version_file)
        project = AUTO_DEPLOY_COMPONENTS[version_file]
        name =
          if project
            project.project_name
          else
            version_file.downcase.gsub('_version', '')
          end
        next if tracked?(name)
        normalized_version = version.start_with?('v') ? version[1..-1] : version
        tag = false
        ref = DEFAULT_COMPONENT_REF
        sha = nil
        valid_major_minor = version.match?(TAG_REGEX)
        if project && valid_major_minor
          tag = true
          ref = "v#{normalized_version}"
          sha = sha_of_tag(project, ref)
        elsif valid_major_minor
        elsif version.length == 40
          sha = version
        else
          raise ArgumentError, "The #{version_file} version #{version} is not supported"
        end
        add_release(
          name: name,
          version: normalized_version,
          sha: sha,
          ref: ref,
          tag: tag
        )
      end
    end
def add_auto_deploy_components ( mapping ) mapping . each do | version_file , version | next if IGNORED_AUTO_DEPLOY_COMPONENTS . include? ( version_file ) project = AUTO_DEPLOY_COMPONENTS [ version_file ] name = if project project . project_name else version_file . downcase . gsub ( '_version' , '' ) end next if tracked? ( name ) normalized_version = version . start_with? ( 'v' ) ? version [ 1 .. - 1 ] : version tag = false ref = DEFAULT_COMPONENT_REF sha = nil valid_major_minor = version . match? ( TAG_REGEX ) if project && valid_major_minor tag = true ref = "v#{normalized_version}" sha = sha_of_tag ( project , ref ) elsif valid_major_minor elsif version . length == 40 sha = version else raise ArgumentError , "The #{version_file} version #{version} is not supported" end add_release ( name : name , version : normalized_version , sha : sha , ref : ref , tag : tag ) end end
Adds the version data for all components included in a GitLab auto-deploy.
Adds the version data for all components included in a GitLab auto - deploy .
# If the component is not explicitly known we still want to track # it. In this case we normalise the name, and just take the input # version data as-is. # We ignore already tracked releases. This makes it easier for our # release code to add releases, without having to worry about # overwriting already existing data. # The version format is valid, but there is no project; just take the # version as-is. # Our SHAs are always 40 characters long, so we can just check for the # length instead of using a regular expression.
mapping