Commit 502309c2 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents 8a8c6280 4e3b102b
import Vue from 'vue';
import { parseBoolean } from '~/lib/utils/common_utils';
import PackagesApp from '~/packages/details/components/app.vue';
import createStore from '~/packages/details/store';
import Translate from '~/vue_shared/translate';
Vue.use(Translate);
export default () => {
const el = document.querySelector('#js-vue-packages-detail');
const { package: packageJson, canDelete: canDeleteStr, ...rest } = el.dataset;
const packageEntity = JSON.parse(packageJson);
const canDelete = parseBoolean(canDeleteStr);
const store = createStore({
packageEntity,
packageFiles: packageEntity.package_files,
canDelete,
...rest,
});
return new Vue({
el,
store,
render(createElement) {
return createElement(PackagesApp);
},
});
};
import initDetails from '~/packages_and_registries/infrastructure_registry/details_app_bundle';
initDetails();
......@@ -3,7 +3,6 @@ import { GlModal, GlForm, GlFormCheckbox, GlSprintf, GlFormGroup } from '@gitlab
import { mapActions, mapState } from 'vuex';
import { BV_SHOW_MODAL } from '~/lib/utils/constants';
import csrf from '~/lib/utils/csrf';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import eventHub from '../event_hub';
import BranchesDropdown from './branches_dropdown.vue';
import ProjectsDropdown from './projects_dropdown.vue';
......@@ -18,7 +17,6 @@ export default {
GlSprintf,
GlFormGroup,
},
mixins: [glFeatureFlagsMixin()],
inject: {
prependedText: {
default: '',
......@@ -116,7 +114,7 @@ export default {
<input type="hidden" name="authenticity_token" :value="$options.csrf.token" />
<gl-form-group
v-if="glFeatures.pickIntoProject && isCherryPick"
v-if="isCherryPick"
:label="i18n.projectLabel"
label-for="start_project"
data-testid="dropdown-group"
......
......@@ -18,7 +18,7 @@ module CreatesCommit
@start_branch ||= @ref || @branch_name
start_project = Feature.enabled?(:pick_into_project, @project, default_enabled: :yaml) ? @project_to_commit_into : @project
start_project = @project_to_commit_into
commit_params = @commit_params.merge(
start_project: start_project,
......
......@@ -19,9 +19,6 @@ class Projects::CommitController < Projects::ApplicationController
before_action :define_commit_box_vars, only: [:show, :pipelines]
before_action :define_note_vars, only: [:show, :diff_for_path, :diff_files]
before_action :authorize_edit_tree!, only: [:revert, :cherry_pick]
before_action do
push_frontend_feature_flag(:pick_into_project, @project, default_enabled: :yaml)
end
BRANCH_SEARCH_LIMIT = 1000
COMMIT_DIFFS_PER_PAGE = 20
......@@ -220,7 +217,6 @@ class Projects::CommitController < Projects::ApplicationController
def find_cherry_pick_target_project
return @project if params[:target_project_id].blank?
return @project unless Feature.enabled?(:pick_into_project, @project, default_enabled: :yaml)
MergeRequestTargetProjectFinder
.new(current_user: current_user, source_project: @project, project_feature: :repository)
......
......@@ -3,7 +3,19 @@
module Projects
module Packages
class InfrastructureRegistryController < Projects::ApplicationController
before_action :verify_feature_enabled!
feature_category :infrastructure_as_code
def show
@package = project.packages.find(params[:id])
@package_files = @package.package_files.recent
end
private
def verify_feature_enabled!
render_404 unless Feature.enabled?(:infrastructure_registry_page)
end
end
end
end
......@@ -137,8 +137,6 @@ module CommitsHelper
end
def cherry_pick_projects_data(project)
return [] unless Feature.enabled?(:pick_into_project, project, default_enabled: :yaml)
[project, project.forked_from_project].compact.map do |project|
{
id: project.id.to_s,
......
- add_to_breadcrumbs _("Infrastructure Registry"), project_packages_path(@project)
- add_to_breadcrumbs @package.name, project_packages_path(@project)
- breadcrumb_title @package.version
- page_title _("Infrastructure Registry")
- @content_class = "limit-container-width" unless fluid_layout
.row
.col-12
#js-vue-packages-detail{ data: { package: package_from_presenter(@package),
can_delete: can?(current_user, :destroy_package, @project).to_s,
svg_path: image_path('illustrations/no-packages.svg'),
project_name: @project.name,
project_list_url: project_infrastructure_registry_index_path(@project)} }
---
name: pick_into_project
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/55970
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/324154
milestone: '13.10'
type: development
group: group::source code
default_enabled: true
......@@ -279,9 +279,13 @@ Rails.application.routes.draw do
# Issue https://gitlab.com/gitlab-org/gitlab/-/issues/210024
scope as: 'deprecated' do
draw :snippets
# Issue https://gitlab.com/gitlab-org/gitlab/-/issues/223719
get '/snippets/:id/raw',
to: 'snippets#raw',
format: false,
constraints: { id: /\d+/ }
Gitlab::Routing.redirect_legacy_paths(self, :profile)
Gitlab::Routing.redirect_legacy_paths(self, :profile, :snippets)
end
Gitlab.ee do
......
......@@ -50,7 +50,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
resources :infrastructure_registry, only: [:index], module: :packages
resources :infrastructure_registry, only: [:index, :show], module: :packages
resources :jobs, only: [:index, :show], constraints: { id: /\d+/ } do
collection do
......@@ -567,13 +567,13 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
# Issue https://gitlab.com/gitlab-org/gitlab/issues/118849
draw :repository
# Issue https://gitlab.com/gitlab-org/gitlab/-/issues/29572
resources :snippets, concerns: :awardable, constraints: { id: /\d+/ } do # rubocop: disable Cop/PutProjectRoutesUnderScope
member do
get :raw # rubocop:todo Cop/PutProjectRoutesUnderScope
post :mark_as_spam # rubocop:todo Cop/PutProjectRoutesUnderScope
end
end
# Issue https://gitlab.com/gitlab-org/gitlab/-/issues/223719
# rubocop: disable Cop/PutProjectRoutesUnderScope
get '/snippets/:id/raw',
to: 'snippets#raw',
format: false,
constraints: { id: /\d+/ }
# rubocop: enable Cop/PutProjectRoutesUnderScope
end
# All new routes should go under /-/ scope.
......@@ -589,7 +589,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
:tracing,
:serverless, :clusters, :audit_events, :wikis, :merge_requests,
:vulnerability_feedback, :security, :dependencies, :issues,
:pipelines, :pipeline_schedules)
:pipelines, :pipeline_schedules, :snippets)
end
# rubocop: disable Cop/PutProjectRoutesUnderScope
......
......@@ -63,10 +63,7 @@ git cherry-pick -m 2 7a39eb0
### Cherry-pick into a project
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/21268) in GitLab 13.11.
> - It's [deployed behind a feature flag](../../feature_flags.md), disabled by default.
> - It's disabled on GitLab.com.
> - It's not recommended for production use.
> - To use it in GitLab self-managed instances, ask a GitLab administrator to [enable it](#enable-or-disable-cherry-picking-into-a-project). **(FREE SELF)**
> - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/324154) in GitLab 14.0
WARNING:
This feature might not be available to you. Check the **version history** note above for details.
......@@ -81,25 +78,6 @@ merge request is from a fork:
1. (Optional) Select **Start a new merge request** if you're ready to create a merge request.
1. Click **Cherry-pick**.
### Enable or disable cherry-picking into a project **(FREE SELF)**
Cherry-picking into a project is under development and not ready for production use. It is
deployed behind a feature flag that is **disabled by default**.
[GitLab administrators with access to the GitLab Rails console](../../../administration/feature_flags.md)
can enable it.
To enable it:
```ruby
Feature.enable(:pick_into_project)
```
To disable it:
```ruby
Feature.disable(:pick_into_project)
```
## Related links
- The [Commits API](../../../api/commits.md) enables you to add custom messages
......
......@@ -11,7 +11,7 @@ import DurationChart from './duration_chart.vue';
import FilterBar from './filter_bar.vue';
import Metrics from './metrics.vue';
import PathNavigation from './path_navigation.vue';
import StageTableNew from './stage_table_new.vue';
import StageTable from './stage_table.vue';
import TypeOfWorkCharts from './type_of_work_charts.vue';
import ValueStreamSelect from './value_stream_select.vue';
......@@ -23,7 +23,7 @@ export default {
GlEmptyState,
ProjectsDropdownFilter,
TypeOfWorkCharts,
StageTableNew,
StageTable,
PathNavigation,
FilterBar,
ValueStreamSelect,
......@@ -237,7 +237,7 @@ export default {
/>
<type-of-work-charts />
</template>
<stage-table-new
<stage-table
v-else
:is-loading="isLoading || isLoadingStage"
:stage-events="currentStageEvents"
......
......@@ -31,7 +31,7 @@ const WORKFLOW_COLUMN_TITLES = {
};
export default {
name: 'StageTableNew',
name: 'StageTable',
components: {
GlEmptyState,
GlIcon,
......
......@@ -8,7 +8,7 @@ import DurationChart from 'ee/analytics/cycle_analytics/components/duration_char
import FilterBar from 'ee/analytics/cycle_analytics/components/filter_bar.vue';
import Metrics from 'ee/analytics/cycle_analytics/components/metrics.vue';
import PathNavigation from 'ee/analytics/cycle_analytics/components/path_navigation.vue';
import StageTableNew from 'ee/analytics/cycle_analytics/components/stage_table_new.vue';
import StageTable from 'ee/analytics/cycle_analytics/components/stage_table.vue';
import TypeOfWorkCharts from 'ee/analytics/cycle_analytics/components/type_of_work_charts.vue';
import ValueStreamSelect from 'ee/analytics/cycle_analytics/components/value_stream_select.vue';
import { OVERVIEW_STAGE_ID } from 'ee/analytics/cycle_analytics/constants';
......@@ -167,7 +167,7 @@ describe('Value Stream Analytics component', () => {
};
const displaysStageTable = (flag) => {
expect(wrapper.findComponent(StageTableNew).exists()).toBe(flag);
expect(wrapper.findComponent(StageTable).exists()).toBe(flag);
};
const displaysDurationChart = (flag) => {
......
import { GlEmptyState, GlLoadingIcon, GlTable } from '@gitlab/ui';
import { shallowMount, mount } from '@vue/test-utils';
import StageTableNew from 'ee/analytics/cycle_analytics/components/stage_table_new.vue';
import StageTable from 'ee/analytics/cycle_analytics/components/stage_table.vue';
import { PAGINATION_SORT_FIELD_DURATION } from 'ee/analytics/cycle_analytics/constants';
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
import {
......@@ -33,7 +33,7 @@ const findStageEventTitle = (ev) => extendedWrapper(ev).findByTestId('vsa-stage-
function createComponent(props = {}, shallow = false) {
const func = shallow ? shallowMount : mount;
return extendedWrapper(
func(StageTableNew, {
func(StageTable, {
propsData: {
isLoading: false,
stageEvents: issueEvents,
......
......@@ -380,18 +380,6 @@ RSpec.describe Projects::CommitController do
expect(response).to have_gitlab_http_status(:not_found)
end
end
context 'disable pick_into_project feature flag' do
before do
stub_feature_flags(pick_into_project: false)
end
it 'does not cherry pick a commit from fork to upstream' do
send_request
expect(project.commit('feature').message).not_to include(forked_project.commit.id)
end
end
end
end
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Infrastructure Registry' do
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project) }
before do
sign_in(user)
project.add_maintainer(user)
end
context 'when feature is not available' do
before do
stub_feature_flags(infrastructure_registry_page: false)
end
it 'gives 404' do
visit_project_infrastructure_registry
expect(status_code).to eq(404)
end
end
context 'when feature is available', :js do
before do
visit_project_infrastructure_registry
end
context 'when there are packages' do
let_it_be(:terraform_module) { create(:terraform_module_package, project: project, created_at: 1.day.ago, version: '1.0.0') }
let_it_be(:terraform_module2) { create(:terraform_module_package, project: project, created_at: 2.days.ago, version: '2.0.0') }
let_it_be(:packages) { [terraform_module, terraform_module2] }
it_behaves_like 'packages list'
context 'deleting a package' do
let_it_be(:project) { create(:project) }
let_it_be(:terraform_module) { create(:terraform_module_package, project: project) }
it 'allows you to delete a module', :aggregate_failures do
# this is still using the package copy in the UI too
click_button('Remove package')
click_button('Delete package')
expect(page).to have_content 'Package deleted successfully'
expect(page).not_to have_content(terraform_module.name)
end
end
end
it 'displays the empty message' do
expect(page).to have_content('You have no Terraform modules in your project')
end
end
def visit_project_infrastructure_registry
visit project_infrastructure_registry_index_path(project)
end
end
......@@ -159,12 +159,7 @@ describe('CommitFormModal', () => {
});
it('Changes the target_project_id input value', async () => {
createComponent(
shallowMount,
{},
{ glFeatures: { pickIntoProject: true } },
{ isCherryPick: true },
);
createComponent(shallowMount, {}, {}, { isCherryPick: true });
findProjectsDropdown().vm.$emit('selectProject', '_changed_project_value_');
await wrapper.vm.$nextTick();
......
......@@ -205,16 +205,6 @@ RSpec.describe CommitsHelper do
{ id: forked_project.id.to_s, name: forked_project.full_path, refsUrl: refs_project_path(forked_project) }
])
end
context 'pick_into_project is disabled' do
before do
stub_feature_flags(pick_into_project: false)
end
it 'does not calculate target projects' do
expect(helper.cherry_pick_projects_data(project)).to eq([])
end
end
end
describe "#commit_options_dropdown_data" do
......
......@@ -113,7 +113,7 @@ RSpec.describe Gitlab::PathRegex do
let(:deprecated_routes) do
# profile was deprecated in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/51646
%w(profile)
%w(profile s)
end
let(:ee_top_level_words) do
......
......@@ -320,9 +320,11 @@ RSpec.describe 'project routing' do
expect(get('/gitlab/gitlabhq/-/snippets/1')).to route_to('projects/snippets#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1')
end
it 'to #show from unscope routing' do
expect(get('/gitlab/gitlabhq/snippets/1')).to route_to('projects/snippets#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1')
it 'to #raw from unscope routing' do
expect(get('/gitlab/gitlabhq/snippets/1/raw')).to route_to('projects/snippets#raw', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1')
end
it_behaves_like 'redirecting a legacy path', '/gitlab/gitlabhq/snippets/1', '/gitlab/gitlabhq/-/snippets/1'
end
# test_project_hook POST /:project_id/-/hooks/:id/test(.:format) hooks#test
......
......@@ -96,9 +96,11 @@ RSpec.describe SnippetsController, "routing" do
expect(get("/-/snippets/1")).to route_to('snippets#show', id: '1')
end
it 'to #show from unscoped routing' do
expect(get("/snippets/1")).to route_to('snippets#show', id: '1')
it 'to #raw from unscoped routing' do
expect(get("/snippets/1/raw")).to route_to('snippets#raw', id: '1')
end
it_behaves_like 'redirecting a legacy path', '/snippets/1', '/-/snippets/1'
end
# help GET /help(.:format) help#index
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment