diff options
35 files changed, 261 insertions, 84 deletions
diff --git a/app/assets/javascripts/blob/balsamiq_viewer.js b/app/assets/javascripts/blob/balsamiq_viewer.js index 01ed2d0f27a..af8e8a4cd3d 100644 --- a/app/assets/javascripts/blob/balsamiq_viewer.js +++ b/app/assets/javascripts/blob/balsamiq_viewer.js @@ -1,5 +1,5 @@ +import createFlash from '~/flash'; import { __ } from '~/locale'; -import createFlash from '../flash'; import BalsamiqViewer from './balsamiq/balsamiq_viewer'; function onError() { diff --git a/app/assets/javascripts/blob/file_template_mediator.js b/app/assets/javascripts/blob/file_template_mediator.js index 5e68787dffc..35e0fdf53f5 100644 --- a/app/assets/javascripts/blob/file_template_mediator.js +++ b/app/assets/javascripts/blob/file_template_mediator.js @@ -2,11 +2,10 @@ import $ from 'jquery'; import Api from '~/api'; import initPopover from '~/blob/suggest_gitlab_ci_yml'; +import createFlash from '~/flash'; import { __ } from '~/locale'; import toast from '~/vue_shared/plugins/global_toast'; -import createFlash from '../flash'; - import BlobCiYamlSelector from './template_selectors/ci_yaml_selector'; import DockerfileSelector from './template_selectors/dockerfile_selector'; import GitignoreSelector from './template_selectors/gitignore_selector'; diff --git a/app/assets/javascripts/blob/viewer/index.js b/app/assets/javascripts/blob/viewer/index.js index fd0c102667f..47b82296128 100644 --- a/app/assets/javascripts/blob/viewer/index.js +++ b/app/assets/javascripts/blob/viewer/index.js @@ -1,5 +1,6 @@ import $ from 'jquery'; import '~/behaviors/markdown/render_gfm'; +import createFlash from '~/flash'; import { __ } from '~/locale'; import { REPO_BLOB_LOAD_VIEWER_START, @@ -8,7 +9,6 @@ import { } from '~/performance/constants'; import { performanceMarkAndMeasure } from '~/performance/utils'; import { fixTitle } from '~/tooltips'; -import createFlash from '../../flash'; import axios from '../../lib/utils/axios_utils'; import { handleLocationHash } from '../../lib/utils/common_utils'; import eventHub from '../../notes/event_hub'; diff --git a/app/assets/javascripts/branches/divergence_graph.js b/app/assets/javascripts/branches/divergence_graph.js index b88c056b00f..31cf9a18077 100644 --- a/app/assets/javascripts/branches/divergence_graph.js +++ b/app/assets/javascripts/branches/divergence_graph.js @@ -1,5 +1,5 @@ import Vue from 'vue'; -import createFlash from '../flash'; +import createFlash from '~/flash'; import axios from '../lib/utils/axios_utils'; import { __ } from '../locale'; import DivergenceGraph from './components/divergence_graph.vue'; diff --git a/app/assets/javascripts/clusters/clusters_bundle.js b/app/assets/javascripts/clusters/clusters_bundle.js index ef066f87a4a..c2c035963f4 100644 --- a/app/assets/javascripts/clusters/clusters_bundle.js +++ b/app/assets/javascripts/clusters/clusters_bundle.js @@ -1,9 +1,9 @@ import { GlToast } from '@gitlab/ui'; import Visibility from 'visibilityjs'; import Vue from 'vue'; +import createFlash from '~/flash'; import AccessorUtilities from '~/lib/utils/accessor'; import initProjectSelectDropdown from '~/project_select'; -import createFlash from '../flash'; import Poll from '../lib/utils/poll'; import { s__ } from '../locale'; import PersistentUserCallout from '../persistent_user_callout'; diff --git a/app/assets/javascripts/confidential_merge_request/components/project_form_group.vue b/app/assets/javascripts/confidential_merge_request/components/project_form_group.vue index 6b07b7e3772..5f778af1dbb 100644 --- a/app/assets/javascripts/confidential_merge_request/components/project_form_group.vue +++ b/app/assets/javascripts/confidential_merge_request/components/project_form_group.vue @@ -1,7 +1,7 @@ <script> import { GlIcon, GlLink, GlSprintf } from '@gitlab/ui'; +import createFlash from '~/flash'; import Api from '../../api'; -import createFlash from '../../flash'; import { __ } from '../../locale'; import state from '../state'; import Dropdown from './dropdown.vue'; diff --git a/app/assets/javascripts/environments/mixins/environments_mixin.js b/app/assets/javascripts/environments/mixins/environments_mixin.js index c80839a117f..e67d3606d95 100644 --- a/app/assets/javascripts/environments/mixins/environments_mixin.js +++ b/app/assets/javascripts/environments/mixins/environments_mixin.js @@ -3,7 +3,7 @@ */ import { isEqual, isFunction, omitBy } from 'lodash'; import Visibility from 'visibilityjs'; -import createFlash from '../../flash'; +import createFlash from '~/flash'; import { getParameterByName } from '../../lib/utils/common_utils'; import Poll from '../../lib/utils/poll'; import { s__ } from '../../locale'; diff --git a/app/assets/javascripts/filtered_search/dropdown_ajax_filter.js b/app/assets/javascripts/filtered_search/dropdown_ajax_filter.js index 35c79891458..545719ee681 100644 --- a/app/assets/javascripts/filtered_search/dropdown_ajax_filter.js +++ b/app/assets/javascripts/filtered_search/dropdown_ajax_filter.js @@ -1,6 +1,6 @@ +import createFlash from '~/flash'; import { __ } from '~/locale'; import AjaxFilter from '../droplab/plugins/ajax_filter'; -import createFlash from '../flash'; import DropdownUtils from './dropdown_utils'; import FilteredSearchDropdown from './filtered_search_dropdown'; import FilteredSearchTokenizer from './filtered_search_tokenizer'; diff --git a/app/assets/javascripts/filtered_search/dropdown_emoji.js b/app/assets/javascripts/filtered_search/dropdown_emoji.js index 91af3a6b812..a7648a3c463 100644 --- a/app/assets/javascripts/filtered_search/dropdown_emoji.js +++ b/app/assets/javascripts/filtered_search/dropdown_emoji.js @@ -1,7 +1,7 @@ +import createFlash from '~/flash'; import { __ } from '~/locale'; import Ajax from '../droplab/plugins/ajax'; import Filter from '../droplab/plugins/filter'; -import createFlash from '../flash'; import DropdownUtils from './dropdown_utils'; import FilteredSearchDropdown from './filtered_search_dropdown'; diff --git a/app/assets/javascripts/filtered_search/dropdown_non_user.js b/app/assets/javascripts/filtered_search/dropdown_non_user.js index 93051b00756..f78644a3893 100644 --- a/app/assets/javascripts/filtered_search/dropdown_non_user.js +++ b/app/assets/javascripts/filtered_search/dropdown_non_user.js @@ -1,7 +1,7 @@ +import createFlash from '~/flash'; import { __ } from '~/locale'; import Ajax from '../droplab/plugins/ajax'; import Filter from '../droplab/plugins/filter'; -import createFlash from '../flash'; import DropdownUtils from './dropdown_utils'; import FilteredSearchDropdown from './filtered_search_dropdown'; diff --git a/app/assets/javascripts/filtered_search/filtered_search_manager.js b/app/assets/javascripts/filtered_search/filtered_search_manager.js index bdc83a537d3..659ecd8fb18 100644 --- a/app/assets/javascripts/filtered_search/filtered_search_manager.js +++ b/app/assets/javascripts/filtered_search/filtered_search_manager.js @@ -1,6 +1,7 @@ import { last } from 'lodash'; import recentSearchesStorageKeys from 'ee_else_ce/filtered_search/recent_searches_storage_keys'; import IssuableFilteredSearchTokenKeys from '~/filtered_search/issuable_filtered_search_token_keys'; +import createFlash from '~/flash'; import { getParameterByName } from '~/lib/utils/common_utils'; import { ENTER_KEY_CODE, @@ -10,7 +11,6 @@ import { DOWN_KEY_CODE, } from '~/lib/utils/keycodes'; import { __ } from '~/locale'; -import createFlash from '../flash'; import { addClassIfElementExists } from '../lib/utils/dom_utils'; import { visitUrl, getUrlParamsArray } from '../lib/utils/url_utility'; import FilteredSearchContainer from './container'; diff --git a/app/assets/javascripts/notes/components/note_awards_list.vue b/app/assets/javascripts/notes/components/note_awards_list.vue index 6ad5ce3ba5c..835750cc137 100644 --- a/app/assets/javascripts/notes/components/note_awards_list.vue +++ b/app/assets/javascripts/notes/components/note_awards_list.vue @@ -1,8 +1,8 @@ <script> import { mapActions, mapGetters } from 'vuex'; +import createFlash from '~/flash'; import { __ } from '~/locale'; import AwardsList from '~/vue_shared/components/awards_list.vue'; -import createFlash from '../../flash'; export default { components: { diff --git a/app/assets/javascripts/notes/components/noteable_discussion.vue b/app/assets/javascripts/notes/components/noteable_discussion.vue index f3be918d1c4..a386fd50365 100644 --- a/app/assets/javascripts/notes/components/noteable_discussion.vue +++ b/app/assets/javascripts/notes/components/noteable_discussion.vue @@ -2,11 +2,11 @@ import { GlTooltipDirective, GlIcon } from '@gitlab/ui'; import { mapActions, mapGetters } from 'vuex'; import DraftNote from '~/batch_comments/components/draft_note.vue'; +import createFlash from '~/flash'; import { clearDraft, getDiscussionReplyKey } from '~/lib/utils/autosave'; import { s__, __ } from '~/locale'; import diffLineNoteFormMixin from '~/notes/mixins/diff_line_note_form'; import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item.vue'; -import createFlash from '../../flash'; import userAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue'; import eventHub from '../event_hub'; import noteable from '../mixins/noteable'; diff --git a/app/assets/javascripts/notes/components/noteable_note.vue b/app/assets/javascripts/notes/components/noteable_note.vue index d9783b3e732..de3aa028e9a 100644 --- a/app/assets/javascripts/notes/components/noteable_note.vue +++ b/app/assets/javascripts/notes/components/noteable_note.vue @@ -4,10 +4,10 @@ import $ from 'jquery'; import { escape, isEmpty } from 'lodash'; import { mapGetters, mapActions } from 'vuex'; import { INLINE_DIFF_LINES_KEY } from '~/diffs/constants'; +import createFlash from '~/flash'; import httpStatusCodes from '~/lib/utils/http_status'; import { truncateSha } from '~/lib/utils/text_utility'; import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item.vue'; -import createFlash from '../../flash'; import { __, s__, sprintf } from '../../locale'; import userAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue'; import eventHub from '../event_hub'; diff --git a/app/assets/javascripts/notes/components/notes_app.vue b/app/assets/javascripts/notes/components/notes_app.vue index 1b888cfce7f..47d0c26b106 100644 --- a/app/assets/javascripts/notes/components/notes_app.vue +++ b/app/assets/javascripts/notes/components/notes_app.vue @@ -1,13 +1,13 @@ <script> import { mapGetters, mapActions } from 'vuex'; import highlightCurrentUser from '~/behaviors/markdown/highlight_current_user'; +import createFlash from '~/flash'; import { __ } from '~/locale'; import initUserPopovers from '~/user_popovers'; import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item.vue'; import OrderedLayout from '~/vue_shared/components/ordered_layout.vue'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import draftNote from '../../batch_comments/components/draft_note.vue'; -import createFlash from '../../flash'; import { getLocationHash, doesHashExistInUrl } from '../../lib/utils/url_utility'; import placeholderNote from '../../vue_shared/components/notes/placeholder_note.vue'; import placeholderSystemNote from '../../vue_shared/components/notes/placeholder_system_note.vue'; diff --git a/app/assets/javascripts/notes/stores/actions.js b/app/assets/javascripts/notes/stores/actions.js index 5cb7b7aa4e2..a4824420dd5 100644 --- a/app/assets/javascripts/notes/stores/actions.js +++ b/app/assets/javascripts/notes/stores/actions.js @@ -2,6 +2,7 @@ import $ from 'jquery'; import Visibility from 'visibilityjs'; import Vue from 'vue'; import Api from '~/api'; +import createFlash from '~/flash'; import { EVENT_ISSUABLE_VUE_APP_CHANGE } from '~/issuable/constants'; import axios from '~/lib/utils/axios_utils'; import { __, sprintf } from '~/locale'; @@ -9,7 +10,6 @@ import { confidentialWidget } from '~/sidebar/components/confidential/sidebar_co import updateIssueLockMutation from '~/sidebar/components/lock/mutations/update_issue_lock.mutation.graphql'; import updateMergeRequestLockMutation from '~/sidebar/components/lock/mutations/update_merge_request_lock.mutation.graphql'; import loadAwardsHandler from '../../awards_handler'; -import createFlash from '../../flash'; import { isInViewport, scrollToElement, isInMRPage } from '../../lib/utils/common_utils'; import Poll from '../../lib/utils/poll'; import { create } from '../../lib/utils/recurrence'; diff --git a/app/assets/javascripts/pages/admin/application_settings/payload_previewer.js b/app/assets/javascripts/pages/admin/application_settings/payload_previewer.js index 1ab1064b6f9..08f6633f424 100644 --- a/app/assets/javascripts/pages/admin/application_settings/payload_previewer.js +++ b/app/assets/javascripts/pages/admin/application_settings/payload_previewer.js @@ -1,4 +1,4 @@ -import createFlash from '../../../flash'; +import createFlash from '~/flash'; import axios from '../../../lib/utils/axios_utils'; import { __ } from '../../../locale'; diff --git a/app/assets/javascripts/pipelines/pipeline_details_mediator.js b/app/assets/javascripts/pipelines/pipeline_details_mediator.js index 9797fe44bb0..72c4fedc64c 100644 --- a/app/assets/javascripts/pipelines/pipeline_details_mediator.js +++ b/app/assets/javascripts/pipelines/pipeline_details_mediator.js @@ -1,5 +1,5 @@ import Visibility from 'visibilityjs'; -import createFlash from '../flash'; +import createFlash from '~/flash'; import Poll from '../lib/utils/poll'; import { __ } from '../locale'; import PipelineService from './services/pipeline_service'; diff --git a/app/assets/javascripts/profile/profile.js b/app/assets/javascripts/profile/profile.js index 4a0c278853f..c49ade2bbb8 100644 --- a/app/assets/javascripts/profile/profile.js +++ b/app/assets/javascripts/profile/profile.js @@ -1,11 +1,11 @@ import $ from 'jquery'; +import createFlash from '~/flash'; import axios from '~/lib/utils/axios_utils'; import { parseBoolean } from '~/lib/utils/common_utils'; import { Rails } from '~/lib/utils/rails_ujs'; import TimezoneDropdown, { formatTimezone, } from '~/pages/projects/pipeline_schedules/shared/components/timezone_dropdown'; -import createFlash from '../flash'; export default class Profile { constructor({ form } = {}) { diff --git a/app/assets/javascripts/protected_tags/protected_tag_edit.js b/app/assets/javascripts/protected_tags/protected_tag_edit.js index bf9810c7789..1fe9a753e1e 100644 --- a/app/assets/javascripts/protected_tags/protected_tag_edit.js +++ b/app/assets/javascripts/protected_tags/protected_tag_edit.js @@ -1,4 +1,4 @@ -import createFlash from '../flash'; +import createFlash from '~/flash'; import axios from '../lib/utils/axios_utils'; import { FAILED_TO_UPDATE_TAG_MESSAGE } from './constants'; import ProtectedTagAccessDropdown from './protected_tag_access_dropdown'; diff --git a/app/assets/javascripts/sidebar/sidebar_mediator.js b/app/assets/javascripts/sidebar/sidebar_mediator.js index 23d3d3cdb9d..0a5e44a9b95 100644 --- a/app/assets/javascripts/sidebar/sidebar_mediator.js +++ b/app/assets/javascripts/sidebar/sidebar_mediator.js @@ -1,7 +1,7 @@ import Store from 'ee_else_ce/sidebar/stores/sidebar_store'; +import createFlash from '~/flash'; import { __ } from '~/locale'; import toast from '~/vue_shared/plugins/global_toast'; -import createFlash from '../flash'; import { visitUrl } from '../lib/utils/url_utility'; import Service from './services/sidebar_service'; diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_enabled.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_enabled.vue index 471edcbdc9e..2c8245b0943 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_enabled.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_enabled.vue @@ -2,10 +2,10 @@ import { GlLoadingIcon, GlSkeletonLoader } from '@gitlab/ui'; import autoMergeMixin from 'ee_else_ce/vue_merge_request_widget/mixins/auto_merge'; import autoMergeEnabledQuery from 'ee_else_ce/vue_merge_request_widget/queries/states/auto_merge_enabled.query.graphql'; +import createFlash from '~/flash'; import { getIdFromGraphQLId } from '~/graphql_shared/utils'; import { __ } from '~/locale'; import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; -import createFlash from '../../../flash'; import { AUTO_MERGE_STRATEGIES } from '../../constants'; import eventHub from '../../event_hub'; import mergeRequestQueryVariablesMixin from '../../mixins/merge_request_query_variables'; diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_rebase.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_rebase.vue index 363bccaf551..98171ef69f5 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_rebase.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_rebase.vue @@ -2,9 +2,9 @@ /* eslint-disable vue/no-v-html */ import { GlButton, GlSkeletonLoader } from '@gitlab/ui'; import { escape } from 'lodash'; +import createFlash from '~/flash'; import { __, sprintf } from '~/locale'; import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; -import createFlash from '../../../flash'; import simplePoll from '../../../lib/utils/simple_poll'; import eventHub from '../../event_hub'; import mergeRequestQueryVariablesMixin from '../../mixins/merge_request_query_variables'; diff --git a/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue b/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue index e9dcf494099..5fe04269e33 100644 --- a/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue +++ b/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue @@ -5,12 +5,12 @@ import MrWidgetApprovals from 'ee_else_ce/vue_merge_request_widget/components/ap import MRWidgetService from 'ee_else_ce/vue_merge_request_widget/services/mr_widget_service'; import MRWidgetStore from 'ee_else_ce/vue_merge_request_widget/stores/mr_widget_store'; import stateMaps from 'ee_else_ce/vue_merge_request_widget/stores/state_maps'; +import createFlash from '~/flash'; import { secondsToMilliseconds } from '~/lib/utils/datetime_utility'; import notify from '~/lib/utils/notify'; import { sprintf, s__, __ } from '~/locale'; import Project from '~/pages/projects/project'; import SmartInterval from '~/smart_interval'; -import createFlash from '../flash'; import { setFaviconOverlay } from '../lib/utils/favicon'; import GroupedAccessibilityReportsApp from '../reports/accessibility_report/grouped_accessibility_reports_app.vue'; import GroupedCodequalityReportsApp from '../reports/codequality_report/grouped_codequality_reports_app.vue'; diff --git a/doc/topics/autodevops/upgrading_auto_deploy_dependencies.md b/doc/topics/autodevops/upgrading_auto_deploy_dependencies.md index 62dc061aba6..48d37e5125c 100644 --- a/doc/topics/autodevops/upgrading_auto_deploy_dependencies.md +++ b/doc/topics/autodevops/upgrading_auto_deploy_dependencies.md @@ -77,7 +77,7 @@ The v2 auto-deploy-image drops support for Kubernetes 1.15 and lower. If you nee Kubernetes cluster, follow your cloud provider's instructions. Here's [an example on GKE](https://cloud.google.com/kubernetes-engine/docs/how-to/upgrading-a-cluster). -#### Helm 3 +#### Helm v3 > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/228609) in GitLab 13.4. @@ -86,47 +86,38 @@ Previously, `auto-deploy-image` used Helm v2, which used Tiller in a cluster. In the v2 `auto-deploy-image`, it uses Helm v3 that doesn't require Tiller anymore. If your Auto DevOps project has an active environment that was deployed with the v1 -`auto-deploy-image`, use the following steps to upgrade to v2, which uses Helm 3: - -1. Modify your `.gitlab-ci.yml` with: - - ```yaml - include: - - template: Auto-DevOps.gitlab-ci.yml - - remote: https://gitlab.com/hfyngvason/ci-templates/-/raw/master/Helm-2to3.gitlab-ci.yml - - variables: - # If this variable is not present, the migration jobs will not show up - MIGRATE_HELM_2TO3: "true" - - .auto-deploy: - # Optional: If you are on GitLab 13.12 or older, pin the auto-deploy-image - # image: registry.gitlab.com/gitlab-org/cluster-integration/auto-deploy-image:v2.6.0 - variables: - AUTO_DEVOPS_FORCE_DEPLOY_V2: 1 - # If you have non-public pipelines, you can back up the entire namespace in a job artifact - # prior to the migration by setting the CI variable BACKUP_NAMESPACE to a non-empty value. - # WARNING: If you have public pipelines, this artifact will be public and can - # expose your secrets. - # BACKUP_HELM2_RELEASES: 1 - ``` - -1. Run the `<environment-name>:helm-2to3:migrate` job. -1. Deploy your environment as usual. This deployment uses Helm 3. -1. If the deployment succeeds, you can safely run `environment:helm-2to3:cleanup`. - This deletes all Helm 2 release data from the namespace. - - If you set `BACKUP_HELM2_RELEASES` to a non-empty value, the `<environment-name>:helm2to3:migrate` - job saves a backup for 1 week in a job artifact called `helm-2-release-backups`. - If you accidentally delete the Helm 2 releases before you are ready, then - this backup is in a Kubernetes manifest file that can be restored using - `kubectl apply -f $backup`. - - **WARNING:** - This artifact can contain secrets and is visible to any - user who can see your job. - -1. Remove the `MIGRATE_HELM_2TO3` CI/CD variable. +`auto-deploy-image`, use the following steps to upgrade to v2, which uses Helm v3: + +1. Include the [Helm 2to3 migration CI/CD template](https://gitlab.com/gitlab-org/gitlab/-/raw/master/lib/gitlab/ci/templates/Jobs/Helm-2to3.gitlab-ci.yml): + + - If you are on GitLab.com, or GitLab 14.0.1 or later, this template is already included in Auto DevOps. + - On other versions of GitLab, you can modify your `.gitlab-ci.yml` to include the templates: + + ```yaml + include: + - template: Auto-DevOps.gitlab-ci.yml + - remote: https://gitlab.com/gitlab-org/gitlab/-/raw/master/lib/gitlab/ci/templates/Jobs/Helm-2to3.gitlab-ci.yml + ``` + +1. Set the following CI/CD variables: + + - `MIGRATE_HELM_2TO3` to `true`. If this variable is not present, migration jobs do not run. + - `AUTO_DEVOPS_FORCE_DEPLOY_V2` to `1`. + - **Optional:** `BACKUP_HELM2_RELEASES` to `1`. If you set this variable, the migration + job saves a backup for 1 week in a job artifact called `helm-2-release-backups`. + If you accidentally delete the Helm v2 releases before you are ready, you can restore + this backup from a Kubernetes manifest file by using `kubectl apply -f $backup`. + + **WARNING:** + *Do not use this if you have public pipelines*. + This artifact can contain secrets and is visible to any + user who can see your job. + +1. Run a pipeline and trigger the `<environment-name>:helm-2to3:migrate` job. +1. Deploy your environment as usual. This deployment uses Helm v3. +1. If the deployment succeeds, you can safely run `<environment-name>:helm-2to3:cleanup`. + This deletes all Helm v2 release data from the namespace. +1. Remove the `MIGRATE_HELM_2TO3` CI/CD variable or set it to `false`. You can do this one environment at a time using [environment scopes](../../ci/environments/index.md#scoping-environments-with-specs). #### In-Cluster PostgreSQL Channel 2 diff --git a/lib/api/concerns/packages/debian_package_endpoints.rb b/lib/api/concerns/packages/debian_package_endpoints.rb index c79ae3068b4..98459b59bb1 100644 --- a/lib/api/concerns/packages/debian_package_endpoints.rb +++ b/lib/api/concerns/packages/debian_package_endpoints.rb @@ -40,6 +40,14 @@ module API .sent_through(:http_basic_auth) end + helpers do + def present_release_file + distribution = ::Packages::Debian::DistributionsFinder.new(project_or_group, codename_or_suite: params[:distribution]).execute.last! + + present_carrierwave_file!(distribution.file) + end + end + format :txt content_type :txt, 'text/plain' @@ -65,8 +73,7 @@ module API route_setting :authentication, authenticate_non_public: true get 'Release' do - # https://gitlab.com/gitlab-org/gitlab/-/issues/5835#note_414103286 - 'TODO Release' + present_release_file end # GET {projects|groups}/:id/packages/debian/dists/*distribution/InRelease @@ -76,7 +83,8 @@ module API route_setting :authentication, authenticate_non_public: true get 'InRelease' do - not_found! + # Signature to be added in 7.3 of https://gitlab.com/groups/gitlab-org/-/epics/6057#note_582697034 + present_release_file end params do diff --git a/lib/api/debian_group_packages.rb b/lib/api/debian_group_packages.rb index c6116a8b28f..191ed42a5b8 100644 --- a/lib/api/debian_group_packages.rb +++ b/lib/api/debian_group_packages.rb @@ -24,6 +24,12 @@ module API end namespace ':id/-' do + helpers do + def project_or_group + user_group + end + end + include ::API::Concerns::Packages::DebianPackageEndpoints end end diff --git a/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml b/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml index 5680950bba8..207e2cf074a 100644 --- a/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml +++ b/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml @@ -166,6 +166,7 @@ include: - template: Jobs/Deploy/EC2.gitlab-ci.yml # https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/Jobs/Deploy/EC2.gitlab-ci.yml - template: Jobs/DAST-Default-Branch-Deploy.gitlab-ci.yml # https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/Jobs/DAST-Default-Branch-Deploy.gitlab-ci.yml - template: Jobs/Browser-Performance-Testing.gitlab-ci.yml # https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/Jobs/Browser-Performance-Testing.gitlab-ci.yml + - template: Jobs/Helm-2to3.gitlab-ci.yml # https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/Jobs/Helm-2to3.gitlab-ci.yml - template: Security/DAST.gitlab-ci.yml # https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/Security/DAST.gitlab-ci.yml - template: Security/Container-Scanning.gitlab-ci.yml # https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/Security/Container-Scanning.gitlab-ci.yml - template: Security/Dependency-Scanning.gitlab-ci.yml # https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/Security/Dependency-Scanning.gitlab-ci.yml diff --git a/lib/gitlab/ci/templates/Jobs/Helm-2to3.gitlab-ci.yml b/lib/gitlab/ci/templates/Jobs/Helm-2to3.gitlab-ci.yml new file mode 100644 index 00000000000..a130b09c51a --- /dev/null +++ b/lib/gitlab/ci/templates/Jobs/Helm-2to3.gitlab-ci.yml @@ -0,0 +1,151 @@ +# This is a pre-release of a Helm 2to3 migration template to facilitate +# the migration of Auto DevOps releases to Helm 3. +# +# To use, set the CI variable MIGRATE_HELM_2TO3 to "true". +# For more details, go to https://docs.gitlab.com/ee/topics/autodevops/upgrading_auto_deploy_dependencies.html#helm-v3 + +.helm-2to3-migrate: + image: registry.gitlab.com/gitlab-org/cluster-integration/helm-install-image/releases/helm-2to3-2.17.0-3.5.3-kube-1.16.15-alpine-3.12 + # NOTE: We use the deploy stage because: + # - It exists in all versions of Auto DevOps. + # - It is _empty_. + # - It precedes any Kubernetes deployments. + # Users on older versions of GitLab can include this template without adjusting their stages. + stage: deploy + needs: [] + artifacts: + when: always + expire_in: 1 week + paths: + - helm-2-release-backups/ + before_script: + - mkdir helm-2-release-backups + - apk add jq + - export TILLER_NAMESPACE=$KUBE_NAMESPACE + - export HELM_HOST="localhost:44134" + - nohup tiller -listen "${HELM_HOST}" >tiller.log 2>&1 & + - helm2 init --client-only + script: + # check for releases + - releases=$(helm2 ls --output json | jq -r '.Releases[].Name') + # back up entire namespace if the user opts into it + - | + if [[ -n "$releases" && -n "$BACKUP_HELM2_RELEASES" ]]; then + echo "Backing up releases" + kubectl get configmap -n "$KUBE_NAMESPACE" -l "OWNER=TILLER" -o yaml > "helm-2-release-backups/$KUBE_NAMESPACE.yaml" + fi + # adopt manifests from each release + - | + for release in $releases; do + chart=$(helm2 ls "^$release\$" --output json | jq -r '.Releases[0].Chart') + echo "Adopting Helm v2 manifests from $release" + # some resource kinds must be listed explicitly https://github.com/kubernetes/kubernetes/issues/42885 + for name in $(kubectl -n "$KUBE_NAMESPACE" get all,ingress,daemonset -o name -l chart="$chart"); do + kubectl annotate --overwrite "$name" meta.helm.sh/release-name="$release" + kubectl annotate --overwrite "$name" meta.helm.sh/release-namespace="$KUBE_NAMESPACE" + kubectl label --overwrite "$name" app.kubernetes.io/managed-by=Helm + done + done + # migrate each release + - | + for release in $releases; do + echo "Migrating release: $release" + helm3 2to3 convert --ignore-already-migrated --release-storage configmaps --tiller-out-cluster --tiller-ns "$TILLER_NAMESPACE" "$release" + done + +.helm-2to3-cleanup: + image: registry.gitlab.com/gitlab-org/cluster-integration/helm-install-image/releases/helm-2to3-2.17.0-3.5.3-kube-1.16.15-alpine-3.12 + stage: cleanup + environment: + action: prepare + before_script: + - export TILLER_NAMESPACE=$KUBE_NAMESPACE + - export HELM_HOST="localhost:44134" + - nohup tiller -listen "${HELM_HOST}" >tiller.log 2>&1 & + - helm2 init --client-only + script: + - helm3 2to3 cleanup --skip-confirmation --release-storage configmaps --tiller-out-cluster --tiller-ns "$TILLER_NAMESPACE" + +.review: + environment: + name: review/$CI_COMMIT_REF_NAME + rules: + - if: '$MIGRATE_HELM_2TO3 != "true"' + when: never + - if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""' + when: never + - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' + when: never + - if: '$REVIEW_DISABLED' + when: never + - if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH' + when: manual + +review:helm-2to3:migrate: + extends: [.review, .helm-2to3-migrate] + +review:helm-2to3:cleanup: + extends: [.review, .helm-2to3-cleanup] + rules: + - if: '$MIGRATE_HELM_2TO3 != "true" && $CLEANUP_HELM_2TO3 == null' + when: never + - if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""' + when: never + - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' + when: never + - if: '$REVIEW_DISABLED' + when: never + - if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH' + when: manual + +.staging: + environment: + name: staging + rules: + - if: '$MIGRATE_HELM_2TO3 != "true"' + when: never + - if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""' + when: never + - if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH' + when: never + - if: '$STAGING_ENABLED' + when: manual + +staging:helm-2to3:migrate: + extends: [.staging, .helm-2to3-migrate] + +staging:helm-2to3:cleanup: + extends: [.staging, .helm-2to3-cleanup] + rules: + - if: '$MIGRATE_HELM_2TO3 != "true" && $CLEANUP_HELM_2TO3 == null' + when: never + - if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""' + when: never + - if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH' + when: never + - if: '$STAGING_ENABLED' + when: manual + +.production: + environment: + name: production + rules: + - if: '$MIGRATE_HELM_2TO3 != "true"' + when: never + - if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""' + when: never + - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' + when: manual + +production:helm-2to3:migrate: + extends: [.production, .helm-2to3-migrate] + +production:helm-2to3:cleanup: + extends: [.production, .helm-2to3-cleanup] + rules: + - if: '$MIGRATE_HELM_2TO3 != "true" && $CLEANUP_HELM_2TO3 == null' + when: never + - if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""' + when: never + - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' + when: manual diff --git a/qa/qa/page/base.rb b/qa/qa/page/base.rb index 66040bb9849..6b54d8ab1ac 100644 --- a/qa/qa/page/base.rb +++ b/qa/qa/page/base.rb @@ -104,7 +104,8 @@ module QA end def find_element(name, **kwargs) - wait_for_requests + skip_finished_loading_check = kwargs.delete(:skip_finished_loading_check) + wait_for_requests(skip_finished_loading_check: skip_finished_loading_check) element_selector = element_selector_css(name, reject_capybara_query_keywords(kwargs)) find(element_selector, only_capybara_query_keywords(kwargs)) @@ -196,7 +197,8 @@ module QA # replace with (..., page = self.class) def click_element(name, page = nil, **kwargs) - wait_for_requests + skip_finished_loading_check = kwargs.delete(:skip_finished_loading_check) + wait_for_requests(skip_finished_loading_check: skip_finished_loading_check) wait = kwargs.delete(:wait) || Capybara.default_max_wait_time text = kwargs.delete(:text) 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 6dfcecb853a..b40b4f5645f 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 @@ -34,6 +34,7 @@ RSpec.describe 'Auto-DevOps.gitlab-ci.yml' do expect(build_names).not_to include('canary') expect(build_names).not_to include('review') expect(build_names).not_to include(a_string_matching(/rollout \d+%/)) + expect(build_names).not_to include(a_string_matching(/helm-2to3\d+%/)) end end @@ -190,6 +191,17 @@ RSpec.describe 'Auto-DevOps.gitlab-ci.yml' do expect(build_names).not_to include(a_string_matching(/rollout \d+%/)) end end + + context 'when MIGRATE_HELM_2TO3=true' do + before do + create(:ci_variable, project: project, key: 'MIGRATE_HELM_2TO3', value: 'true') + end + + it 'includes a helm-2to3:migrate and a helm-2to3:cleanup job' do + expect(build_names).to include('production:helm-2to3:migrate') + expect(build_names).to include('production:helm-2to3:cleanup') + end + end end context 'outside of default branch' do @@ -207,12 +219,23 @@ RSpec.describe 'Auto-DevOps.gitlab-ci.yml' do expect(build_names).to include('review') expect(build_names).not_to include(a_string_matching(/rollout \d+%/)) end + + context 'when MIGRATE_HELM_2TO3=true' do + before do + create(:ci_variable, project: project, key: 'MIGRATE_HELM_2TO3', value: 'true') + end + + it 'includes a helm-2to3:migrate and a helm-2to3:cleanup job' do + expect(build_names).to include('review:helm-2to3:migrate') + expect(build_names).to include('review:helm-2to3:cleanup') + end + end end end end end - describe 'build-pack detection' do + describe 'buildpack detection' do using RSpec::Parameterized::TableSyntax where(:case_name, :files, :variables, :include_build_names, :not_include_build_names) do diff --git a/spec/migrations/20200728080250_replace_unique_index_on_cycle_analytics_stages_spec.rb b/spec/migrations/20200728080250_replace_unique_index_on_cycle_analytics_stages_spec.rb index e0e3ebd5ffb..a632065946d 100644 --- a/spec/migrations/20200728080250_replace_unique_index_on_cycle_analytics_stages_spec.rb +++ b/spec/migrations/20200728080250_replace_unique_index_on_cycle_analytics_stages_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require_migration!('replace_unique_index_on_cycle_analytics_stages') -RSpec.describe ReplaceUniqueIndexOnCycleAnalyticsStages, :migration, schema: 20200728080250 do +RSpec.describe ReplaceUniqueIndexOnCycleAnalyticsStages, :migration, schema: 20200727142337 do let(:namespaces) { table(:namespaces) } let(:group_value_streams) { table(:analytics_cycle_analytics_group_value_streams) } let(:group_stages) { table(:analytics_cycle_analytics_group_stages) } @@ -29,10 +29,6 @@ RSpec.describe ReplaceUniqueIndexOnCycleAnalyticsStages, :migration, schema: 202 stage_record end - after do - described_class.new.up - end - it 'removes duplicated stage records' do subject diff --git a/spec/requests/api/debian_group_packages_spec.rb b/spec/requests/api/debian_group_packages_spec.rb index c3abb06c5c1..07d0cae377e 100644 --- a/spec/requests/api/debian_group_packages_spec.rb +++ b/spec/requests/api/debian_group_packages_spec.rb @@ -15,13 +15,13 @@ RSpec.describe API::DebianGroupPackages do describe 'GET groups/:id/-/packages/debian/dists/*distribution/Release' do let(:url) { "/groups/#{container.id}/-/packages/debian/dists/#{distribution.codename}/Release" } - it_behaves_like 'Debian repository read endpoint', 'GET request', :success, /^TODO Release$/ + it_behaves_like 'Debian repository read endpoint', 'GET request', :success, /^Codename: fixture-distribution\n$/ end describe 'GET groups/:id/-/packages/debian/dists/*distribution/InRelease' do let(:url) { "/groups/#{container.id}/-/packages/debian/dists/#{distribution.codename}/InRelease" } - it_behaves_like 'Debian repository read endpoint', 'GET request', :not_found + it_behaves_like 'Debian repository read endpoint', 'GET request', :success, /^Codename: fixture-distribution\n$/ end describe 'GET groups/:id/-/packages/debian/dists/*distribution/:component/binary-:architecture/Packages' do diff --git a/spec/requests/api/debian_project_packages_spec.rb b/spec/requests/api/debian_project_packages_spec.rb index c11c4ecc12a..9548fa438ad 100644 --- a/spec/requests/api/debian_project_packages_spec.rb +++ b/spec/requests/api/debian_project_packages_spec.rb @@ -15,13 +15,13 @@ RSpec.describe API::DebianProjectPackages do describe 'GET projects/:id/packages/debian/dists/*distribution/Release' do let(:url) { "/projects/#{container.id}/packages/debian/dists/#{distribution.codename}/Release" } - it_behaves_like 'Debian repository read endpoint', 'GET request', :success, /^TODO Release$/ + it_behaves_like 'Debian repository read endpoint', 'GET request', :success, /^Codename: fixture-distribution\n$/ end describe 'GET projects/:id/packages/debian/dists/*distribution/InRelease' do let(:url) { "/projects/#{container.id}/packages/debian/dists/#{distribution.codename}/InRelease" } - it_behaves_like 'Debian repository read endpoint', 'GET request', :not_found + it_behaves_like 'Debian repository read endpoint', 'GET request', :success, /^Codename: fixture-distribution\n$/ end describe 'GET projects/:id/packages/debian/dists/*distribution/:component/binary-:architecture/Packages' do diff --git a/spec/support/shared_examples/requests/api/debian_packages_shared_examples.rb b/spec/support/shared_examples/requests/api/debian_packages_shared_examples.rb index 0530aa8c760..e15962a4b82 100644 --- a/spec/support/shared_examples/requests/api/debian_packages_shared_examples.rb +++ b/spec/support/shared_examples/requests/api/debian_packages_shared_examples.rb @@ -12,12 +12,12 @@ RSpec.shared_context 'Debian repository shared context' do |container_type, can_ let_it_be(:user, freeze: true) { create(:user) } let_it_be(:personal_access_token, freeze: true) { create(:personal_access_token, user: user) } - let_it_be(:private_distribution, freeze: true) { create("debian_#{container_type}_distribution", container: private_container, codename: 'existing-codename') } + let_it_be(:private_distribution, freeze: true) { create("debian_#{container_type}_distribution", :with_file, container: private_container, codename: 'existing-codename') } let_it_be(:private_component, freeze: true) { create("debian_#{container_type}_component", distribution: private_distribution, name: 'existing-component') } let_it_be(:private_architecture_all, freeze: true) { create("debian_#{container_type}_architecture", distribution: private_distribution, name: 'all') } let_it_be(:private_architecture, freeze: true) { create("debian_#{container_type}_architecture", distribution: private_distribution, name: 'existing-arch') } - let_it_be(:public_distribution, freeze: true) { create("debian_#{container_type}_distribution", container: public_container, codename: 'existing-codename') } + let_it_be(:public_distribution, freeze: true) { create("debian_#{container_type}_distribution", :with_file, container: public_container, codename: 'existing-codename') } let_it_be(:public_component, freeze: true) { create("debian_#{container_type}_component", distribution: public_distribution, name: 'existing-component') } let_it_be(:public_architecture_all, freeze: true) { create("debian_#{container_type}_architecture", distribution: public_distribution, name: 'all') } let_it_be(:public_architecture, freeze: true) { create("debian_#{container_type}_architecture", distribution: public_distribution, name: 'existing-arch') } |