Class: Gitlab::Ci::Pipeline::Chain::Validate::Repository

Inherits:
Base
  • Object
show all
Includes:
Helpers
Defined in:
lib/gitlab/ci/pipeline/chain/validate/repository.rb

Instance Attribute Summary

Attributes inherited from Base

#command, #config, #pipeline

Instance Method Summary collapse

Methods included from Helpers

#error, #persist_pipeline?, #warning

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Gitlab::Ci::Pipeline::Chain::Base

Instance Method Details

#break?Boolean

Returns:

  • (Boolean)

25
26
27
# File 'lib/gitlab/ci/pipeline/chain/validate/repository.rb', line 25

def break?
  @pipeline.errors.any?
end

#perform!Object


11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/gitlab/ci/pipeline/chain/validate/repository.rb', line 11

def perform!
  unless @command.branch_exists? || @command.tag_exists? || @command.merge_request_ref_exists?
    return error('Reference not found')
  end

  unless @command.sha
    return error('Commit not found')
  end

  if @command.ambiguous_ref?
    error('Ref is ambiguous')
  end
end