summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/ci')
-rw-r--r--lib/gitlab/ci/build/image.rb3
-rw-r--r--lib/gitlab/ci/config/entry/image.rb31
-rw-r--r--lib/gitlab/ci/config/entry/pull_policy.rb34
-rw-r--r--lib/gitlab/ci/config/entry/rules/rule.rb21
-rw-r--r--lib/gitlab/ci/config/entry/rules/rule/changes.rb23
-rw-r--r--lib/gitlab/ci/config/external/file/local.rb4
-rw-r--r--lib/gitlab/ci/config/external/file/project.rb4
-rw-r--r--lib/gitlab/ci/config/external/file/remote.rb4
-rw-r--r--lib/gitlab/ci/config/external/file/template.rb4
-rw-r--r--lib/gitlab/ci/jwt.rb6
-rw-r--r--lib/gitlab/ci/parsers/security/validators/schema_validator.rb10
-rw-r--r--lib/gitlab/ci/pipeline/chain/limit/rate_limit.rb26
-rw-r--r--lib/gitlab/ci/pipeline/chain/validate/external.rb4
-rw-r--r--lib/gitlab/ci/reports/coverage_report.rb (renamed from lib/gitlab/ci/reports/coverage_reports.rb)6
-rw-r--r--lib/gitlab/ci/reports/coverage_report_generator.rb53
-rw-r--r--lib/gitlab/ci/runner_upgrade_check.rb24
-rw-r--r--lib/gitlab/ci/templates/Crystal.gitlab-ci.yml2
-rw-r--r--lib/gitlab/ci/templates/Deploy-ECS.gitlab-ci.yml4
-rw-r--r--lib/gitlab/ci/templates/Django.gitlab-ci.yml2
-rw-r--r--lib/gitlab/ci/templates/Elixir.gitlab-ci.yml2
-rw-r--r--lib/gitlab/ci/templates/Jobs/DAST-Default-Branch-Deploy.gitlab-ci.yml2
-rw-r--r--lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml2
-rw-r--r--lib/gitlab/ci/templates/Jobs/Deploy.latest.gitlab-ci.yml2
-rw-r--r--lib/gitlab/ci/templates/Laravel.gitlab-ci.yml2
-rw-r--r--lib/gitlab/ci/templates/Nodejs.gitlab-ci.yml2
-rw-r--r--lib/gitlab/ci/templates/PHP.gitlab-ci.yml2
-rw-r--r--lib/gitlab/ci/templates/Ruby.gitlab-ci.yml2
-rw-r--r--lib/gitlab/ci/templates/Rust.gitlab-ci.yml2
-rw-r--r--lib/gitlab/ci/templates/Security/Coverage-Fuzzing.gitlab-ci.yml4
-rw-r--r--lib/gitlab/ci/templates/Security/DAST-On-Demand-API-Scan.gitlab-ci.yml12
-rw-r--r--lib/gitlab/ci/templates/Security/DAST.latest.gitlab-ci.yml7
-rw-r--r--lib/gitlab/ci/templates/Security/Secure-Binaries.gitlab-ci.yml8
-rw-r--r--lib/gitlab/ci/templates/Terraform.gitlab-ci.yml2
-rw-r--r--lib/gitlab/ci/templates/Terraform/Base.gitlab-ci.yml2
-rw-r--r--lib/gitlab/ci/trace.rb4
-rw-r--r--lib/gitlab/ci/trace/archive.rb4
36 files changed, 242 insertions, 84 deletions
diff --git a/lib/gitlab/ci/build/image.rb b/lib/gitlab/ci/build/image.rb
index 8ddcf1d523e..7dc375e05eb 100644
--- a/lib/gitlab/ci/build/image.rb
+++ b/lib/gitlab/ci/build/image.rb
@@ -4,7 +4,7 @@ module Gitlab
module Ci
module Build
class Image
- attr_reader :alias, :command, :entrypoint, :name, :ports, :variables
+ attr_reader :alias, :command, :entrypoint, :name, :ports, :variables, :pull_policy
class << self
def from_image(job)
@@ -34,6 +34,7 @@ module Gitlab
@name = image[:name]
@ports = build_ports(image).select(&:valid?)
@variables = build_variables(image)
+ @pull_policy = image[:pull_policy]
end
end
diff --git a/lib/gitlab/ci/config/entry/image.rb b/lib/gitlab/ci/config/entry/image.rb
index 21c42857895..79443f69b03 100644
--- a/lib/gitlab/ci/config/entry/image.rb
+++ b/lib/gitlab/ci/config/entry/image.rb
@@ -12,11 +12,13 @@ module Gitlab
include ::Gitlab::Config::Entry::Attributable
include ::Gitlab::Config::Entry::Configurable
- ALLOWED_KEYS = %i[name entrypoint ports].freeze
+ ALLOWED_KEYS = %i[name entrypoint ports pull_policy].freeze
+ LEGACY_ALLOWED_KEYS = %i[name entrypoint ports].freeze
validations do
validates :config, hash_or_string: true
- validates :config, allowed_keys: ALLOWED_KEYS
+ validates :config, allowed_keys: ALLOWED_KEYS, if: :ci_docker_image_pull_policy_enabled?
+ validates :config, allowed_keys: LEGACY_ALLOWED_KEYS, unless: :ci_docker_image_pull_policy_enabled?
validates :config, disallowed_keys: %i[ports], unless: :with_image_ports?
validates :name, type: String, presence: true
@@ -26,7 +28,10 @@ module Gitlab
entry :ports, Entry::Ports,
description: 'Ports used to expose the image'
- attributes :ports
+ entry :pull_policy, Entry::PullPolicy,
+ description: 'Pull policy for the image'
+
+ attributes :ports, :pull_policy
def name
value[:name]
@@ -37,16 +42,28 @@ module Gitlab
end
def value
- return { name: @config } if string?
- return @config if hash?
-
- {}
+ if string?
+ { name: @config }
+ elsif hash?
+ {
+ name: @config[:name],
+ entrypoint: @config[:entrypoint],
+ ports: ports_value,
+ pull_policy: (ci_docker_image_pull_policy_enabled? ? pull_policy_value : nil)
+ }.compact
+ else
+ {}
+ end
end
def with_image_ports?
opt(:with_image_ports)
end
+ def ci_docker_image_pull_policy_enabled?
+ ::Feature.enabled?(:ci_docker_image_pull_policy)
+ end
+
def skip_config_hash_validation?
true
end
diff --git a/lib/gitlab/ci/config/entry/pull_policy.rb b/lib/gitlab/ci/config/entry/pull_policy.rb
new file mode 100644
index 00000000000..f597134dd2c
--- /dev/null
+++ b/lib/gitlab/ci/config/entry/pull_policy.rb
@@ -0,0 +1,34 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Ci
+ class Config
+ module Entry
+ ##
+ # Entry that represents a configuration of the pull policies of an image.
+ #
+ class PullPolicy < ::Gitlab::Config::Entry::Node
+ include ::Gitlab::Config::Entry::Validatable
+
+ ALLOWED_POLICIES = %w[always never if-not-present].freeze
+
+ validations do
+ validates :config, array_of_strings_or_string: true
+ validates :config,
+ allowed_array_values: { in: ALLOWED_POLICIES },
+ presence: true,
+ if: :array?
+ validates :config,
+ inclusion: { in: ALLOWED_POLICIES },
+ if: :string?
+ end
+
+ def value
+ # We either return an array with policies or nothing
+ Array(@config).presence
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/ci/config/entry/rules/rule.rb b/lib/gitlab/ci/config/entry/rules/rule.rb
index 4722f2e9a61..63bf1b38ac6 100644
--- a/lib/gitlab/ci/config/entry/rules/rule.rb
+++ b/lib/gitlab/ci/config/entry/rules/rule.rb
@@ -9,11 +9,13 @@ module Gitlab
include ::Gitlab::Config::Entry::Configurable
include ::Gitlab::Config::Entry::Attributable
- CLAUSES = %i[if changes exists].freeze
- ALLOWED_KEYS = %i[if changes exists when start_in allow_failure variables].freeze
- ALLOWABLE_WHEN = %w[on_success on_failure always never manual delayed].freeze
+ ALLOWED_KEYS = %i[if changes exists when start_in allow_failure variables].freeze
+ ALLOWED_WHEN = %w[on_success on_failure always never manual delayed].freeze
- attributes :if, :changes, :exists, :when, :start_in, :allow_failure
+ attributes :if, :exists, :when, :start_in, :allow_failure
+
+ entry :changes, Entry::Rules::Rule::Changes,
+ description: 'File change condition rule.'
entry :variables, Entry::Variables,
description: 'Environment variables to define for rule conditions.'
@@ -28,8 +30,8 @@ module Gitlab
with_options allow_nil: true do
validates :if, expression: true
- validates :changes, :exists, array_of_strings: true, length: { maximum: 50 }
- validates :when, allowed_values: { in: ALLOWABLE_WHEN }
+ validates :exists, array_of_strings: true, length: { maximum: 50 }
+ validates :when, allowed_values: { in: ALLOWED_WHEN }
validates :allow_failure, boolean: true
end
@@ -41,6 +43,13 @@ module Gitlab
end
end
+ def value
+ config.merge(
+ changes: (changes_value if changes_defined?),
+ variables: (variables_value if variables_defined?)
+ ).compact
+ end
+
def specifies_delay?
self.when == 'delayed'
end
diff --git a/lib/gitlab/ci/config/entry/rules/rule/changes.rb b/lib/gitlab/ci/config/entry/rules/rule/changes.rb
new file mode 100644
index 00000000000..be57e089f34
--- /dev/null
+++ b/lib/gitlab/ci/config/entry/rules/rule/changes.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Ci
+ class Config
+ module Entry
+ class Rules
+ class Rule
+ class Changes < ::Gitlab::Config::Entry::Node
+ include ::Gitlab::Config::Entry::Validatable
+
+ validations do
+ validates :config,
+ array_of_strings: true,
+ length: { maximum: 50, too_long: "has too many entries (maximum %{count})" }
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/ci/config/external/file/local.rb b/lib/gitlab/ci/config/external/file/local.rb
index feb2cbb19ad..36fc5c656fc 100644
--- a/lib/gitlab/ci/config/external/file/local.rb
+++ b/lib/gitlab/ci/config/external/file/local.rb
@@ -42,7 +42,9 @@ module Gitlab
end
def fetch_local_content
- context.project.repository.blob_data_at(context.sha, location)
+ context.logger.instrument(:config_file_fetch_local_content) do
+ context.project.repository.blob_data_at(context.sha, location)
+ end
rescue GRPC::InvalidArgument
errors.push("Sha #{context.sha} is not valid!")
diff --git a/lib/gitlab/ci/config/external/file/project.rb b/lib/gitlab/ci/config/external/file/project.rb
index 09c36a1bcb6..b7fef081269 100644
--- a/lib/gitlab/ci/config/external/file/project.rb
+++ b/lib/gitlab/ci/config/external/file/project.rb
@@ -65,7 +65,9 @@ module Gitlab
return unless can_access_local_content?
return unless sha
- project.repository.blob_data_at(sha, location)
+ context.logger.instrument(:config_file_fetch_project_content) do
+ project.repository.blob_data_at(sha, location)
+ end
rescue GRPC::NotFound, GRPC::Internal
nil
end
diff --git a/lib/gitlab/ci/config/external/file/remote.rb b/lib/gitlab/ci/config/external/file/remote.rb
index 7d3a2362246..3984bf9e4f8 100644
--- a/lib/gitlab/ci/config/external/file/remote.rb
+++ b/lib/gitlab/ci/config/external/file/remote.rb
@@ -40,7 +40,9 @@ module Gitlab
def fetch_remote_content
begin
- response = Gitlab::HTTP.get(location)
+ response = context.logger.instrument(:config_file_fetch_remote_content) do
+ Gitlab::HTTP.get(location)
+ end
rescue SocketError
errors.push("Remote file `#{masked_location}` could not be fetched because of a socket error!")
rescue Timeout::Error
diff --git a/lib/gitlab/ci/config/external/file/template.rb b/lib/gitlab/ci/config/external/file/template.rb
index 58b81b259cb..5fcf7c71bdf 100644
--- a/lib/gitlab/ci/config/external/file/template.rb
+++ b/lib/gitlab/ci/config/external/file/template.rb
@@ -52,7 +52,9 @@ module Gitlab
end
def fetch_template_content
- Gitlab::Template::GitlabCiYmlTemplate.find(template_name, context.project)&.content
+ context.logger.instrument(:config_file_fetch_template_content) do
+ Gitlab::Template::GitlabCiYmlTemplate.find(template_name, context.project)&.content
+ end
end
def masked_raw
diff --git a/lib/gitlab/ci/jwt.rb b/lib/gitlab/ci/jwt.rb
index 97774bc5e13..19678def666 100644
--- a/lib/gitlab/ci/jwt.rb
+++ b/lib/gitlab/ci/jwt.rb
@@ -73,11 +73,7 @@ module Gitlab
def key
@key ||= begin
- key_data = if Feature.enabled?(:ci_jwt_signing_key, build.project)
- Gitlab::CurrentSettings.ci_jwt_signing_key
- else
- Rails.application.secrets.openid_connect_signing_key
- end
+ key_data = Gitlab::CurrentSettings.ci_jwt_signing_key
raise NoSigningKeyError unless key_data
diff --git a/lib/gitlab/ci/parsers/security/validators/schema_validator.rb b/lib/gitlab/ci/parsers/security/validators/schema_validator.rb
index 4460843545e..ee7733a081d 100644
--- a/lib/gitlab/ci/parsers/security/validators/schema_validator.rb
+++ b/lib/gitlab/ci/parsers/security/validators/schema_validator.rb
@@ -55,14 +55,8 @@ module Gitlab
end
def schema_path
- # We can't exactly error out here pre-15.0.
- # If the report itself doesn't specify the schema version,
- # it will be considered invalid post-15.0 but for now we will
- # validate against earliest supported version.
- # https://gitlab.com/gitlab-org/gitlab/-/issues/335789#note_801479803
- # describes the indended behavior in detail
- # TODO: After 15.0 - pass report_type and report_data here and
- # error out if no version.
+ # The schema version selection logic here is described in the user documentation:
+ # https://docs.gitlab.com/ee/user/application_security/#security-report-validation
report_declared_version = File.join(root_path, report_version, file_name)
return report_declared_version if File.file?(report_declared_version)
diff --git a/lib/gitlab/ci/pipeline/chain/limit/rate_limit.rb b/lib/gitlab/ci/pipeline/chain/limit/rate_limit.rb
index 17ebf56985b..af5cc7fe523 100644
--- a/lib/gitlab/ci/pipeline/chain/limit/rate_limit.rb
+++ b/lib/gitlab/ci/pipeline/chain/limit/rate_limit.rb
@@ -7,10 +7,9 @@ module Gitlab
module Limit
class RateLimit < Chain::Base
include Chain::Helpers
+ include ::Gitlab::Utils::StrongMemoize
def perform!
- return unless throttle_enabled?
-
# We exclude child-pipelines from the rate limit because they represent
# sub-pipelines that would otherwise hit the rate limit due to having the
# same scope (project, user, sha).
@@ -19,7 +18,7 @@ module Gitlab
if rate_limit_throttled?
create_log_entry
- error(throttle_message) unless dry_run?
+ error(throttle_message) if enforce_throttle?
end
end
@@ -43,7 +42,9 @@ module Gitlab
commit_sha: command.sha,
current_user_id: current_user.id,
subscription_plan: project.actual_plan_name,
- message: 'Activated pipeline creation rate limit'
+ message: 'Activated pipeline creation rate limit',
+ throttled: enforce_throttle?,
+ throttle_override: throttle_override?
)
end
@@ -51,16 +52,17 @@ module Gitlab
'Too many pipelines created in the last minute. Try again later.'
end
- def throttle_enabled?
- ::Feature.enabled?(
- :ci_throttle_pipelines_creation,
- project)
+ def enforce_throttle?
+ strong_memoize(:enforce_throttle) do
+ ::Feature.enabled?(:ci_enforce_throttle_pipelines_creation, project) &&
+ !throttle_override?
+ end
end
- def dry_run?
- ::Feature.enabled?(
- :ci_throttle_pipelines_creation_dry_run,
- project)
+ def throttle_override?
+ strong_memoize(:throttle_override) do
+ ::Feature.enabled?(:ci_enforce_throttle_pipelines_creation_override, project)
+ end
end
end
end
diff --git a/lib/gitlab/ci/pipeline/chain/validate/external.rb b/lib/gitlab/ci/pipeline/chain/validate/external.rb
index 85bd5f0a7c1..8177502be1d 100644
--- a/lib/gitlab/ci/pipeline/chain/validate/external.rb
+++ b/lib/gitlab/ci/pipeline/chain/validate/external.rb
@@ -83,7 +83,9 @@ module Gitlab
project: {
id: project.id,
path: project.full_path,
- created_at: project.created_at&.iso8601
+ created_at: project.created_at&.iso8601,
+ shared_runners_enabled: project.shared_runners_enabled?,
+ group_runners_enabled: project.group_runners_enabled?
},
user: {
id: current_user.id,
diff --git a/lib/gitlab/ci/reports/coverage_reports.rb b/lib/gitlab/ci/reports/coverage_report.rb
index 31afb636d2f..cebbb9ae842 100644
--- a/lib/gitlab/ci/reports/coverage_reports.rb
+++ b/lib/gitlab/ci/reports/coverage_report.rb
@@ -3,13 +3,17 @@
module Gitlab
module Ci
module Reports
- class CoverageReports
+ class CoverageReport
attr_reader :files
def initialize
@files = {}
end
+ def empty?
+ @files.empty?
+ end
+
def pick(keys)
coverage_files = files.select do |key|
keys.include?(key)
diff --git a/lib/gitlab/ci/reports/coverage_report_generator.rb b/lib/gitlab/ci/reports/coverage_report_generator.rb
new file mode 100644
index 00000000000..fd73ed6fd25
--- /dev/null
+++ b/lib/gitlab/ci/reports/coverage_report_generator.rb
@@ -0,0 +1,53 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Ci
+ module Reports
+ class CoverageReportGenerator
+ include Gitlab::Utils::StrongMemoize
+
+ def initialize(pipeline)
+ @pipeline = pipeline
+ end
+
+ def report
+ coverage_report = Gitlab::Ci::Reports::CoverageReport.new
+
+ # Return an empty report if the pipeline is a child pipeline.
+ # Since the coverage report is used in a merge request report,
+ # we are only interested in the coverage report from the root pipeline.
+ return coverage_report if @pipeline.child?
+
+ coverage_report.tap do |coverage_report|
+ report_builds.find_each do |build|
+ build.each_report(::Ci::JobArtifact::COVERAGE_REPORT_FILE_TYPES) do |file_type, blob|
+ Gitlab::Ci::Parsers.fabricate!(file_type).parse!(
+ blob,
+ coverage_report,
+ project_path: @pipeline.project.full_path,
+ worktree_paths: @pipeline.all_worktree_paths
+ )
+ end
+ end
+ end
+ end
+
+ private
+
+ def report_builds
+ if child_pipeline_feature_enabled?
+ @pipeline.latest_report_builds_in_self_and_descendants(::Ci::JobArtifact.coverage_reports)
+ else
+ @pipeline.latest_report_builds(::Ci::JobArtifact.coverage_reports)
+ end
+ end
+
+ def child_pipeline_feature_enabled?
+ strong_memoize(:feature_enabled) do
+ Feature.enabled?(:ci_child_pipeline_coverage_reports, @pipeline.project)
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/ci/runner_upgrade_check.rb b/lib/gitlab/ci/runner_upgrade_check.rb
index 46b41ed3c6c..0808290fe5b 100644
--- a/lib/gitlab/ci/runner_upgrade_check.rb
+++ b/lib/gitlab/ci/runner_upgrade_check.rb
@@ -20,15 +20,27 @@ module Gitlab
return :invalid unless runner_version
releases = RunnerReleases.instance.releases
- parsed_runner_version = runner_version.is_a?(::Gitlab::VersionInfo) ? runner_version : ::Gitlab::VersionInfo.parse(runner_version)
+ orig_runner_version = runner_version
+ runner_version = ::Gitlab::VersionInfo.parse(runner_version) unless runner_version.is_a?(::Gitlab::VersionInfo)
- raise ArgumentError, "'#{runner_version}' is not a valid version" unless parsed_runner_version.valid?
+ raise ArgumentError, "'#{orig_runner_version}' is not a valid version" unless runner_version.valid?
- available_releases = releases.reject { |release| release > @gitlab_version }
+ gitlab_minor_version = version_without_patch(@gitlab_version)
- return :recommended if available_releases.any? { |available_release| patch_update?(available_release, parsed_runner_version) }
- return :recommended if outside_backport_window?(parsed_runner_version, releases)
- return :available if available_releases.any? { |available_release| available_release > parsed_runner_version }
+ available_releases = releases
+ .reject { |release| release.major > @gitlab_version.major }
+ .reject do |release|
+ release_minor_version = version_without_patch(release)
+
+ # Do not reject a patch update, even if the runner is ahead of the instance version
+ next false if version_without_patch(runner_version) == release_minor_version
+
+ release_minor_version > gitlab_minor_version
+ end
+
+ return :recommended if available_releases.any? { |available_rel| patch_update?(available_rel, runner_version) }
+ return :recommended if outside_backport_window?(runner_version, releases)
+ return :available if available_releases.any? { |available_rel| available_rel > runner_version }
:not_available
end
diff --git a/lib/gitlab/ci/templates/Crystal.gitlab-ci.yml b/lib/gitlab/ci/templates/Crystal.gitlab-ci.yml
index 856a097e6e0..8886929646d 100644
--- a/lib/gitlab/ci/templates/Crystal.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Crystal.gitlab-ci.yml
@@ -9,7 +9,7 @@ image: "crystallang/crystal:latest"
# Pick zero or more services to be used on all builds.
# Only needed when using a docker container to run your tests in.
-# Check out: http://docs.gitlab.com/ee/ci/docker/using_docker_images.html#what-is-a-service
+# Check out: https://docs.gitlab.com/ee/ci/services/index.html
# services:
# - mysql:latest
# - redis:latest
diff --git a/lib/gitlab/ci/templates/Deploy-ECS.gitlab-ci.yml b/lib/gitlab/ci/templates/Deploy-ECS.gitlab-ci.yml
index c1815baf7e6..ab4c9b701d0 100644
--- a/lib/gitlab/ci/templates/Deploy-ECS.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Deploy-ECS.gitlab-ci.yml
@@ -11,7 +11,7 @@
#
# --------------------
#
-# Documentation: https://docs.gitlab.com/ee/ci/cloud_deployment/#deploy-your-application-to-the-aws-elastic-container-service-ecs
+# Documentation: https://docs.gitlab.com/ee/ci/cloud_deployment/#deploy-your-application-to-ecs
stages:
- build
@@ -23,5 +23,5 @@ stages:
"error: Template has moved":
stage: deploy
script:
- - echo "Deploy-ECS.gitlab-ci.yml has been moved to AWS/Deploy-ECS.gitlab-ci.yml, see https://docs.gitlab.com/ee/ci/cloud_deployment/#deploy-your-application-to-the-aws-elastic-container-service-ecs for more details."
+ - echo "Deploy-ECS.gitlab-ci.yml has been moved to AWS/Deploy-ECS.gitlab-ci.yml, see https://docs.gitlab.com/ee/ci/cloud_deployment/#deploy-your-application-to-ecs for more details."
- exit 1
diff --git a/lib/gitlab/ci/templates/Django.gitlab-ci.yml b/lib/gitlab/ci/templates/Django.gitlab-ci.yml
index 426076c84a1..acc4a9d2917 100644
--- a/lib/gitlab/ci/templates/Django.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Django.gitlab-ci.yml
@@ -41,7 +41,7 @@ default:
#
# Pick zero or more services to be used on all builds.
# Only needed when using a docker container to run your tests in.
- # Check out: http://docs.gitlab.com/ee/ci/docker/using_docker_images.html#what-is-a-service
+ # Check out: https://docs.gitlab.com/ee/ci/services/index.html
services:
- mysql:8.0
#
diff --git a/lib/gitlab/ci/templates/Elixir.gitlab-ci.yml b/lib/gitlab/ci/templates/Elixir.gitlab-ci.yml
index 1ceaf9fc86b..1eb920c7747 100644
--- a/lib/gitlab/ci/templates/Elixir.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Elixir.gitlab-ci.yml
@@ -7,7 +7,7 @@ image: elixir:latest
# Pick zero or more services to be used on all builds.
# Only needed when using a docker container to run your tests in.
-# Check out: http://docs.gitlab.com/ee/ci/docker/using_docker_images.html#what-is-a-service
+# Check out: https://docs.gitlab.com/ee/ci/services/index.html
services:
- mysql:latest
- redis:latest
diff --git a/lib/gitlab/ci/templates/Jobs/DAST-Default-Branch-Deploy.gitlab-ci.yml b/lib/gitlab/ci/templates/Jobs/DAST-Default-Branch-Deploy.gitlab-ci.yml
index 6a6fc2cb702..8f1124373c4 100644
--- a/lib/gitlab/ci/templates/Jobs/DAST-Default-Branch-Deploy.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Jobs/DAST-Default-Branch-Deploy.gitlab-ci.yml
@@ -1,5 +1,5 @@
variables:
- DAST_AUTO_DEPLOY_IMAGE_VERSION: 'v2.28.2'
+ DAST_AUTO_DEPLOY_IMAGE_VERSION: 'v2.30.0'
.dast-auto-deploy:
image: "registry.gitlab.com/gitlab-org/cluster-integration/auto-deploy-image:${DAST_AUTO_DEPLOY_IMAGE_VERSION}"
diff --git a/lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml b/lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml
index 98c4216679f..f9c0d4333ff 100644
--- a/lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml
@@ -1,5 +1,5 @@
variables:
- AUTO_DEPLOY_IMAGE_VERSION: 'v2.28.2'
+ AUTO_DEPLOY_IMAGE_VERSION: 'v2.30.0'
.auto-deploy:
image: "registry.gitlab.com/gitlab-org/cluster-integration/auto-deploy-image:${AUTO_DEPLOY_IMAGE_VERSION}"
diff --git a/lib/gitlab/ci/templates/Jobs/Deploy.latest.gitlab-ci.yml b/lib/gitlab/ci/templates/Jobs/Deploy.latest.gitlab-ci.yml
index 603be5b1cdb..36f1b6981c4 100644
--- a/lib/gitlab/ci/templates/Jobs/Deploy.latest.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Jobs/Deploy.latest.gitlab-ci.yml
@@ -1,5 +1,5 @@
variables:
- AUTO_DEPLOY_IMAGE_VERSION: 'v2.28.2'
+ AUTO_DEPLOY_IMAGE_VERSION: 'v2.30.0'
.auto-deploy:
image: "registry.gitlab.com/gitlab-org/cluster-integration/auto-deploy-image:${AUTO_DEPLOY_IMAGE_VERSION}"
diff --git a/lib/gitlab/ci/templates/Laravel.gitlab-ci.yml b/lib/gitlab/ci/templates/Laravel.gitlab-ci.yml
index ff7bac15017..0ec67526234 100644
--- a/lib/gitlab/ci/templates/Laravel.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Laravel.gitlab-ci.yml
@@ -9,7 +9,7 @@ image: php:latest
# Pick zero or more services to be used on all builds.
# Only needed when using a docker container to run your tests in.
-# Check out: http://docs.gitlab.com/ee/ci/docker/using_docker_images.html#what-is-a-service
+# Check out: https://docs.gitlab.com/ee/ci/services/index.html
services:
- mysql:latest
diff --git a/lib/gitlab/ci/templates/Nodejs.gitlab-ci.yml b/lib/gitlab/ci/templates/Nodejs.gitlab-ci.yml
index 16bc0026aa8..44370f896a7 100644
--- a/lib/gitlab/ci/templates/Nodejs.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Nodejs.gitlab-ci.yml
@@ -9,7 +9,7 @@ image: node:latest
# Pick zero or more services to be used on all builds.
# Only needed when using a docker container to run your tests in.
-# Check out: http://docs.gitlab.com/ee/ci/docker/using_docker_images.html#what-is-a-service
+# Check out: https://docs.gitlab.com/ee/ci/services/index.html
services:
- mysql:latest
- redis:latest
diff --git a/lib/gitlab/ci/templates/PHP.gitlab-ci.yml b/lib/gitlab/ci/templates/PHP.gitlab-ci.yml
index 281bf7e3dd9..4edc003a638 100644
--- a/lib/gitlab/ci/templates/PHP.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/PHP.gitlab-ci.yml
@@ -23,7 +23,7 @@ before_script:
- curl -sS https://getcomposer.org/installer | php
- php composer.phar install
-# Bring in any services we need http://docs.gitlab.com/ee/ci/docker/using_docker_images.html#what-is-a-service
+# Bring in any services we need https://docs.gitlab.com/ee/ci/services/index.html
# See http://docs.gitlab.com/ee/ci/services/README.html for examples.
services:
- mysql:5.7
diff --git a/lib/gitlab/ci/templates/Ruby.gitlab-ci.yml b/lib/gitlab/ci/templates/Ruby.gitlab-ci.yml
index 44f959468a8..690a5a291e1 100644
--- a/lib/gitlab/ci/templates/Ruby.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Ruby.gitlab-ci.yml
@@ -9,7 +9,7 @@ image: ruby:latest
# Pick zero or more services to be used on all builds.
# Only needed when using a docker container to run your tests in.
-# Check out: http://docs.gitlab.com/ee/ci/docker/using_docker_images.html#what-is-a-service
+# Check out: https://docs.gitlab.com/ee/ci/services/index.html
services:
- mysql:latest
- redis:latest
diff --git a/lib/gitlab/ci/templates/Rust.gitlab-ci.yml b/lib/gitlab/ci/templates/Rust.gitlab-ci.yml
index 869c1782352..390f0bb8061 100644
--- a/lib/gitlab/ci/templates/Rust.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Rust.gitlab-ci.yml
@@ -9,7 +9,7 @@ image: "rust:latest"
# Optional: Pick zero or more services to be used on all builds.
# Only needed when using a docker container to run your tests in.
-# Check out: http://docs.gitlab.com/ee/ci/docker/using_docker_images.html#what-is-a-service
+# Check out: https://docs.gitlab.com/ee/ci/services/index.html
# services:
# - mysql:latest
# - redis:latest
diff --git a/lib/gitlab/ci/templates/Security/Coverage-Fuzzing.gitlab-ci.yml b/lib/gitlab/ci/templates/Security/Coverage-Fuzzing.gitlab-ci.yml
index f7f016b5e57..d4b6a252b25 100644
--- a/lib/gitlab/ci/templates/Security/Coverage-Fuzzing.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Security/Coverage-Fuzzing.gitlab-ci.yml
@@ -12,8 +12,8 @@ variables:
# Which branch we want to run full fledged long running fuzzing jobs.
# All others will run fuzzing regression
COVFUZZ_BRANCH: "$CI_DEFAULT_BRANCH"
- # This is using semantic version and will always download latest v2 gitlab-cov-fuzz release
- COVFUZZ_VERSION: v2
+ # This is using semantic version and will always download latest v3 gitlab-cov-fuzz release
+ COVFUZZ_VERSION: v3
# This is for users who have an offline environment and will have to replicate gitlab-cov-fuzz release binaries
# to their own servers
COVFUZZ_URL_PREFIX: "https://gitlab.com/gitlab-org/security-products/analyzers/gitlab-cov-fuzz/-/raw"
diff --git a/lib/gitlab/ci/templates/Security/DAST-On-Demand-API-Scan.gitlab-ci.yml b/lib/gitlab/ci/templates/Security/DAST-On-Demand-API-Scan.gitlab-ci.yml
index 3f9c87b7abf..4a72f5e72b1 100644
--- a/lib/gitlab/ci/templates/Security/DAST-On-Demand-API-Scan.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Security/DAST-On-Demand-API-Scan.gitlab-ci.yml
@@ -1,3 +1,8 @@
+# To contribute improvements to CI/CD templates, please follow the Development guide at:
+# https://docs.gitlab.com/ee/development/cicd/templates.html
+# This specific template is located at:
+# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Security/DAST-On-Demand-API-Scan.gitlab-ci.yml
+
stages:
- build
- test
@@ -6,12 +11,13 @@ stages:
variables:
SECURE_ANALYZERS_PREFIX: "registry.gitlab.com/security-products"
- DAST_API_VERSION: "1"
- DAST_API_IMAGE: $SECURE_ANALYZERS_PREFIX/api-fuzzing:$DAST_API_VERSION
+ DAST_API_VERSION: "2"
+ DAST_API_IMAGE_SUFFIX: ""
+ DAST_API_IMAGE: api-security
dast:
stage: dast
- image: $DAST_API_IMAGE
+ image: $SECURE_ANALYZERS_PREFIX/$DAST_API_IMAGE:$DAST_API_VERSION$DAST_API_IMAGE_SUFFIX
allow_failure: true
script:
- /peach/analyzer-dast-api
diff --git a/lib/gitlab/ci/templates/Security/DAST.latest.gitlab-ci.yml b/lib/gitlab/ci/templates/Security/DAST.latest.gitlab-ci.yml
index e5ac5099546..10549b56856 100644
--- a/lib/gitlab/ci/templates/Security/DAST.latest.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Security/DAST.latest.gitlab-ci.yml
@@ -48,13 +48,10 @@ dast:
$CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
when: never
- if: $CI_DEFAULT_BRANCH != $CI_COMMIT_REF_NAME &&
- $REVIEW_DISABLED && $DAST_WEBSITE == null &&
- $DAST_API_SPECIFICATION == null
+ $REVIEW_DISABLED
when: never
- if: $CI_COMMIT_BRANCH &&
($CI_KUBERNETES_ACTIVE || $KUBECONFIG) &&
$GITLAB_FEATURES =~ /\bdast\b/
- if: $CI_COMMIT_BRANCH &&
- $DAST_WEBSITE
- - if: $CI_COMMIT_BRANCH &&
- $DAST_API_SPECIFICATION
+ $GITLAB_FEATURES =~ /\bdast\b/
diff --git a/lib/gitlab/ci/templates/Security/Secure-Binaries.gitlab-ci.yml b/lib/gitlab/ci/templates/Security/Secure-Binaries.gitlab-ci.yml
index b34bfe2a53c..c414e70bfa3 100644
--- a/lib/gitlab/ci/templates/Security/Secure-Binaries.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Security/Secure-Binaries.gitlab-ci.yml
@@ -20,7 +20,7 @@ variables:
SECURE_BINARIES_ANALYZERS: >-
bandit, brakeman, gosec, spotbugs, flawfinder, phpcs-security-audit, security-code-scan, nodejs-scan, eslint, secrets, sobelow, pmd-apex, kics, kubesec, semgrep, gemnasium, gemnasium-maven, gemnasium-python,
license-finder,
- dast, dast-runner-validation, api-fuzzing
+ dast, dast-runner-validation, api-security
SECURE_BINARIES_DOWNLOAD_IMAGES: "true"
SECURE_BINARIES_PUSH_IMAGES: "true"
@@ -252,11 +252,11 @@ dast-runner-validation:
- $SECURE_BINARIES_DOWNLOAD_IMAGES == "true" &&
$SECURE_BINARIES_ANALYZERS =~ /\bdast-runner-validation\b/
-api-fuzzing:
+api-security:
extends: .download_images
variables:
- SECURE_BINARIES_ANALYZER_VERSION: "1"
+ SECURE_BINARIES_ANALYZER_VERSION: "2"
only:
variables:
- $SECURE_BINARIES_DOWNLOAD_IMAGES == "true" &&
- $SECURE_BINARIES_ANALYZERS =~ /\bapi-fuzzing\b/
+ $SECURE_BINARIES_ANALYZERS =~ /\bapi-security\b/
diff --git a/lib/gitlab/ci/templates/Terraform.gitlab-ci.yml b/lib/gitlab/ci/templates/Terraform.gitlab-ci.yml
index 56151a6bcdf..4d0259fe678 100644
--- a/lib/gitlab/ci/templates/Terraform.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Terraform.gitlab-ci.yml
@@ -1,7 +1,7 @@
# To contribute improvements to CI/CD templates, please follow the Development guide at:
# https://docs.gitlab.com/ee/development/cicd/templates.html
# This specific template is located at:
-# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Terraform.latest.gitlab-ci.yml
+# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Terraform.gitlab-ci.yml
include:
- template: Terraform/Base.gitlab-ci.yml # https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/Terraform/Base.gitlab-ci.yml
diff --git a/lib/gitlab/ci/templates/Terraform/Base.gitlab-ci.yml b/lib/gitlab/ci/templates/Terraform/Base.gitlab-ci.yml
index 49bdd4b7713..6f9a9c5133c 100644
--- a/lib/gitlab/ci/templates/Terraform/Base.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Terraform/Base.gitlab-ci.yml
@@ -4,7 +4,7 @@
# they are able to only include the jobs that they find interesting.
#
# Therefore, this template is not supposed to run any jobs. The idea is to only
-# create hidden jobs. See: https://docs.gitlab.com/ee/ci/yaml/#hide-jobs
+# create hidden jobs. See: https://docs.gitlab.com/ee/ci/jobs/#hide-jobs
#
# There is a more opinionated template which we suggest the users to abide,
# which is the lib/gitlab/ci/templates/Terraform.gitlab-ci.yml
diff --git a/lib/gitlab/ci/trace.rb b/lib/gitlab/ci/trace.rb
index e93bd75a9fa..95a60b852b8 100644
--- a/lib/gitlab/ci/trace.rb
+++ b/lib/gitlab/ci/trace.rb
@@ -74,14 +74,14 @@ module Gitlab
end
def exist?
- archived? || live_trace_exist?
+ archived? || live?
end
def archived?
trace_artifact&.stored?
end
- def live_trace_exist?
+ def live?
job.trace_chunks.any? || current_path.present? || old_trace.present?
end
diff --git a/lib/gitlab/ci/trace/archive.rb b/lib/gitlab/ci/trace/archive.rb
index d4a451ca526..0cd8df2e2af 100644
--- a/lib/gitlab/ci/trace/archive.rb
+++ b/lib/gitlab/ci/trace/archive.rb
@@ -15,7 +15,7 @@ module Gitlab
def execute!(stream)
clone_file!(stream, JobArtifactUploader.workhorse_upload_path) do |clone_path|
- md5_checksum = self.class.md5_hexdigest(clone_path)
+ md5_checksum = self.class.md5_hexdigest(clone_path) unless Gitlab::FIPS.enabled?
sha256_checksum = self.class.sha256_hexdigest(clone_path)
job.transaction do
@@ -24,7 +24,7 @@ module Gitlab
end
end
- validate_archived_trace
+ validate_archived_trace unless Gitlab::FIPS.enabled?
end
private