diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-16 06:10:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-16 06:10:06 +0300 |
commit | 2a3313dc5ec97ba732681fe034de900215807ac3 (patch) | |
tree | 13ace5400ca9f0638b547af9ab2f1e896f79331b | |
parent | 9b99f2a0a3cfb4266a738ce61c7ee72cf05c0d09 (diff) |
Add latest changes from gitlab-org/gitlab@master
-rw-r--r-- | app/models/ci/processable.rb | 6 | ||||
-rw-r--r-- | app/presenters/ci/build_runner_presenter.rb | 6 | ||||
-rw-r--r-- | app/views/ci/variables/_index.html.haml | 2 | ||||
-rw-r--r-- | config/feature_flags/development/preload_associations_jobs_request_api_endpoint.yml | 8 | ||||
-rw-r--r-- | doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md | 9 | ||||
-rw-r--r-- | doc/ci/variables/index.md | 55 | ||||
-rw-r--r-- | spec/requests/api/ci/runner/jobs_request_post_spec.rb | 28 |
7 files changed, 39 insertions, 75 deletions
diff --git a/app/models/ci/processable.rb b/app/models/ci/processable.rb index e2f257eab25..30d335fd7d5 100644 --- a/app/models/ci/processable.rb +++ b/app/models/ci/processable.rb @@ -169,11 +169,7 @@ module Ci end def all_dependencies - if Feature.enabled?(:preload_associations_jobs_request_api_endpoint, project, default_enabled: :yaml) - strong_memoize(:all_dependencies) do - dependencies.all - end - else + strong_memoize(:all_dependencies) do dependencies.all end end diff --git a/app/presenters/ci/build_runner_presenter.rb b/app/presenters/ci/build_runner_presenter.rb index 52f4a4e71a1..0baee614568 100644 --- a/app/presenters/ci/build_runner_presenter.rb +++ b/app/presenters/ci/build_runner_presenter.rb @@ -58,11 +58,7 @@ module Ci # rubocop: disable CodeReuse/ActiveRecord def all_dependencies dependencies = super - - if Feature.enabled?(:preload_associations_jobs_request_api_endpoint, project, default_enabled: :yaml) - ActiveRecord::Associations::Preloader.new.preload(dependencies, :job_artifacts_archive) - end - + ActiveRecord::Associations::Preloader.new.preload(dependencies, :job_artifacts_archive) dependencies end # rubocop: enable CodeReuse/ActiveRecord diff --git a/app/views/ci/variables/_index.html.haml b/app/views/ci/variables/_index.html.haml index 216852b567d..cdfc174ebf1 100644 --- a/app/views/ci/variables/_index.html.haml +++ b/app/views/ci/variables/_index.html.haml @@ -16,7 +16,7 @@ aws_tip_deploy_link: help_page_path('ci/cloud_deployment/index.md', anchor: 'deploy-your-application-to-the-aws-elastic-container-service-ecs'), aws_tip_commands_link: help_page_path('ci/cloud_deployment/index.md', anchor: 'run-aws-commands-from-gitlab-cicd'), aws_tip_learn_link: help_page_path('ci/cloud_deployment/index.md', anchor: 'aws'), - contains_variable_reference_link: help_page_path('ci/variables/index', anchor: 'troubleshooting-variables-containing-references'), + contains_variable_reference_link: help_page_path('ci/variables/index', anchor: 'use-variables-or-in-other-variables'), protected_environment_variables_link: help_page_path('ci/variables/index', anchor: 'protect-a-cicd-variable'), masked_environment_variables_link: help_page_path('ci/variables/index', anchor: 'mask-a-cicd-variable'), } } diff --git a/config/feature_flags/development/preload_associations_jobs_request_api_endpoint.yml b/config/feature_flags/development/preload_associations_jobs_request_api_endpoint.yml deleted file mode 100644 index cafe1485658..00000000000 --- a/config/feature_flags/development/preload_associations_jobs_request_api_endpoint.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: preload_associations_jobs_request_api_endpoint -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/57694 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/326477 -milestone: "13.11" -type: development -group: group::pipeline execution -default_enabled: true diff --git a/doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md b/doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md index aa60c1e4b51..9fccc280677 100644 --- a/doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md +++ b/doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md @@ -557,10 +557,17 @@ end ### Skip reconfirmation ```ruby -user = User.find_by_username '<username>' +user = User.find_by_username('<username>') user.skip_reconfirmation! ``` +### Disable 2fa for single user + +```ruby +user = User.find_by_username('<username>') +user.disable_two_factor! +``` + ### Active users & Historical users ```ruby diff --git a/doc/ci/variables/index.md b/doc/ci/variables/index.md index fe7e5519b4a..d4865390d0d 100644 --- a/doc/ci/variables/index.md +++ b/doc/ci/variables/index.md @@ -112,20 +112,33 @@ job1: - echo This job does not need any variables ``` -You can use variables to help define other variables. Use `$$` to ignore a variable -name inside another variable: +Use the [`value` and `description`](../yaml/index.md#prefill-variables-in-manual-pipelines) +keywords to define [variables that are prefilled](../pipelines/index.md#prefill-variables-in-manual-pipelines) +for [manually-triggered pipelines](../pipelines/index.md#run-a-pipeline-manually). + +### Use variables or `$` in other variables + +You can use variables inside other variables: ```yaml -variables: - FLAGS: '-al' - LS_CMD: 'ls "$FLAGS" $$TMP_DIR' -script: - - 'eval "$LS_CMD"' # Executes 'ls -al $TMP_DIR' +job: + variables: + FLAGS: '-al' + LS_CMD: 'ls "$FLAGS"' + script: + - 'eval "$LS_CMD"' # Executes 'ls -al' ``` -Use the [`value` and `description`](../yaml/index.md#prefill-variables-in-manual-pipelines) -keywords to define [variables that are prefilled](../pipelines/index.md#prefill-variables-in-manual-pipelines) -for [manually-triggered pipelines](../pipelines/index.md#run-a-pipeline-manually). +If you do not want the `$` interpreted as the start of a variable, use `$$` instead: + +```yaml +job: + variables: + FLAGS: '-al' + LS_CMD: 'ls "$FLAGS" $$TMP_DIR' + script: + - 'eval "$LS_CMD"' # Executes 'ls -al $TMP_DIR' +``` ### Add a CI/CD variable to a project @@ -374,26 +387,6 @@ WARNING: When you store credentials, there are [security implications](#cicd-variable-security). If you use AWS keys for example, follow the [Best practices for managing AWS access keys](https://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html). -### Troubleshooting variables containing references - -When a variable value contains a reference indicated by `$`, it may be expanded -which can lead to unexpected values. Use `$$` to ignore a variable name inside -another variable: - -```plaintext -SOME$$VALUE -``` - -Another workaround is to add a new variable set to the one that contains a -reference: - -```yaml -variables: - NEWVAR: $MYVAR -script: - - echo $NEWVAR # outputs SOME$VALUE -``` - ## Use CI/CD variables in job scripts All CI/CD variables are set as environment variables in the job's environment. @@ -427,7 +420,7 @@ job_name: ``` In [some cases](https://gitlab.com/gitlab-org/gitlab-runner/-/issues/4115#note_157692820) -environment variables might need to be surrounded by quotes to expand properly: +environment variables must be surrounded by quotes to expand properly: ```yaml job_name: diff --git a/spec/requests/api/ci/runner/jobs_request_post_spec.rb b/spec/requests/api/ci/runner/jobs_request_post_spec.rb index 00c3a0a31af..adac81ff6f4 100644 --- a/spec/requests/api/ci/runner/jobs_request_post_spec.rb +++ b/spec/requests/api/ci/runner/jobs_request_post_spec.rb @@ -506,32 +506,12 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do end describe 'preloading job_artifacts_archive' do - context 'when the feature flag is disabled' do - before do - stub_feature_flags(preload_associations_jobs_request_api_endpoint: false) - end - - it 'queries the ci_job_artifacts table multiple times' do - expect { request_job }.to exceed_all_query_limit(1).for_model(::Ci::JobArtifact) - end - - it 'queries the ci_builds table more than three times' do - expect { request_job }.to exceed_all_query_limit(3).for_model(::Ci::Build) - end + it 'queries the ci_job_artifacts table once only' do + expect { request_job }.not_to exceed_all_query_limit(1).for_model(::Ci::JobArtifact) end - context 'when the feature flag is enabled' do - before do - stub_feature_flags(preload_associations_jobs_request_api_endpoint: true) - end - - it 'queries the ci_job_artifacts table once only' do - expect { request_job }.not_to exceed_all_query_limit(1).for_model(::Ci::JobArtifact) - end - - it 'queries the ci_builds table five times' do - expect { request_job }.not_to exceed_all_query_limit(5).for_model(::Ci::Build) - end + it 'queries the ci_builds table five times' do + expect { request_job }.not_to exceed_all_query_limit(5).for_model(::Ci::Build) end end end |