Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
1c635e68ea
commit
c592490e7f
|
|
@ -1276,12 +1276,6 @@ module Ci
|
|||
self.builds.latest.build_matchers(project)
|
||||
end
|
||||
|
||||
def predefined_vars_in_builder_enabled?
|
||||
strong_memoize(:predefined_vars_in_builder_enabled) do
|
||||
Feature.enabled?(:ci_predefined_vars_in_builder, project, default_enabled: :yaml)
|
||||
end
|
||||
end
|
||||
|
||||
def authorized_cluster_agents
|
||||
strong_memoize(:authorized_cluster_agents) do
|
||||
::Clusters::AgentAuthorizationsFinder.new(project).execute.map(&:agent)
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ module Ci
|
|||
track_duration do
|
||||
variables = pipeline.variables_builder.scoped_variables(self, environment: environment, dependencies: dependencies)
|
||||
|
||||
variables.concat(predefined_variables) unless pipeline.predefined_vars_in_builder_enabled?
|
||||
variables.concat(project.predefined_variables)
|
||||
variables.concat(pipeline.predefined_variables)
|
||||
variables.concat(runner.predefined_variables) if runnable? && runner
|
||||
|
|
@ -71,24 +70,6 @@ module Ci
|
|||
end
|
||||
end
|
||||
|
||||
def predefined_variables
|
||||
Gitlab::Ci::Variables::Collection.new.tap do |variables|
|
||||
variables.append(key: 'CI_JOB_NAME', value: name)
|
||||
variables.append(key: 'CI_JOB_STAGE', value: stage)
|
||||
variables.append(key: 'CI_JOB_MANUAL', value: 'true') if action?
|
||||
variables.append(key: 'CI_PIPELINE_TRIGGERED', value: 'true') if trigger_request
|
||||
|
||||
variables.append(key: 'CI_NODE_INDEX', value: self.options[:instance].to_s) if self.options&.include?(:instance)
|
||||
variables.append(key: 'CI_NODE_TOTAL', value: ci_node_total_value.to_s)
|
||||
|
||||
# legacy variables
|
||||
variables.append(key: 'CI_BUILD_NAME', value: name)
|
||||
variables.append(key: 'CI_BUILD_STAGE', value: stage)
|
||||
variables.append(key: 'CI_BUILD_TRIGGERED', value: 'true') if trigger_request
|
||||
variables.append(key: 'CI_BUILD_MANUAL', value: 'true') if action?
|
||||
end
|
||||
end
|
||||
|
||||
def kubernetes_variables
|
||||
::Gitlab::Ci::Variables::Collection.new.tap do |collection|
|
||||
# Should get merged with the cluster kubeconfig in deployment_variables, see
|
||||
|
|
@ -123,13 +104,5 @@ module Ci
|
|||
def secret_project_variables(environment: expanded_environment_name)
|
||||
project.ci_variables_for(ref: git_ref, environment: environment)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def ci_node_total_value
|
||||
parallel = self.options&.dig(:parallel)
|
||||
parallel = parallel.dig(:total) if parallel.is_a?(Hash)
|
||||
parallel || 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
name: ci_predefined_vars_in_builder
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/72348
|
||||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/231300
|
||||
milestone: '14.4'
|
||||
type: development
|
||||
group: group::pipeline authoring
|
||||
default_enabled: false
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
name: limited_diff_highlighting
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/53768
|
||||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/323566
|
||||
milestone: '13.12'
|
||||
type: development
|
||||
group: group::source code
|
||||
default_enabled: true
|
||||
|
|
@ -3653,7 +3653,8 @@ variable defined, the [job-level variable takes precedence](../variables/index.m
|
|||
|
||||
**Possible inputs**: Variable name and value pairs:
|
||||
|
||||
- The name can use only numbers, letters, and underscores (`_`).
|
||||
- The name can use only numbers, letters, and underscores (`_`). In some shells,
|
||||
the first character must be a letter.
|
||||
- The value must be a string.
|
||||
|
||||
**Examples of `variables`:**
|
||||
|
|
|
|||
|
|
@ -510,12 +510,12 @@ See [`db/post_migrate/20210604070207_retry_backfill_traversal_ids.rb`](https://g
|
|||
|
||||
### Viewing failure error logs
|
||||
|
||||
After running a background migration, if any jobs have failed, you can view the logs in [Kibana](https://log.gprd.gitlab.net/goto/3afc1393447c401d7602c1874793e2f6).
|
||||
After running a background migration, if any jobs have failed, you can view the logs in [Kibana](https://log.gprd.gitlab.net/goto/5f06a57f768c6025e1c65aefb4075694).
|
||||
View the production Sidekiq log and filter for:
|
||||
|
||||
- `json.class: BackgroundMigrationWorker`
|
||||
- `json.job_status: fail`
|
||||
- `json.args: <MyBackgroundMigrationClassName>`
|
||||
- `json.meta.caller_id: <MyBackgroundMigrationClassName>`
|
||||
|
||||
Looking at the `json.error_class`, `json.error_message` and `json.error_backtrace` values may be helpful in understanding why the jobs failed.
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ module Gitlab
|
|||
|
||||
def scoped_variables(job, environment:, dependencies:)
|
||||
Gitlab::Ci::Variables::Collection.new.tap do |variables|
|
||||
variables.concat(predefined_variables(job)) if pipeline.predefined_vars_in_builder_enabled?
|
||||
variables.concat(predefined_variables(job))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -159,7 +159,6 @@ module Gitlab
|
|||
end
|
||||
|
||||
def blobs_too_large?
|
||||
return false unless Feature.enabled?(:limited_diff_highlighting, project, default_enabled: :yaml)
|
||||
return true if Gitlab::Highlight.too_large?(diff_file.old_blob&.size)
|
||||
|
||||
Gitlab::Highlight.too_large?(diff_file.new_blob&.size)
|
||||
|
|
|
|||
|
|
@ -24,15 +24,5 @@ RSpec.describe Gitlab::Ci::Variables::Builder do
|
|||
expect(names).to include(*keys)
|
||||
end
|
||||
end
|
||||
|
||||
context 'feature flag disabled' do
|
||||
before do
|
||||
stub_feature_flags(ci_predefined_vars_in_builder: false)
|
||||
end
|
||||
|
||||
it 'returns no variables' do
|
||||
expect(subject.map { |env| env[:key] }).to be_empty
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -151,20 +151,6 @@ RSpec.describe Gitlab::Diff::Highlight do
|
|||
expect(subject[2].rich_text).to eq(%Q{ <span id="LC7" class="line" lang=""> def popen(cmd, path=nil)</span>\n})
|
||||
expect(subject[2].rich_text).to be_html_safe
|
||||
end
|
||||
|
||||
context 'when limited_diff_highlighting is disabled' do
|
||||
before do
|
||||
stub_feature_flags(limited_diff_highlighting: false)
|
||||
stub_feature_flags(diff_line_syntax_highlighting: false)
|
||||
end
|
||||
|
||||
it 'blobs are highlighted as plain text with loading all data' do
|
||||
expect(diff_file.blob).to receive(:load_all_data!).twice
|
||||
|
||||
code = %Q{ <span id="LC7" class="line" lang=""> def popen(cmd, path=nil)</span>\n}
|
||||
expect(subject[2].rich_text).to eq(code)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3421,10 +3421,6 @@ RSpec.describe Ci::Build do
|
|||
end
|
||||
|
||||
describe '#scoped_variables' do
|
||||
before do
|
||||
pipeline.clear_memoization(:predefined_vars_in_builder_enabled)
|
||||
end
|
||||
|
||||
it 'records a prometheus metric' do
|
||||
histogram = double(:histogram)
|
||||
expect(::Gitlab::Ci::Pipeline::Metrics).to receive(:pipeline_builder_scoped_variables_histogram)
|
||||
|
|
@ -3522,22 +3518,6 @@ RSpec.describe Ci::Build do
|
|||
|
||||
build.scoped_variables
|
||||
end
|
||||
|
||||
context 'when ci builder feature flag is disabled' do
|
||||
before do
|
||||
stub_feature_flags(ci_predefined_vars_in_builder: false)
|
||||
end
|
||||
|
||||
it 'does not delegate to the variable builders' do
|
||||
expect_next_instance_of(Gitlab::Ci::Variables::Builder) do |builder|
|
||||
expect(builder).not_to receive(:predefined_variables)
|
||||
end
|
||||
|
||||
build.scoped_variables
|
||||
end
|
||||
|
||||
it_behaves_like 'calculates scoped_variables'
|
||||
end
|
||||
end
|
||||
|
||||
describe '#simple_variables_without_dependencies' do
|
||||
|
|
|
|||
Loading…
Reference in New Issue