Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-06 15:10:44 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-06 15:10:44 +0300
commitba174c982f40d71a87fd511b091753807174f7e7 (patch)
treeb89d55c715288f2c2f76724c1b7ff4a6ebf90154 /lib/gitlab/ci
parenteaea945e0355826c58c3dcf887496ea91064f85c (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/ci')
-rw-r--r--lib/gitlab/ci/config/entry/include.rb5
-rw-r--r--lib/gitlab/ci/templates/Security/DAST.gitlab-ci.yml20
-rw-r--r--lib/gitlab/ci/yaml_processor.rb50
3 files changed, 19 insertions, 56 deletions
diff --git a/lib/gitlab/ci/config/entry/include.rb b/lib/gitlab/ci/config/entry/include.rb
index b2586714636..cd09d83b728 100644
--- a/lib/gitlab/ci/config/entry/include.rb
+++ b/lib/gitlab/ci/config/entry/include.rb
@@ -15,11 +15,6 @@ module Gitlab
validations do
validates :config, hash_or_string: true
validates :config, allowed_keys: ALLOWED_KEYS
- validate do
- if config[:artifact] && config[:job].blank?
- errors.add(:config, "must specify the job where to fetch the artifact from")
- end
- end
end
end
end
diff --git a/lib/gitlab/ci/templates/Security/DAST.gitlab-ci.yml b/lib/gitlab/ci/templates/Security/DAST.gitlab-ci.yml
index 020d1f323ee..10ef33e71d5 100644
--- a/lib/gitlab/ci/templates/Security/DAST.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Security/DAST.gitlab-ci.yml
@@ -1,7 +1,7 @@
# Read more about this feature here: https://docs.gitlab.com/ee/user/application_security/dast/
# Configure the scanning tool through the environment variables.
-# List of the variables: https://gitlab.com/gitlab-org/security-products/dast#settings
+# List of the variables: https://docs.gitlab.com/ee/user/application_security/dast/#available-variables
# How to set: https://docs.gitlab.com/ee/ci/yaml/#variables
stages:
@@ -19,26 +19,10 @@ dast:
name: "registry.gitlab.com/gitlab-org/security-products/dast:$DAST_VERSION"
variables:
GIT_STRATEGY: none
- # URL to scan:
- # DAST_WEBSITE: https://example.com/
- #
- # Time limit for target availability (scan is attempted even when timeout):
- # DAST_TARGET_AVAILABILITY_TIMEOUT: 60
- #
- # Set these variables to scan with an authenticated user:
- # DAST_AUTH_URL: https://example.com/sign-in
- # DAST_USERNAME: john.doe@example.com
- # DAST_PASSWORD: john-doe-password
- # DAST_USERNAME_FIELD: session[user] # the name of username field at the sign-in HTML form
- # DAST_PASSWORD_FIELD: session[password] # the name of password field at the sign-in HTML form
- # DAST_AUTH_EXCLUDE_URLS: http://example.com/sign-out,http://example.com/sign-out-2 # optional: URLs to skip during the authenticated scan; comma-separated, no spaces in between
- #
- # Perform ZAP Full Scan, which includes both passive and active scanning:
- # DAST_FULL_SCAN_ENABLED: "true"
allow_failure: true
script:
- export DAST_WEBSITE=${DAST_WEBSITE:-$(cat environment_url.txt)}
- - /analyze -t $DAST_WEBSITE
+ - /analyze
artifacts:
reports:
dast: gl-dast-report.json
diff --git a/lib/gitlab/ci/yaml_processor.rb b/lib/gitlab/ci/yaml_processor.rb
index 4b0062549f0..764047dae6d 100644
--- a/lib/gitlab/ci/yaml_processor.rb
+++ b/lib/gitlab/ci/yaml_processor.rb
@@ -142,7 +142,6 @@ module Gitlab
validate_job_stage!(name, job)
validate_job_dependencies!(name, job)
validate_job_needs!(name, job)
- validate_dynamic_child_pipeline_dependencies!(name, job)
validate_job_environment!(name, job)
end
end
@@ -164,50 +163,35 @@ module Gitlab
def validate_job_dependencies!(name, job)
return unless job[:dependencies]
- job[:dependencies].each do |dependency|
- validate_job_dependency!(name, dependency)
- end
- end
+ stage_index = @stages.index(job[:stage])
- def validate_dynamic_child_pipeline_dependencies!(name, job)
- return unless includes = job.dig(:trigger, :include)
+ job[:dependencies].each do |dependency|
+ raise ValidationError, "#{name} job: undefined dependency: #{dependency}" unless @jobs[dependency.to_sym]
- includes.each do |included|
- next unless dependency = included[:job]
+ dependency_stage_index = @stages.index(@jobs[dependency.to_sym][:stage])
- validate_job_dependency!(name, dependency)
+ unless dependency_stage_index.present? && dependency_stage_index < stage_index
+ raise ValidationError, "#{name} job: dependency #{dependency} is not defined in prior stages"
+ end
end
end
def validate_job_needs!(name, job)
- return unless needs = job.dig(:needs, :job)
+ return unless job.dig(:needs, :job)
- needs.each do |need|
- dependency = need[:name]
- validate_job_dependency!(name, dependency, 'need')
- end
- end
+ stage_index = @stages.index(job[:stage])
- def validate_job_dependency!(name, dependency, dependency_type = 'dependency')
- unless @jobs[dependency.to_sym]
- raise ValidationError, "#{name} job: undefined #{dependency_type}: #{dependency}"
- end
+ job.dig(:needs, :job).each do |need|
+ need_job_name = need[:name]
- job_stage_index = stage_index(name)
- dependency_stage_index = stage_index(dependency)
+ raise ValidationError, "#{name} job: undefined need: #{need_job_name}" unless @jobs[need_job_name.to_sym]
- # A dependency might be defined later in the configuration
- # with a stage that does not exist
- unless dependency_stage_index.present? && dependency_stage_index < job_stage_index
- raise ValidationError, "#{name} job: #{dependency_type} #{dependency} is not defined in prior stages"
- end
- end
+ needs_stage_index = @stages.index(@jobs[need_job_name.to_sym][:stage])
- def stage_index(name)
- job = @jobs[name.to_sym]
- return unless job
-
- @stages.index(job[:stage])
+ unless needs_stage_index.present? && needs_stage_index < stage_index
+ raise ValidationError, "#{name} job: need #{need_job_name} is not defined in prior stages"
+ end
+ end
end
def validate_job_environment!(name, job)