diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-07 03:09:32 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-07 03:09:32 +0000 |
commit | 4d8bd36aa2674c7c64b1d5bac4d898e3c8263d44 (patch) | |
tree | 67d0d1b0fd7afa57682d52a49398040b95a425c0 | |
parent | 7dc324669696d50d39cdf62e824f492375f7f5dd (diff) | |
download | gitlab-ce-4d8bd36aa2674c7c64b1d5bac4d898e3c8263d44.tar.gz |
Add latest changes from gitlab-org/gitlab@master
23 files changed, 359 insertions, 36 deletions
diff --git a/app/assets/javascripts/ide/components/commit_sidebar/actions.vue b/app/assets/javascripts/ide/components/commit_sidebar/actions.vue index 6c563776533..407e4c57cd8 100644 --- a/app/assets/javascripts/ide/components/commit_sidebar/actions.vue +++ b/app/assets/javascripts/ide/components/commit_sidebar/actions.vue @@ -70,7 +70,7 @@ export default { </script> <template> - <div class="append-bottom-15 ide-commit-options"> + <div class="gl-mb-5 ide-commit-options"> <radio-group :value="$options.commitToCurrentBranch" :disabled="!canPushToBranch" diff --git a/app/assets/javascripts/ide/components/commit_sidebar/list_collapsed.vue b/app/assets/javascripts/ide/components/commit_sidebar/list_collapsed.vue index b6fc567f8cc..03304337839 100644 --- a/app/assets/javascripts/ide/components/commit_sidebar/list_collapsed.vue +++ b/app/assets/javascripts/ide/components/commit_sidebar/list_collapsed.vue @@ -75,7 +75,7 @@ export default { :title="titleTooltip" data-container="body" data-placement="left" - class="append-bottom-15" + class="gl-mb-5" > <icon v-once :name="iconName" :size="18" /> </div> diff --git a/app/assets/javascripts/persistent_user_callouts.js b/app/assets/javascripts/persistent_user_callouts.js index 8dfbfea9b09..f4fe605f0a2 100644 --- a/app/assets/javascripts/persistent_user_callouts.js +++ b/app/assets/javascripts/persistent_user_callouts.js @@ -6,6 +6,7 @@ const PERSISTENT_USER_CALLOUTS = [ '.js-admin-licensed-user-count-threshold', '.js-buy-pipeline-minutes-notification-callout', '.js-alerts-moved-alert', + '.js-token-expiry-callout', ]; const initCallouts = () => { diff --git a/app/assets/javascripts/pipelines/pipeline_details_bundle.js b/app/assets/javascripts/pipelines/pipeline_details_bundle.js index f9370e8ca1c..9be0f9ae949 100644 --- a/app/assets/javascripts/pipelines/pipeline_details_bundle.js +++ b/app/assets/javascripts/pipelines/pipeline_details_bundle.js @@ -116,17 +116,23 @@ const createPipelinesTabs = testReportsStore => { } }; -const createTestDetails = (fullReportEndpoint, summaryEndpoint) => { +const createTestDetails = () => { if (!window.gon?.features?.junitPipelineView) { return; } - const testReportsStore = createTestReportsStore({ fullReportEndpoint, summaryEndpoint }); + const el = document.querySelector('#js-pipeline-tests-detail'); + const { fullReportEndpoint, countEndpoint } = el?.dataset || {}; + + const testReportsStore = createTestReportsStore({ + fullReportEndpoint, + summaryEndpoint: countEndpoint, + }); createPipelinesTabs(testReportsStore); // eslint-disable-next-line no-new new Vue({ - el: '#js-pipeline-tests-detail', + el, components: { TestReports, }, @@ -170,6 +176,6 @@ export default () => { createPipelinesDetailApp(mediator); createPipelineHeaderApp(mediator); - createTestDetails(dataset.testReportEndpoint, dataset.testReportsCountEndpoint); + createTestDetails(); createDagApp(); }; diff --git a/app/assets/stylesheets/framework/common.scss b/app/assets/stylesheets/framework/common.scss index 2c17af8d4ae..cb15e939eab 100644 --- a/app/assets/stylesheets/framework/common.scss +++ b/app/assets/stylesheets/framework/common.scss @@ -411,7 +411,6 @@ img.emoji { .append-right-default { margin-right: $gl-padding; } .append-right-20 { margin-right: 20px; } .append-bottom-10 { margin-bottom: 10px; } -.append-bottom-15 { margin-bottom: 15px; } .append-bottom-20 { margin-bottom: 20px; } .ml-10 { margin-left: 4.5rem; } .inline { display: inline-block; } diff --git a/app/models/user_callout_enums.rb b/app/models/user_callout_enums.rb index f36a955f4de..c5dfd678021 100644 --- a/app/models/user_callout_enums.rb +++ b/app/models/user_callout_enums.rb @@ -18,7 +18,8 @@ module UserCalloutEnums tabs_position_highlight: 10, webhooks_moved: 13, admin_integrations_moved: 15, - alerts_moved: 20 + alerts_moved: 20, + personal_access_token_expiry: 21 # EE-only } end end diff --git a/app/views/layouts/_page.html.haml b/app/views/layouts/_page.html.haml index d1cf83b2a9f..72b88fa8f7f 100644 --- a/app/views/layouts/_page.html.haml +++ b/app/views/layouts/_page.html.haml @@ -7,6 +7,7 @@ = render 'shared/outdated_browser' = render_if_exists 'layouts/header/users_over_license_banner' = render_if_exists "layouts/header/licensed_user_count_threshold" + = render_if_exists "layouts/header/token_expiry_notification" = render "layouts/broadcast" = render "layouts/header/read_only_banner" = render "layouts/nav/classification_level_banner" diff --git a/app/views/projects/pipelines/_with_tabs.html.haml b/app/views/projects/pipelines/_with_tabs.html.haml index 07b3adfcb29..875cff9c27c 100644 --- a/app/views/projects/pipelines/_with_tabs.html.haml +++ b/app/views/projects/pipelines/_with_tabs.html.haml @@ -86,5 +86,5 @@ #js-pipeline-dag-vue{ data: { pipeline_data_path: dag_project_pipeline_path(@project, @pipeline), empty_svg_path: image_path('illustrations/empty-state/empty-dag-md.svg'), dag_doc_path: help_page_path('ci/yaml/README.md', anchor: 'needs')} } #js-tab-tests.tab-pane - #js-pipeline-tests-detail + #js-pipeline-tests-detail{ data: { full_report_endpoint: test_report_project_pipeline_path(@project, @pipeline, format: :json), count_endpoint: test_reports_count_project_pipeline_path(@project, @pipeline, format: :json) } } = render_if_exists "projects/pipelines/tabs_content", pipeline: @pipeline, project: @project diff --git a/app/views/projects/pipelines/show.html.haml b/app/views/projects/pipelines/show.html.haml index f39968eecef..2b2133b8296 100644 --- a/app/views/projects/pipelines/show.html.haml +++ b/app/views/projects/pipelines/show.html.haml @@ -20,6 +20,4 @@ - else = render "projects/pipelines/with_tabs", pipeline: @pipeline -.js-pipeline-details-vue{ data: { endpoint: project_pipeline_path(@project, @pipeline, format: :json), - test_report_endpoint: test_report_project_pipeline_path(@project, @pipeline, format: :json), - test_reports_count_endpoint: test_reports_count_project_pipeline_path(@project, @pipeline, format: :json) } } +.js-pipeline-details-vue{ data: { endpoint: project_pipeline_path(@project, @pipeline, format: :json) } } diff --git a/changelogs/unreleased/218841-extend-ecs-for-fargate.yml b/changelogs/unreleased/218841-extend-ecs-for-fargate.yml new file mode 100644 index 00000000000..04975ee3f1e --- /dev/null +++ b/changelogs/unreleased/218841-extend-ecs-for-fargate.yml @@ -0,0 +1,5 @@ +--- +title: Extend ECS Deploy template with Fargate jobs +merge_request: 35173 +author: +type: added diff --git a/config/initializers/1_postgresql_only.rb b/config/initializers/1_postgresql_only.rb index be771bebf47..415fc6f2cae 100644 --- a/config/initializers/1_postgresql_only.rb +++ b/config/initializers/1_postgresql_only.rb @@ -2,3 +2,5 @@ raise "PostgreSQL is the only supported database from GitLab 12.1" unless Gitlab::Database.postgresql? + +Gitlab::Database.check_postgres_version_and_print_warning diff --git a/db/migrate/20200630110826_add_documents_count_target_to_elastic_reindexing_tasks.rb b/db/migrate/20200630110826_add_documents_count_target_to_elastic_reindexing_tasks.rb new file mode 100644 index 00000000000..dcb4ccc857d --- /dev/null +++ b/db/migrate/20200630110826_add_documents_count_target_to_elastic_reindexing_tasks.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddDocumentsCountTargetToElasticReindexingTasks < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :elastic_reindexing_tasks, :documents_count_target, :integer + end +end diff --git a/db/post_migrate/20200609002841_add_partial_index_on_locked_state_id_to_merge_requests.rb b/db/post_migrate/20200609002841_add_partial_index_on_locked_state_id_to_merge_requests.rb index 076c8fd8715..7602ad00796 100644 --- a/db/post_migrate/20200609002841_add_partial_index_on_locked_state_id_to_merge_requests.rb +++ b/db/post_migrate/20200609002841_add_partial_index_on_locked_state_id_to_merge_requests.rb @@ -14,6 +14,6 @@ class AddPartialIndexOnLockedStateIdToMergeRequests < ActiveRecord::Migration[6. end def down - remove_concurrent_index_by_name :merge_requests, name: INDEX_NAME + remove_concurrent_index_by_name :merge_requests, INDEX_NAME end end diff --git a/db/structure.sql b/db/structure.sql index bb5dcbbe68c..2f03335a7fa 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -11104,6 +11104,7 @@ CREATE TABLE public.elastic_reindexing_tasks ( index_name_to text, elastic_task text, error_message text, + documents_count_target integer, CONSTRAINT check_04151aca42 CHECK ((char_length(index_name_from) <= 255)), CONSTRAINT check_7f64acda8e CHECK ((char_length(error_message) <= 255)), CONSTRAINT check_85ebff7124 CHECK ((char_length(index_name_to) <= 255)), @@ -23569,6 +23570,7 @@ COPY "schema_migrations" (version) FROM STDIN; 20200625190458 20200626060151 20200626130220 +20200630110826 20200702123805 20200703154822 20200706005325 diff --git a/doc/administration/gitaly/praefect.md b/doc/administration/gitaly/praefect.md index fec6e040c9c..4d9a502fe74 100644 --- a/doc/administration/gitaly/praefect.md +++ b/doc/administration/gitaly/praefect.md @@ -355,6 +355,142 @@ application server, or a Gitaly node. **The steps above must be completed for each Praefect node!** +## Enabling TLS support + +> [Introduced](https://gitlab.com/gitlab-org/gitaly/-/issues/1698) in GitLab 13.2. + +Praefect supports TLS encryption. To communicate with a Praefect instance that listens +for secure connections, you must: + +- Use a `tls://` URL scheme in the `gitaly_address` of the corresponding storage entry + in the GitLab configuration. +- Bring your own certificates because this isn't provided automatically. The certificate + corresponding to each Praefect server must be installed on that Praefect server. + +Additionally the certificate, or its certificate authority, must be installed on all Gitaly servers +and on all Praefect clients that communicate with it following the procedure described in +[GitLab custom certificate configuration](https://docs.gitlab.com/omnibus/settings/ssl.html#install-custom-public-certificates) (and repeated below). + +Note the following: + +- The certificate must specify the address you use to access the Praefect server. If + addressing the Praefect server by: + + - Hostname, you can either use the Common Name field for this, or add it as a Subject + Alternative Name. + - IP address, you must add it as a Subject Alternative Name to the certificate. + +- You can configure Praefect servers with both an unencrypted listening address + `listen_addr` and an encrypted listening address `tls_listen_addr` at the same time. + This allows you to do a gradual transition from unencrypted to encrypted traffic, if + necessary. + +To configure Praefect with TLS: + +**For Omnibus GitLab** + +1. Create certificates for Praefect servers. +1. On the Praefect servers, create the `/etc/gitlab/ssl` directory and copy your key + and certificate there: + + ```shell + sudo mkdir -p /etc/gitlab/ssl + sudo chmod 755 /etc/gitlab/ssl + sudo cp key.pem cert.pem /etc/gitlab/ssl/ + sudo chmod 644 key.pem cert.pem + ``` + +1. Edit `/etc/gitlab/gitlab.rb` and add: + + ```ruby + praefect['tls_listen_addr'] = "0.0.0.0:3305" + praefect['certificate_path'] = "/etc/gitlab/ssl/cert.pem" + praefect['key_path'] = "/etc/gitlab/ssl/key.pem" + ``` + +1. Save the file and [reconfigure GitLab](../restart_gitlab.md#omnibus-gitlab-reconfigure). +1. On the Praefect clients (including each Gitaly server), copy the certificates, + or their certificate authority, into `/etc/gitlab/trusted-certs`: + + ```shell + sudo cp cert.pem /etc/gitlab/trusted-certs/ + ``` + +1. On the Praefect clients (except Gitaly servers), edit `git_data_dirs` in + `/etc/gitlab/gitlab.rb` as follows: + + ```ruby + git_data_dirs({ + 'default' => { 'gitaly_address' => 'tls://praefect1.internal:3305' }, + 'storage1' => { 'gitaly_address' => 'tls://praefect2.internal:3305' }, + }) + ``` + +1. Save the file and [reconfigure GitLab](../restart_gitlab.md#omnibus-gitlab-reconfigure). + +**For installations from source** + +1. Create certificates for Praefect servers. +1. On the Praefect servers, create the `/etc/gitlab/ssl` directory and copy your key and certificate + there: + + ```shell + sudo mkdir -p /etc/gitlab/ssl + sudo chmod 755 /etc/gitlab/ssl + sudo cp key.pem cert.pem /etc/gitlab/ssl/ + sudo chmod 644 key.pem cert.pem + ``` + +1. On the Praefect clients (including each Gitaly server), copy the certificates, + or their certificate authority, into the system trusted certificates: + + ```shell + sudo cp cert.pem /usr/local/share/ca-certificates/praefect.crt + sudo update-ca-certificates + ``` + +1. On the Praefect clients (except Gitaly servers), edit `storages` in + `/home/git/gitlab/config/gitlab.yml` as follows: + + ```yaml + gitlab: + repositories: + storages: + default: + gitaly_address: tls://praefect1.internal:3305 + path: /some/dummy/path + storage1: + gitaly_address: tls://praefect2.internal:3305 + path: /some/dummy/path + ``` + + NOTE: **Note:** + `/some/dummy/path` should be set to a local folder that exists, however no + data will be stored in this folder. This will no longer be necessary after + [this issue](https://gitlab.com/gitlab-org/gitaly/-/issues/1282) is resolved. + +1. Save the file and [restart GitLab](../restart_gitlab.md#installations-from-source). +1. Copy all Praefect server certificates, or their certificate authority, to the system + trusted certificates on each Gitaly server so the Praefect server will trust the + certificate when called by Gitaly servers: + + ```shell + sudo cp cert.pem /usr/local/share/ca-certificates/praefect.crt + sudo update-ca-certificates + ``` + +1. Edit `/home/git/praefect/config.toml` and add: + + ```toml + tls_listen_addr = '0.0.0.0:3305' + + [tls] + certificate_path = '/etc/gitlab/ssl/cert.pem' + key_path = '/etc/gitlab/ssl/key.pem' + ``` + +1. Save the file and [restart GitLab](../restart_gitlab.md#installations-from-source). + ### Gitaly NOTE: **Note:** Complete these steps for **each** Gitaly node. diff --git a/doc/topics/autodevops/requirements.md b/doc/topics/autodevops/requirements.md index b09a571fd16..c0b43caaf78 100644 --- a/doc/topics/autodevops/requirements.md +++ b/doc/topics/autodevops/requirements.md @@ -112,9 +112,9 @@ Variable. To do so, follow these steps: section. 1. Specify which AWS platform to target during the Auto DevOps deployment - by adding the `AUTO_DEVOPS_PLATFORM_TARGET` variable. - -1. Give this variable the value `ECS` before saving it. + by adding the `AUTO_DEVOPS_PLATFORM_TARGET` variable with one of the following values: + - `FARGATE` if the service you're targeting must be of launch type FARGATE. + - `ECS` if you're not enforcing any launch type check when deploying to ECS. When you trigger a pipeline, if Auto DevOps is enabled and if you've correctly [entered AWS credentials as environment variables](../../ci/cloud_deployment/index.md#deploy-your-application-to-the-aws-elastic-container-service-ecs), diff --git a/lib/gitlab/ci/templates/Jobs/Deploy/ECS.gitlab-ci.yml b/lib/gitlab/ci/templates/Jobs/Deploy/ECS.gitlab-ci.yml index bb3d5526f3a..da474f8ac88 100644 --- a/lib/gitlab/ci/templates/Jobs/Deploy/ECS.gitlab-ci.yml +++ b/lib/gitlab/ci/templates/Jobs/Deploy/ECS.gitlab-ci.yml @@ -13,11 +13,20 @@ script: - ecs update-task-definition -review_ecs: - extends: .deploy_to_ecs +.review_ecs_base: stage: review + extends: .deploy_to_ecs environment: name: review/$CI_COMMIT_REF_NAME + +.production_ecs_base: + stage: production + extends: .deploy_to_ecs + environment: + name: production + +review_ecs: + extends: .review_ecs_base rules: - if: '$AUTO_DEVOPS_PLATFORM_TARGET != "ECS"' when: never @@ -29,11 +38,21 @@ review_ecs: when: never - if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH' +review_fargate: + extends: .review_ecs_base + rules: + - if: '$AUTO_DEVOPS_PLATFORM_TARGET != "FARGATE"' + when: never + - if: '$CI_KUBERNETES_ACTIVE' + when: never + - if: '$REVIEW_DISABLED' + when: never + - if: '$CI_COMMIT_BRANCH == "master"' + when: never + - if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH' + production_ecs: - extends: .deploy_to_ecs - stage: production - environment: - name: production + extends: .production_ecs_base rules: - if: '$AUTO_DEVOPS_PLATFORM_TARGET != "ECS"' when: never @@ -42,3 +61,14 @@ production_ecs: - if: '$CI_COMMIT_BRANCH != "master"' when: never - if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH' + +production_fargate: + extends: .production_ecs_base + rules: + - if: '$AUTO_DEVOPS_PLATFORM_TARGET != "FARGATE"' + when: never + - if: '$CI_KUBERNETES_ACTIVE' + when: never + - if: '$CI_COMMIT_BRANCH != "master"' + when: never + - if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH' diff --git a/lib/gitlab/database.rb b/lib/gitlab/database.rb index e257510019b..86f17586898 100644 --- a/lib/gitlab/database.rb +++ b/lib/gitlab/database.rb @@ -4,6 +4,8 @@ module Gitlab module Database include Gitlab::Metrics::Methods + MINIMUM_POSTGRES_VERSION = 11 + # https://www.postgresql.org/docs/9.2/static/datatype-numeric.html MAX_INT_VALUE = 2147483647 @@ -102,13 +104,40 @@ module Gitlab end def self.postgresql_minimum_supported_version? - version.to_f >= 9.6 + version.to_f >= MINIMUM_POSTGRES_VERSION end def self.upsert_supported? version.to_f >= 9.5 end + def self.check_postgres_version_and_print_warning + return if Gitlab::Database.postgresql_minimum_supported_version? + return if Gitlab::Runtime.rails_runner? + + Kernel.warn ERB.new(Rainbow.new.wrap(<<~EOS).red).result + + ██ ██ █████ ██████ ███ ██ ██ ███ ██ ██████ + ██ ██ ██ ██ ██ ██ ████ ██ ██ ████ ██ ██ + ██ █ ██ ███████ ██████ ██ ██ ██ ██ ██ ██ ██ ██ ███ + ██ ███ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ + ███ ███ ██ ██ ██ ██ ██ ████ ██ ██ ████ ██████ + + ****************************************************************************** + You are using PostgreSQL <%= Gitlab::Database.version %>, but PostgreSQL >= <%= Gitlab::Database::MINIMUM_POSTGRES_VERSION %> + is required for this version of GitLab. + <% if Rails.env.development? || Rails.env.test? %> + If using gitlab-development-kit, please find the relevant steps here: + https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/master/doc/howto/postgresql.md#upgrade-postgresql + <% end %> + Please upgrade your environment to a supported PostgreSQL version, see + https://docs.gitlab.com/ee/install/requirements.html#database for details. + ****************************************************************************** + EOS + rescue ActiveRecord::ActiveRecordError, PG::Error + # ignore - happens when Rake tasks yet have to create a database, e.g. for testing + end + # map some of the function names that changed between PostgreSQL 9 and 10 # https://wiki.postgresql.org/wiki/New_in_postgres_10 def self.pg_wal_lsn_diff diff --git a/locale/gitlab.pot b/locale/gitlab.pot index bcc97ca5aab..6f42e388861 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -3154,6 +3154,12 @@ msgstr "" msgid "At least one of group_id or project_id must be specified" msgstr "" +msgid "At least one of your Personal Access Tokens is expired, but expiration enforcement is disabled. %{generate_new}" +msgstr "" + +msgid "At least one of your Personal Access Tokens will expire soon, but expiration enforcement is disabled. %{generate_new}" +msgstr "" + msgid "At risk" msgstr "" @@ -8122,6 +8128,9 @@ msgstr "" msgid "Documentation for popular identity providers" msgstr "" +msgid "Documents reindexed: %{processed_documents} (%{percentage}%%)" +msgstr "" + msgid "Doing" msgstr "" @@ -8362,9 +8371,18 @@ msgstr "" msgid "Elasticsearch integration. Elasticsearch AWS IAM." msgstr "" +msgid "Elasticsearch reindexing is already in progress" +msgstr "" + +msgid "Elasticsearch reindexing triggered" +msgstr "" + msgid "Elasticsearch returned status code: %{status_code}" msgstr "" +msgid "Elasticsearch zero-downtime reindexing" +msgstr "" + msgid "Elastic|None. Select namespaces to index." msgstr "" @@ -9214,6 +9232,9 @@ msgstr "" msgid "Error with Akismet. Please check the logs for more info." msgstr "" +msgid "Error: %{error_message}" +msgstr "" + msgid "ErrorTracking|Active" msgstr "" @@ -9409,6 +9430,9 @@ msgstr "" msgid "Expand up" msgstr "" +msgid "Expected documents: %{expected_documents}" +msgstr "" + msgid "Experienced" msgstr "" @@ -10348,6 +10372,9 @@ msgstr "" msgid "Generate new export" msgstr "" +msgid "Generate new token" +msgstr "" + msgid "GenericReports|Report" msgstr "" @@ -18869,6 +18896,9 @@ msgstr "" msgid "Regulate approvals by authors/committers, based on compliance frameworks. Can be changed only at the instance level." msgstr "" +msgid "Reindexing status" +msgstr "" + msgid "Rejected (closed)" msgstr "" @@ -21882,6 +21912,9 @@ msgstr "" msgid "State your message to activate" msgstr "" +msgid "State: %{last_reindexing_task_state}" +msgstr "" + msgid "Static Application Security Testing (SAST)" msgstr "" @@ -22509,6 +22542,9 @@ msgstr "" msgid "Target-Branch" msgstr "" +msgid "Task ID: %{elastic_task}" +msgstr "" + msgid "Team" msgstr "" @@ -23434,6 +23470,9 @@ msgstr "" msgid "This feature requires local storage to be enabled" msgstr "" +msgid "This feature should be used with an index that was created after 13.0" +msgstr "" + msgid "This field is required." msgstr "" @@ -24404,6 +24443,9 @@ msgstr "" msgid "Trigger" msgstr "" +msgid "Trigger cluster reindexing" +msgstr "" + msgid "Trigger pipelines for mirror updates" msgstr "" diff --git a/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_dependent_relationship_spec.rb b/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_dependent_relationship_spec.rb index a63d4bc2825..673125c90f2 100644 --- a/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_dependent_relationship_spec.rb +++ b/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_dependent_relationship_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Release', :docker do + RSpec.describe 'Release', :docker, :runner, :reliable do describe 'Parent-child pipelines dependent relationship' do let!(:project) do Resource::Project.fabricate_via_api! do |project| diff --git a/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_independent_relationship_spec.rb b/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_independent_relationship_spec.rb index 6b15cc88926..05b9859f112 100644 --- a/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_independent_relationship_spec.rb +++ b/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_independent_relationship_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Release', :docker do + RSpec.describe 'Release', :docker, :runner, :reliable do describe 'Parent-child pipelines independent relationship' do let!(:project) do Resource::Project.fabricate_via_api! do |project| diff --git a/spec/lib/gitlab/ci/templates/auto_devops_gitlab_ci_yaml_spec.rb b/spec/lib/gitlab/ci/templates/auto_devops_gitlab_ci_yaml_spec.rb index 03523117500..5cefa7ac5fc 100644 --- a/spec/lib/gitlab/ci/templates/auto_devops_gitlab_ci_yaml_spec.rb +++ b/spec/lib/gitlab/ci/templates/auto_devops_gitlab_ci_yaml_spec.rb @@ -37,6 +37,7 @@ RSpec.describe 'Auto-DevOps.gitlab-ci.yml' do context 'when the project is set for deployment to AWS' do let(:platform_value) { 'ECS' } + let(:review_prod_build_names) { build_names.select {|n| n.include?('review') || n.include?('production')} } before do create(:ci_variable, project: project, key: 'AUTO_DEVOPS_PLATFORM_TARGET', value: platform_value) @@ -67,8 +68,15 @@ RSpec.describe 'Auto-DevOps.gitlab-ci.yml' do end it 'creates an ECS deployment job for production only' do - expect(build_names).not_to include('review_ecs') - expect(build_names).to include('production_ecs') + expect(review_prod_build_names).to contain_exactly('production_ecs') + end + + context 'with FARGATE as a launch type' do + let(:platform_value) { 'FARGATE' } + + it 'creates a FARGATE deployment job for production only' do + expect(review_prod_build_names).to contain_exactly('production_fargate') + end end context 'and we are not on the default branch' do @@ -79,15 +87,22 @@ RSpec.describe 'Auto-DevOps.gitlab-ci.yml' do project.repository.create_branch(pipeline_branch) end - it_behaves_like 'no ECS job when AUTO_DEVOPS_PLATFORM_TARGET is not present' do - let(:job_name) { 'review_ecs' } + %w(review_ecs review_fargate).each do |job| + it_behaves_like 'no ECS job when AUTO_DEVOPS_PLATFORM_TARGET is not present' do + let(:job_name) { job } + end end it 'creates an ECS deployment job for review only' do - expect(build_names).to include('review_ecs') - expect(build_names).not_to include('production_ecs') - expect(build_names).not_to include('review') - expect(build_names).not_to include('production') + expect(review_prod_build_names).to contain_exactly('review_ecs') + end + + context 'with FARGATE as a launch type' do + let(:platform_value) { 'FARGATE' } + + it 'creates an FARGATE deployment job for review only' do + expect(review_prod_build_names).to contain_exactly('review_fargate') + end end end diff --git a/spec/lib/gitlab/database_spec.rb b/spec/lib/gitlab/database_spec.rb index 7a54ce6b8b7..17ec2bbfdb1 100644 --- a/spec/lib/gitlab/database_spec.rb +++ b/spec/lib/gitlab/database_spec.rb @@ -96,19 +96,66 @@ RSpec.describe Gitlab::Database do expect(described_class.postgresql_minimum_supported_version?).to eq(false) end - it 'returns true when using PostgreSQL 9.6' do + it 'returns false when using PostgreSQL 9.6' do allow(described_class).to receive(:version).and_return('9.6') - expect(described_class.postgresql_minimum_supported_version?).to eq(true) + expect(described_class.postgresql_minimum_supported_version?).to eq(false) end - it 'returns true when using PostgreSQL 10 or newer' do + it 'returns false when using PostgreSQL 10' do allow(described_class).to receive(:version).and_return('10') + expect(described_class.postgresql_minimum_supported_version?).to eq(false) + end + + it 'returns true when using PostgreSQL 11 or newer' do + allow(described_class).to receive(:version).and_return('11.0') + expect(described_class.postgresql_minimum_supported_version?).to eq(true) end end + describe '.check_postgres_version_and_print_warning' do + subject { described_class.check_postgres_version_and_print_warning } + + it 'prints a warning if not compliant with minimum postgres version' do + allow(described_class).to receive(:postgresql_minimum_supported_version?).and_return(false) + + expect(Kernel).to receive(:warn).with(/You are using PostgreSQL/) + + subject + end + + it 'doesnt print a warning if compliant with minimum postgres version' do + allow(described_class).to receive(:postgresql_minimum_supported_version?).and_return(true) + + expect(Kernel).not_to receive(:warn).with(/You are using PostgreSQL/) + + subject + end + + it 'doesnt print a warning in Rails runner environment' do + allow(described_class).to receive(:postgresql_minimum_supported_version?).and_return(false) + allow(Gitlab::Runtime).to receive(:rails_runner?).and_return(true) + + expect(Kernel).not_to receive(:warn).with(/You are using PostgreSQL/) + + subject + end + + it 'ignores ActiveRecord errors' do + allow(described_class).to receive(:postgresql_minimum_supported_version?).and_raise(ActiveRecord::ActiveRecordError) + + expect { subject }.not_to raise_error + end + + it 'ignores Postgres errors' do + allow(described_class).to receive(:postgresql_minimum_supported_version?).and_raise(PG::Error) + + expect { subject }.not_to raise_error + end + end + describe '.replication_slots_supported?' do it 'returns false when using PostgreSQL 9.3' do allow(described_class).to receive(:version).and_return('9.3.1') |