Class: Gitlab::Checks::TagCheck

Inherits:
BaseSingleChecker show all
Defined in:
lib/gitlab/checks/tag_check.rb

Constant Summary collapse

ERROR_MESSAGES =
{
  change_existing_tags: 'You are not allowed to change existing tags on this project.',
  update_protected_tag: 'Protected tags cannot be updated.',
  delete_protected_tag: 'You are not allowed to delete protected tags from this project. ' \
                        'Only a project maintainer or owner can delete a protected tag.',
  delete_protected_tag_non_web: 'You can only delete protected tags using the web interface.',
  create_protected_tag: 'You are not allowed to create this tag as it is protected.',
  default_branch_collision: 'You cannot use default branch name to create a tag',
  prohibited_tag_name: 'You cannot create a tag with a prohibited pattern.',
  prohibited_sha_tag_name: 'You cannot create a tag with a SHA-1 or SHA-256 tag name.',
  prohibited_tag_name_encoding: 'Tag names must be valid when converted to UTF-8 encoding'
}.freeze
LOG_MESSAGES =
{
  tag_checks: "Checking if you are allowed to change existing tags...",
  default_branch_collision_check: "Checking if you are providing a valid tag name...",
  protected_tag_checks: "Checking if you are creating, updating or deleting a protected tag..."
}.freeze
STARTS_WITH_SHA_REGEX =
%r{\A#{Gitlab::Git::Commit::RAW_FULL_SHA_PATTERN}}o

Instance Attribute Summary

Attributes inherited from BaseSingleChecker

#change_access

Instance Method Summary collapse

Methods inherited from BaseSingleChecker

#initialize

Constructor Details

This class inherits a constructor from Gitlab::Checks::BaseSingleChecker

Instance Method Details

#validate!Object



27
28
29
30
31
32
33
34
# File 'lib/gitlab/checks/tag_check.rb', line 27

def validate!
  return unless tag_name

  logger.log_timed(LOG_MESSAGES[:tag_checks]) { tag_checks }
  logger.log_timed(LOG_MESSAGES[:default_branch_collision_check]) { default_branch_collision_check }
  prohibited_tag_checks
  logger.log_timed(LOG_MESSAGES[:protected_tag_checks]) { protected_tag_checks }
end