Commit b375c6c0 authored by GitLab Bot's avatar GitLab Bot

Add latest changes from gitlab-org/gitlab@master

parent 988b28ec
......@@ -69,7 +69,7 @@ review-build-cng:
variables:
HOST_SUFFIX: "${CI_ENVIRONMENT_SLUG}"
DOMAIN: "-${CI_ENVIRONMENT_SLUG}.${REVIEW_APPS_DOMAIN}"
GITLAB_HELM_CHART_REF: "v2.5.1"
GITLAB_HELM_CHART_REF: "v2.6.8"
GITLAB_EDITION: "ce"
environment:
name: review/${CI_COMMIT_REF_NAME}
......
......@@ -383,7 +383,7 @@ group :development, :test do
gem 'simple_po_parser', '~> 1.1.2', require: false
gem 'timecop', '~> 0.8.0'
gem 'timecop', '~> 0.9.1'
gem 'png_quantizator', '~> 0.2.1', require: false
......
......@@ -1065,7 +1065,7 @@ GEM
thread_safe (0.3.6)
thrift (0.11.0.0)
tilt (2.0.10)
timecop (0.8.1)
timecop (0.9.1)
timfel-krb5-auth (0.8.3)
toml (0.2.0)
parslet (~> 1.8.0)
......@@ -1387,7 +1387,7 @@ DEPENDENCIES
sys-filesystem (~> 1.1.6)
test-prof (~> 0.10.0)
thin (~> 1.7.0)
timecop (~> 0.8.0)
timecop (~> 0.9.1)
toml-rb (~> 1.0.0)
truncato (~> 0.7.11)
u2f (~> 0.2.1)
......
......@@ -4,6 +4,7 @@ import AjaxVariableList from '~/ci_variable_list/ajax_variable_list';
import registrySettingsApp from '~/registry/settings/registry_settings_bundle';
import initVariableList from '~/ci_variable_list';
import DueDateSelectors from '~/due_date_select';
import initDeployKeys from '~/deploy_keys';
document.addEventListener('DOMContentLoaded', () => {
// Initialize expandable settings panels
......@@ -44,4 +45,5 @@ document.addEventListener('DOMContentLoaded', () => {
new DueDateSelectors();
registrySettingsApp();
initDeployKeys();
});
......@@ -3,7 +3,6 @@
import ProtectedTagCreate from '~/protected_tags/protected_tag_create';
import ProtectedTagEditList from '~/protected_tags/protected_tag_edit_list';
import initSettingsPanels from '~/settings_panels';
import initDeployKeys from '~/deploy_keys';
import ProtectedBranchCreate from '~/protected_branches/protected_branch_create';
import ProtectedBranchEditList from '~/protected_branches/protected_branch_edit_list';
import DueDateSelectors from '~/due_date_select';
......@@ -12,7 +11,6 @@ import fileUpload from '~/lib/utils/file_upload';
export default () => {
new ProtectedTagCreate();
new ProtectedTagEditList();
initDeployKeys();
initSettingsPanels();
new ProtectedBranchCreate();
new ProtectedBranchEditList();
......
......@@ -244,6 +244,8 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
def render_update_error
action = valid_setting_panels.include?(action_name) ? action_name : :general
flash[:alert] = _('Application settings update failed')
render action
end
......
# frozen_string_literal: true
class Projects::DeployKeysController < Projects::ApplicationController
include RepositorySettingsRedirect
respond_to :html
# Authorize
......@@ -12,7 +11,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
def index
respond_to do |format|
format.html { redirect_to_repository_settings(@project, anchor: 'js-deploy-keys-settings') }
format.html { redirect_to_ci_cd_settings }
format.json do
render json: Projects::Settings::DeployKeysPresenter.new(@project, current_user: current_user).as_json
end
......@@ -20,7 +19,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
end
def new
redirect_to_repository_settings(@project, anchor: 'js-deploy-keys-settings')
redirect_to_ci_cd_settings
end
def create
......@@ -30,7 +29,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
flash[:alert] = @key.errors.full_messages.join(', ').html_safe
end
redirect_to_repository_settings(@project, anchor: 'js-deploy-keys-settings')
redirect_to_ci_cd_settings
end
def edit
......@@ -39,7 +38,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
def update
if deploy_key.update(update_params)
flash[:notice] = _('Deploy key was successfully updated.')
redirect_to_repository_settings(@project, anchor: 'js-deploy-keys-settings')
redirect_to_ci_cd_settings
else
render 'edit'
end
......@@ -51,7 +50,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
return render_404 unless key
respond_to do |format|
format.html { redirect_to_repository_settings(@project, anchor: 'js-deploy-keys-settings') }
format.html { redirect_to_ci_cd_settings }
format.json { head :ok }
end
end
......@@ -62,7 +61,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
return render_404 unless deploy_key_project
respond_to do |format|
format.html { redirect_to_repository_settings(@project, anchor: 'js-deploy-keys-settings') }
format.html { redirect_to_ci_cd_settings }
format.json { head :ok }
end
end
......@@ -97,4 +96,8 @@ class Projects::DeployKeysController < Projects::ApplicationController
access_denied!
end
end
def redirect_to_ci_cd_settings
redirect_to project_settings_ci_cd_path(@project, anchor: 'js-deploy-keys-settings')
end
end
......@@ -101,6 +101,7 @@ module Projects
define_triggers_variables
define_badges_variables
define_auto_devops_variables
define_deploy_keys
end
def define_runners_variables
......@@ -153,6 +154,10 @@ module Projects
@new_deploy_token = DeployToken.new
end
def define_deploy_keys
@deploy_keys = DeployKeysPresenter.new(@project, current_user: current_user)
end
end
end
end
......
......@@ -27,8 +27,6 @@ module Projects
private
def render_show
@deploy_keys = DeployKeysPresenter.new(@project, current_user: current_user)
define_protected_refs
remote_mirror
......
......@@ -167,7 +167,10 @@ module Ci
target_revision: {
ref: target_ref || downstream_project.default_branch
},
execute_params: { ignore_skip_ci: true }
execute_params: {
ignore_skip_ci: true,
bridge: self
}
}
end
......
......@@ -130,7 +130,7 @@ class Namespace < ApplicationRecord
return unless host.ends_with?(gitlab_host)
name = host.delete_suffix(gitlab_host)
Namespace.find_by_full_path(name)
Namespace.find_by_path(name)
end
# overridden in ee
......
......@@ -20,12 +20,6 @@ module Ci
service.execute(
pipeline_params.fetch(:source), pipeline_params[:execute_params]) do |pipeline|
@bridge.sourced_pipelines.build(
source_pipeline: @bridge.pipeline,
source_project: @bridge.project,
project: @bridge.downstream_project,
pipeline: pipeline)
pipeline.variables.build(@bridge.downstream_variables)
end
end
......
......@@ -7,6 +7,7 @@ module Ci
CreateError = Class.new(StandardError)
SEQUENCE = [Gitlab::Ci::Pipeline::Chain::Build,
Gitlab::Ci::Pipeline::Chain::Build::Associations,
Gitlab::Ci::Pipeline::Chain::Validate::Abilities,
Gitlab::Ci::Pipeline::Chain::Validate::Repository,
Gitlab::Ci::Pipeline::Chain::Config::Content,
......
......@@ -54,6 +54,8 @@
= render "shared/deploy_tokens/index", group_or_project: @project, description: deploy_token_description
= render @deploy_keys
%section.settings.no-animate#js-pipeline-triggers{ class: ('expanded' if expanded) }
.settings-header
%h4
......
......@@ -11,8 +11,6 @@
-# Those are used throughout the actual views. These `shared` views are then
-# reused in EE.
= render "projects/settings/repository/protected_branches"
= render @deploy_keys
= render "projects/cleanup/show"
= render_if_exists 'shared/promotions/promote_repository_features'
---
title: Allow issues/merge_requests as an issuable_type in Insights configuration
merge_request: 26061
author:
type: added
---
title: Moved Deploy Keys from Repository to CI/CD settings.
merge_request: 25444
author:
type: changed
---
title: Move issues routes under /-/ scope
merge_request: 24791
author:
type: changed
......@@ -279,6 +279,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
draw :issues
draw :merge_requests
# The wiki and repository routing contains wildcard characters so
......@@ -401,12 +402,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
# Unscoped route. It will be replaced with redirect to /-/issues/
# Issue https://gitlab.com/gitlab-org/gitlab/issues/118849
draw :issues
# To ensure an old unscoped routing is used for the UI we need to
# add prefix 'as' to the scope routing and place it below original routing.
# Issue https://gitlab.com/gitlab-org/gitlab/issues/118849
scope '-', as: 'scoped' do
scope as: 'deprecated' do
draw :issues
end
......
# Frontend dependencies
## Package manager
We use [Yarn](https://yarnpkg.com/) to manage frontend dependencies. There are a few exceptions:
- [FontAwesome](https://fontawesome.com/), installed via the `font-awesome-rails` gem: we are working to replace it with
[GitLab SVGs](https://gitlab-org.gitlab.io/gitlab-svgs/) icons library.
- [ACE](https://ace.c9.io/) editor, installed via the `ace-rails-ap` gem.
- Other dependencies found under `vendor/assets/`.
## Updating dependencies
### Renovate GitLab Bot
We use the [Renovate GitLab Bot](https://gitlab.com/gitlab-org/frontend/renovate-gitlab-bot) to
automatically create merge requests for updating dependencies of several projects. You can find the
up-to-date list of projects managed by the renovate bot in the project’s README. Some key dependencies
updated using renovate are:
- [`@gitlab/ui`](https://gitlab.com/gitlab-org/gitlab-ui/)
- [`@gitlab/svgs`](https://gitlab.com/gitlab-org/gitlab-svgs/)
- [`@gitlab/eslint-config`](https://gitlab.com/gitlab-org/gitlab-eslint-config)
### Blocked dependencies
We discourage installing some dependencies in [GitLab repository](https://gitlab.com/gitlab-org/gitlab)
because they can create conflicts in the dependency tree. Blocked dependencies are declared in the
`blockDependencies` property of GitLab’s [`package.json` file](https://gitlab.com/gitlab-org/gitlab/-/blob/master/package.json).
## Dependency notes
### BootstrapVue
[BootstrapVue](https://bootstrap-vue.js.org/) is a component library built with Vue.js and Bootstrap.
We wrap BootstrapVue components in [GitLab UI](https://gitlab.com/gitlab-org/gitlab-ui/) with the
purpose of applying visual styles and usage guidelines specified in the
[Pajamas Design System](https://design.gitlab.com/). For this reason, we recommend not installing
BootstrapVue directly in the GitLab repository. Instead create a wrapper of the BootstrapVue
component you want to use in GitLab UI first.
......@@ -23,22 +23,22 @@ Use [BrowserStack](https://www.browserstack.com/) to test with our supported bro
Current high-level frontend goals are listed on [Frontend Epics](https://gitlab.com/groups/gitlab-org/-/epics?label_name%5B%5D=frontend).
## [Principles](principles.md)
## Principles
High-level guidelines for contributing to GitLab.
[High-level guidelines](principles.md) for contributing to GitLab.
## [Development Process](development_process.md)
## Development Process
How we plan and execute the work on the frontend.
How we [plan and execute](development_process.md) the work on the frontend.
## [Architecture](architecture.md)
## Architecture
How we go about making fundamental design decisions in GitLab's frontend team
How we go about [making fundamental design decisions](architecture.md) in GitLab's frontend team
or make changes to our frontend development guidelines.
## [Testing](../testing_guide/frontend_testing.md)
## Testing
How we write frontend tests, run the GitLab test suite, and debug test related
How we write [frontend tests](../testing_guide/frontend_testing.md), run the GitLab test suite, and debug test related
issues.
## Pajamas Design System
......@@ -46,29 +46,33 @@ issues.
Reusable components with technical and usage guidelines can be found in our
[Pajamas Design System](https://design.gitlab.com/).
## [Design Patterns](design_patterns.md)
## Design Patterns
Common JavaScript design patterns in GitLab's codebase.
Common JavaScript [design patterns](design_patterns.md) in GitLab's codebase.
## [Vue.js Best Practices](vue.md)
## Vue.js Best Practices
Vue specific design patterns and practices.
Vue specific [design patterns and practices](vue.md).
## [Vuex](vuex.md)
## Vuex
Vuex specific design patterns and practices.
[Vuex](vuex.md) specific design patterns and practices.
## [Axios](axios.md)
## Axios
Axios specific practices and gotchas.
[Axios](axios.md) specific practices and gotchas.
## [GraphQL](graphql.md)
## GraphQL
How to use GraphQL
How to use [GraphQL](graphql.md).
## [Icons and Illustrations](icons.md)
## Icons and Illustrations
How we use SVG for our Icons and Illustrations.
How we use SVG for our [Icons and Illustrations](icons.md).
## Dependencies
General information about frontend [dependencies](dependencies.md) and how we manage them.
## Frontend FAQ
......
......@@ -344,7 +344,7 @@ Integration (CI) server. By using deploy keys, you don't have to set up a
dummy user account.
If you are a project maintainer or owner, you can add a deploy key in the
project's **Settings > Repository** page by expanding the
project's **{settings}** **Settings > CI / CD** page by expanding the
**Deploy Keys** section. Specify a title for the new
deploy key and paste a public SSH key. After this, the machine that uses
the corresponding private SSH key has read-only or read-write (if enabled)
......@@ -387,7 +387,7 @@ of broader usage for something like "Anywhere you need to give read access to
your repository".
Once a GitLab administrator adds the Global Deployment key, project maintainers
and owners can add it in project's **Settings > Repository** page by expanding the
and owners can add it in project's **{settings}** **Settings > CI / CD** page by expanding the
**Deploy Keys** section and clicking **Enable** next to the appropriate key listed
under **Public deploy keys available to any project**.
......
......@@ -268,6 +268,14 @@ https://example.gitlab.com/<namespace>/<project>/badges/<branch>/coverage.svg?st
[Environment variables](../../../ci/variables/README.html#gitlab-cicd-environment-variables) can be set in an environment to be available to a runner.
## Deploy Keys
With Deploy Keys, GitLab allows you to import SSH public keys. You can then have
read only or read/write access to your project from the machines the keys were generated from.
SSH keys added to your project settings will be used for continuous integration,
staging, or production servers.
<!-- ## Troubleshooting
Include any troubleshooting steps that you can foresee. If you know beforehand what issues
......
......@@ -75,7 +75,7 @@ ready.
To keep files in the repository organized it is often helpful to create a new
directory.
From a project's files page, click the '+' button to the right of the branch selector.
From a project's files page, click the plus button (`+`) to the right of the branch selector.
Choose **New directory** from the dropdown.
![New directory dropdown](img/web_editor_new_directory_dropdown.png)
......@@ -91,14 +91,21 @@ There are multiple ways to create a branch from GitLab's web interface.
### Create a new branch from an issue
> [Introduced][ce-2808] in GitLab 8.6.
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/2808) in GitLab 8.6.
If your development workflow dictates to have an issue for every merge
request, you can quickly create a branch directly from the issue to speed the process up.
The new branch, and later its merge request, will be marked as related to this issue.
Once merged, the MR will automatically close the issue.
You can see a **Create merge request** dropdown below the issue description.
In case your development workflow dictates to have an issue for every merge
request, you can quickly create a branch right on the issue page which will be
tied with the issue itself. You can see a **Create merge request** dropdown
below the issue description unless there is already a branch with the same
name or a referenced merge request or your project (still) has an active
[fork relationship](../settings/index.md#advanced-settings).
NOTE: **Note:**
You won't see the **Create merge request** button if there is already a branch with the same
name or a referenced merge request or your project has an active
fork relationship.
If you would like to make this button appear, a possible workaround is to [remove your project's
fork relationship](../settings/index.md#removing-a-fork-relationship). Once removed, the fork
relationship cannot be restored and you will no longer be able to send merge requests to the source.
![Create Button](img/web_editor_new_branch_from_issue_create_button_v12_6.png)
......@@ -181,8 +188,6 @@ If you'd prefer _not_ to use your primary email address for commits created
through the web editor, you can choose to use another of your linked email
addresses from the **User Settings > Edit Profile** page.
[ce-2808]: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/2808
<!-- ## Troubleshooting
Include any troubleshooting steps that you can foresee. If you know beforehand what issues
......
......@@ -215,9 +215,12 @@ To remove a project:
This action either:
- Removes a project including all associated resources (issues, merge requests etc).
- Since [GitLab 12.6](https://gitlab.com/gitlab-org/gitlab/issues/32935), on [Premium or Silver](https://about.gitlab.com/pricing/) or higher tiers, marks a project for deletion. The deletion will happen 7 days later by default, but this can be changed in the [instance settings](../../admin_area/settings/visibility_and_access_controls.md#default-deletion-adjourned-period-premium-only).
- Since [GitLab 12.6](https://gitlab.com/gitlab-org/gitlab/issues/32935), on
[GitLab Premium or GitLab.com Silver](https://about.gitlab.com/pricing/) or higher tiers, marks a project for
deletion. The deletion will happen 7 days later by default, but this can be changed in the
[instance settings](../../admin_area/settings/visibility_and_access_controls.md#default-deletion-adjourned-period-premium-only).
### Restore a project **(PREMIUM)**
#### Restore a project **(PREMIUM)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/32935) in GitLab 12.6.
......@@ -234,6 +237,9 @@ If you want to use the fork for yourself and don't need to send
[merge requests](../merge_requests.md) to the upstream project,
you can safely remove the fork relationship.
CAUTION: **Caution:**
Once removed, the fork relationship cannot be restored. You will no longer be able to send merge requests to the source, and if anyone has forked your project, their fork will also lose the relationship.
To do so:
1. Navigate to your project's **Settings > General > Advanced**.
......
......@@ -22,11 +22,18 @@ module Banzai
doc
end
# Implement in child class.
# Child class must provide the metrics_dashboard_url.
#
# Return a Nokogiri::XML::Element to embed in the
# markdown.
# markdown which provides a url to the metric_dashboard endpoint where
# data can be requested through a prometheus proxy. InlineMetricsRedactorFilter
# is responsible for premissions to see this div (and relies on the class 'js-render-metrics' ).
def create_element(params)
doc.document.create_element(
'div',
class: 'js-render-metrics',
'data-dashboard-url': metrics_dashboard_url(params)
)
end
# Implement in child class unless overriding #embed_params
......@@ -71,6 +78,13 @@ module Banzai
Gitlab::Metrics::Dashboard::Url.parse_query(url)
end
end
# Implement in child class.
#
# Provides a full url to request the relevant panels of metric data.
def metrics_dashboard_url
raise NotImplementedError
end
end
end
end
......@@ -10,11 +10,7 @@ module Banzai
def create_element(params)
begin_loading_dashboard(params[:url])
doc.document.create_element(
'div',
class: 'js-render-metrics',
'data-dashboard-url': metrics_dashboard_url(params)
)
super
end
def embed_params(node)
......
......@@ -5,16 +5,6 @@ module Banzai
# HTML filter that inserts a placeholder element for each
# reference to a metrics dashboard.
class InlineMetricsFilter < Banzai::Filter::InlineEmbedsFilter
# Placeholder element for the frontend to use as an
# injection point for charts.
def create_element(params)
doc.document.create_element(
'div',
class: 'js-render-metrics',
'data-dashboard-url': metrics_dashboard_url(params)
)
end
# Search params for selecting metrics links. A few
# simple checks is enough to boost performance without
# the cost of doing a full regex match.
......
# frozen_string_literal: true
module Gitlab
module Ci
module Pipeline
module Chain
class Build
class Associations < Chain::Base
def perform!
return unless @command.bridge
@pipeline.build_source_pipeline(
source_pipeline: @command.bridge.pipeline,
source_project: @command.bridge.project,
source_bridge: @command.bridge,
project: @command.project
)
end
def break?
false
end
end
end
end
end
end
end
......@@ -2066,6 +2066,9 @@ msgstr ""
msgid "Application settings saved successfully"
msgstr ""
msgid "Application settings update failed"
msgstr ""
msgid "Application uninstalled but failed to destroy: %{error_message}"
msgstr ""
......
......@@ -6,12 +6,11 @@ module QA
it 'user creates an event in the activity page upon Git push' do
Flow::Login.sign_in
project_push = Resource::Repository::ProjectPush.fabricate! do |push|
Resource::Repository::ProjectPush.fabricate! do |push|
push.file_name = 'README.md'
push.file_content = '# This is a test project'
push.commit_message = 'Add README.md'
end
project_push.project.visit!
end.project.visit!
Page::Project::Menu.perform(&:click_activity)
Page::Project::Activity.perform(&:click_push_events)
......
......@@ -19,10 +19,10 @@ describe Projects::DeployKeysController do
end
context 'when html requested' do
it 'redirects to project settings with the correct anchor' do
it 'redirects to project ci / cd settings with the correct anchor' do
get :index, params: params
expect(response).to redirect_to(project_settings_repository_path(project, anchor: 'js-deploy-keys-settings'))
expect(response).to redirect_to(project_settings_ci_cd_path(project, anchor: 'js-deploy-keys-settings'))
end
end
......@@ -87,13 +87,13 @@ describe Projects::DeployKeysController do
it 'creates a new deploy key for the project' do
expect { post :create, params: create_params }.to change(project.deploy_keys, :count).by(1)
expect(response).to redirect_to(project_settings_repository_path(project, anchor: 'js-deploy-keys-settings'))
expect(response).to redirect_to(project_settings_ci_cd_path(project, anchor: 'js-deploy-keys-settings'))
end
it 'redirects to project settings with the correct anchor' do
post :create, params: create_params
expect(response).to redirect_to(project_settings_repository_path(project, anchor: 'js-deploy-keys-settings'))
expect(response).to redirect_to(project_settings_ci_cd_path(project, anchor: 'js-deploy-keys-settings'))
end
context 'when the deploy key is invalid' do
......@@ -153,7 +153,7 @@ describe Projects::DeployKeysController do
expect(DeployKeysProject.where(project_id: project.id, deploy_key_id: deploy_key.id).count).to eq(1)
expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(namespace_project_settings_repository_path(anchor: 'js-deploy-keys-settings'))
expect(response).to redirect_to(namespace_project_settings_ci_cd_path(anchor: 'js-deploy-keys-settings'))
end
it 'returns 404' do
......@@ -175,7 +175,7 @@ describe Projects::DeployKeysController do
expect(DeployKeysProject.where(project_id: project.id, deploy_key_id: deploy_key.id).count).to eq(1)
expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(namespace_project_settings_repository_path(anchor: 'js-deploy-keys-settings'))
expect(response).to redirect_to(namespace_project_settings_ci_cd_path(anchor: 'js-deploy-keys-settings'))
end
end
end
......@@ -216,7 +216,7 @@ describe Projects::DeployKeysController do
put :disable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(namespace_project_settings_repository_path(anchor: 'js-deploy-keys-settings'))
expect(response).to redirect_to(namespace_project_settings_ci_cd_path(anchor: 'js-deploy-keys-settings'))
expect { DeployKey.find(deploy_key.id) }.to raise_error(ActiveRecord::RecordNotFound)
end
......@@ -239,7 +239,7 @@ describe Projects::DeployKeysController do
end.to change { DeployKey.count }.by(-1)
expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(namespace_project_settings_repository_path(anchor: 'js-deploy-keys-settings'))
expect(response).to redirect_to(namespace_project_settings_ci_cd_path(anchor: 'js-deploy-keys-settings'))
expect { DeployKey.find(deploy_key.id) }.to raise_error(ActiveRecord::RecordNotFound)
end
......
......@@ -17,9 +17,9 @@ describe 'Project deploy keys', :js do
end
it 'removes association between project and deploy key' do
visit project_settings_repository_path(project)
visit project_settings_ci_cd_path(project)
page.within(find('.deploy-keys')) do
page.within(find('.qa-deploy-keys-settings')) do
expect(page).to have_selector('.deploy-key', count: 1)
accept_confirm { find('.ic-remove').click }
......
......@@ -2,10 +2,10 @@
require 'spec_helper'
describe 'Projects > Settings > CI/CD settings' do
let(:project) { create(:project_empty_repo) }
let(:user) { create(:user) }
let(:role) { :maintainer }
describe 'Projects > Settings > CI / CD settings' do
let_it_be(:project) { create(:project_empty_repo) }
let_it_be(:user) { create(:user) }
let_it_be(:role) { :maintainer }
context 'Deploy tokens' do
let!(:deploy_token) { create(:deploy_token, projects: [project]) }
......@@ -21,4 +21,92 @@ describe 'Projects > Settings > CI/CD settings' do
let(:entity_type) { 'project' }
end
end
context 'Deploy Keys', :js do
let_it_be(:private_deploy_key) { create(:deploy_key, title: 'private_deploy_key', public: false) }
let_it_be(:public_deploy_key) { create(:another_deploy_key, title: 'public_deploy_key', public: true) }
let(:new_ssh_key) { attributes_for(:key)[:key] }
before do
project.add_role(user, role)
sign_in(user)
end
it 'get list of keys' do
project.deploy_keys << private_deploy_key
project.deploy_keys << public_deploy_key
visit project_settings_ci_cd_path(project)
expect(page).to have_content('private_deploy_key')
expect(page).to have_content('public_deploy_key')
end
it 'add a new deploy key' do
visit project_settings_ci_cd_path(project)
fill_in 'deploy_key_title', with: 'new_deploy_key'
fill_in 'deploy_key_key', with: new_ssh_key
check 'deploy_key_deploy_keys_projects_attributes_0_can_push'
click_button 'Add key'
expect(page).to have_content('new_deploy_key')
expect(page).to have_content('Write access allowed')
end
it 'edit an existing deploy key' do
project.deploy_keys << private_deploy_key
visit project_settings_ci_cd_path(project)
find('.deploy-key', text: private_deploy_key.title).find('.ic-pencil').click
fill_in 'deploy_key_title', with: 'updated_deploy_key'
check 'deploy_key_deploy_keys_projects_attributes_0_can_push'
click_button 'Save changes'
expect(page).to have_content('updated_deploy_key')
expect(page).to have_content('Write access allowed')
end
it 'edit an existing public deploy key to be writable' do
project.deploy_keys << public_deploy_key
visit project_settings_ci_cd_path(project)
find('.deploy-key', text: public_deploy_key.title).find('.ic-pencil').click
check 'deploy_key_deploy_keys_projects_attributes_0_can_push'
click_button 'Save changes'
expect(page).to have_content('public_deploy_key')
expect(page).to have_content('Write access allowed')
end
it 'edit a deploy key from projects user has access to' do
project2 = create(:project_empty_repo)
project2.add_role(user, role)
project2.deploy_keys << private_deploy_key
visit project_settings_ci_cd_path(project)
find('.js-deployKeys-tab-available_project_keys').click
find('.deploy-key', text: private_deploy_key.title).find('.ic-pencil').click
fill_in 'deploy_key_title', with: 'updated_deploy_key'
click_button 'Save changes'
find('.js-deployKeys-tab-available_project_keys').click
expect(page).to have_content('updated_deploy_key')
end
it 'remove an existing deploy key' do
project.deploy_keys << private_deploy_key
visit project_settings_ci_cd_path(project)
accept_confirm { find('.deploy-key', text: private_deploy_key.title).find('.ic-remove').click }
expect(page).not_to have_content(private_deploy_key.title)
end
end
end
......@@ -25,89 +25,6 @@ describe 'Projects > Settings > Repository settings' do
context 'for maintainer' do
let(:role) { :maintainer }
context 'Deploy Keys', :js do
let(:private_deploy_key) { create(:deploy_key, title: 'private_deploy_key', public: false) }
let(:public_deploy_key) { create(:another_deploy_key, title: 'public_deploy_key', public: true) }
let(:new_ssh_key) { attributes_for(:key)[:key] }
it 'get list of keys' do
project.deploy_keys << private_deploy_key
project.deploy_keys << public_deploy_key
visit project_settings_repository_path(project)
expect(page).to have_content('private_deploy_key')
expect(page).to have_content('public_deploy_key')
end
it 'add a new deploy key' do
visit project_settings_repository_path(project)
fill_in 'deploy_key_title', with: 'new_deploy_key'
fill_in 'deploy_key_key', with: new_ssh_key
check 'deploy_key_deploy_keys_projects_attributes_0_can_push'
click_button 'Add key'
expect(page).to have_content('new_deploy_key')
expect(page).to have_content('Write access allowed')
end
it 'edit an existing deploy key' do
project.deploy_keys << private_deploy_key
visit project_settings_repository_path(project)
find('.deploy-key', text: private_deploy_key.title).find('.ic-pencil').click
fill_in 'deploy_key_title', with: 'updated_deploy_key'
check 'deploy_key_deploy_keys_projects_attributes_0_can_push'
click_button 'Save changes'
expect(page).to have_content('updated_deploy_key')
expect(page).to have_content('Write access allowed')
end
it 'edit an existing public deploy key to be writable' do
project.deploy_keys << public_deploy_key
visit project_settings_repository_path(project)
find('.deploy-key', text: public_deploy_key.title).find('.ic-pencil').click
check 'deploy_key_deploy_keys_projects_attributes_0_can_push'
click_button 'Save changes'
expect(page).to have_content('public_deploy_key')
expect(page).to have_content('Write access allowed')
end
it 'edit a deploy key from projects user has access to' do
project2 = create(:project_empty_repo)
project2.add_role(user, role)
project2.deploy_keys << private_deploy_key
visit project_settings_repository_path(project)
find('.js-deployKeys-tab-available_project_keys').click
find('.deploy-key', text: private_deploy_key.title).find('.ic-pencil').click
fill_in 'deploy_key_title', with: 'updated_deploy_key'
click_button 'Save changes'
find('.js-deployKeys-tab-available_project_keys').click
expect(page).to have_content('updated_deploy_key')
end
it 'remove an existing deploy key' do
project.deploy_keys << private_deploy_key
visit project_settings_repository_path(project)
accept_confirm { find('.deploy-key', text: private_deploy_key.title).find('.ic-remove').click }
expect(page).not_to have_content(private_deploy_key.title)
end
end
context 'remote mirror settings' do
let(:user2) { create(:user) }
......
......@@ -20,7 +20,7 @@ describe "User interacts with deploy keys", :js do
click_button("Enable")
expect(page).not_to have_selector(".fa-spinner")
expect(current_path).to eq(project_settings_repository_path(project))
expect(current_path).to eq(project_settings_ci_cd_path(project))
find(".js-deployKeys-tab-enabled_keys").click
......@@ -96,7 +96,7 @@ describe "User interacts with deploy keys", :js do
click_button("Add key")
expect(current_path).to eq(project_settings_repository_path(project))
expect(current_path).to eq(project_settings_ci_cd_path(project))
page.within(".deploy-keys") do
expect(page).to have_content(DEPLOY_KEY_TITLE)
......
......@@ -64,7 +64,7 @@ describe AwardEmojiHelper do
it 'returns correct url' do
@project = issue.project
expected_url = "/#{@project.namespace.path}/#{@project.path}/issues/#{issue.iid}/toggle_award_emoji"
expected_url = "/#{@project.namespace.path}/#{@project.path}/-/issues/#{issue.iid}/toggle_award_emoji"
expect(subject).to eq(expected_url)
end
......
......@@ -11,7 +11,7 @@ describe BoardsHelper do
@project = project
@board = create(:board, project: @project)
expect(build_issue_link_base).to eq("/#{@project.namespace.path}/#{@project.path}/issues")
expect(build_issue_link_base).to eq("/#{@project.namespace.path}/#{@project.path}/-/issues")
end
end
......
......@@ -110,7 +110,7 @@ describe EventsHelper do
it 'returns a project issue url' do
event.target = create(:note_on_issue, note: 'nice work')
expect(subject).to eq("#{project_base_url}/issues/#{event.note_target.iid}#note_#{event.target.id}")
expect(subject).to eq("#{project_base_url}/-/issues/#{event.note_target.iid}#note_#{event.target.id}")
end
it 'returns a merge request url' do
......
......@@ -183,8 +183,8 @@ describe IssuablesHelper do
@project = issue.project
expected_data = {
endpoint: "/#{@project.full_path}/issues/#{issue.iid}",
updateEndpoint: "/#{@project.full_path}/issues/#{issue.iid}.json",
endpoint: "/#{@project.full_path}/-/issues/#{issue.iid}",
updateEndpoint: "/#{@project.full_path}/-/issues/#{issue.iid}.json",
canUpdate: true,
canDestroy: true,
issuableRef: "##{issue.iid}",
......
......@@ -200,7 +200,7 @@ describe IssuesHelper do
shared_examples 'successfully displays link to issue and with css class' do |action|
it 'returns link' do
link = "<a class=\"#{css_class}\" href=\"/#{new_issue.project.full_path}/issues/#{new_issue.iid}\">(#{action})</a>"
link = "<a class=\"#{css_class}\" href=\"/#{new_issue.project.full_path}/-/issues/#{new_issue.iid}\">(#{action})</a>"
expect(helper.issue_closed_link(issue, user, css_class: css_class)).to match(link)
end
......
......@@ -56,7 +56,7 @@ describe LabelsHelper do
context 'without subject' do
it "uses the label's project" do
expect(link_to_label(label_presenter)).to match %r{<a.*href="/#{label.project.full_path}/issues\?label_name%5B%5D=#{label.name}".*>.*</a>}m
expect(link_to_label(label_presenter)).to match %r{<a.*href="/#{label.project.full_path}/-/issues\?label_name%5B%5D=#{label.name}".*>.*</a>}m
end
end
......@@ -65,7 +65,7 @@ describe LabelsHelper do
let(:subject) { build(:project, namespace: namespace, name: 'bar3') }
it 'links to project issues page' do
expect(link_to_label(label_presenter)).to match %r{<a.*href="/foo3/bar3/issues\?label_name%5B%5D=#{label.name}".*>.*</a>}m
expect(link_to_label(label_presenter)).to match %r{<a.*href="/foo3/bar3/-/issues\?label_name%5B%5D=#{label.name}".*>.*</a>}m
end
end
......@@ -78,15 +78,7 @@ describe LabelsHelper do
end
context 'with a type argument' do
['issue', :issue].each do |type|
context "set to #{type}" do
it 'links to correct page' do
expect(link_to_label(label_presenter, type: type)).to match %r{<a.*href="/#{label.project.full_path}/#{type.to_s.pluralize}\?label_name%5B%5D=#{label.name}".*>.*</a>}m
end
end
end
['merge_request', :merge_request].each do |type|
['issue', :issue, 'merge_request', :merge_request].each do |type|
context "set to #{type}" do
it 'links to correct page' do
expect(link_to_label(label_presenter, type: type)).to match %r{<a.*href="/#{label.project.full_path}/-/#{type.to_s.pluralize}\?label_name%5B%5D=#{label.name}".*>.*</a>}m
......
......@@ -272,7 +272,7 @@ describe NotesHelper do
let(:note) { create(:note_on_issue, noteable: issue, project: project) }
it 'returns the noteable url with an anchor to the note' do
expect(noteable_note_url(note)).to match("/#{project.namespace.path}/#{project.path}/issues/#{issue.iid}##{dom_id(note)}")
expect(noteable_note_url(note)).to match("/#{project.namespace.path}/#{project.path}/-/issues/#{issue.iid}##{dom_id(note)}")
end
end
......
......@@ -64,7 +64,7 @@ export default {
resolve_path:
'/gitlab-org/gitlab-test/-/merge_requests/20/discussions/6b232e05bea388c6b043ccc243ba505faac04ea8/resolve',
resolve_with_issue_path:
'/gitlab-org/gitlab-test/issues/new?discussion_to_resolve=6b232e05bea388c6b043ccc243ba505faac04ea8&merge_request_to_resolve_discussions_of=20',
'/gitlab-org/gitlab-test/-/issues/new?discussion_to_resolve=6b232e05bea388c6b043ccc243ba505faac04ea8&merge_request_to_resolve_discussions_of=20',
},
{
id: '1753',
......@@ -117,7 +117,7 @@ export default {
resolve_path:
'/gitlab-org/gitlab-test/-/merge_requests/20/discussions/6b232e05bea388c6b043ccc243ba505faac04ea8/resolve',
resolve_with_issue_path:
'/gitlab-org/gitlab-test/issues/new?discussion_to_resolve=6b232e05bea388c6b043ccc243ba505faac04ea8&merge_request_to_resolve_discussions_of=20',
'/gitlab-org/gitlab-test/-/issues/new?discussion_to_resolve=6b232e05bea388c6b043ccc243ba505faac04ea8&merge_request_to_resolve_discussions_of=20',
},
{
id: '1754',
......@@ -160,7 +160,7 @@ export default {
resolve_path:
'/gitlab-org/gitlab-test/-/merge_requests/20/discussions/6b232e05bea388c6b043ccc243ba505faac04ea8/resolve',
resolve_with_issue_path:
'/gitlab-org/gitlab-test/issues/new?discussion_to_resolve=6b232e05bea388c6b043ccc243ba505faac04ea8&merge_request_to_resolve_discussions_of=20',
'/gitlab-org/gitlab-test/-/issues/new?discussion_to_resolve=6b232e05bea388c6b043ccc243ba505faac04ea8&merge_request_to_resolve_discussions_of=20',
},
{
id: '1755',
......@@ -203,7 +203,7 @@ export default {
resolve_path:
'/gitlab-org/gitlab-test/-/merge_requests/20/discussions/6b232e05bea388c6b043ccc243ba505faac04ea8/resolve',
resolve_with_issue_path:
'/gitlab-org/gitlab-test/issues/new?discussion_to_resolve=6b232e05bea388c6b043ccc243ba505faac04ea8&merge_request_to_resolve_discussions_of=20',
'/gitlab-org/gitlab-test/-/issues/new?discussion_to_resolve=6b232e05bea388c6b043ccc243ba505faac04ea8&merge_request_to_resolve_discussions_of=20',
},
{
id: '1756',
......@@ -246,7 +246,7 @@ export default {
resolve_path:
'/gitlab-org/gitlab-test/-/merge_requests/20/discussions/6b232e05bea388c6b043ccc243ba505faac04ea8/resolve',
resolve_with_issue_path:
'/gitlab-org/gitlab-test/issues/new?discussion_to_resolve=6b232e05bea388c6b043ccc243ba505faac04ea8&merge_request_to_resolve_discussions_of=20',
'/gitlab-org/gitlab-test/-/issues/new?discussion_to_resolve=6b232e05bea388c6b043ccc243ba505faac04ea8&merge_request_to_resolve_discussions_of=20',
},
],
individual_note: false,
......@@ -255,7 +255,7 @@ export default {
resolve_path:
'/gitlab-org/gitlab-test/-/merge_requests/20/discussions/6b232e05bea388c6b043ccc243ba505faac04ea8/resolve',
resolve_with_issue_path:
'/gitlab-org/gitlab-test/issues/new?discussion_to_resolve=6b232e05bea388c6b043ccc243ba505faac04ea8&merge_request_to_resolve_discussions_of=20',
'/gitlab-org/gitlab-test/-/issues/new?discussion_to_resolve=6b232e05bea388c6b043ccc243ba505faac04ea8&merge_request_to_resolve_discussions_of=20',
diff_file: {
submodule: false,
submodule_link: null,
......
......@@ -40,7 +40,9 @@ describe('Issuable output', () => {
const IssuableDescriptionComponent = Vue.extend(issuableApp);
mock = new MockAdapter(axios);
mock.onGet('/gitlab-org/gitlab-shell/issues/9/realtime_changes/realtime_changes').reply(() => {
mock
.onGet('/gitlab-org/gitlab-shell/-/issues/9/realtime_changes/realtime_changes')
.reply(() => {
const res = Promise.resolve([200, REALTIME_REQUEST_STACK[realtimeRequestCount]]);
realtimeRequestCount += 1;
return res;
......@@ -50,7 +52,7 @@ describe('Issuable output', () => {
propsData: {
canUpdate: true,
canDestroy: true,
endpoint: '/gitlab-org/gitlab-shell/issues/9/realtime_changes',
endpoint: '/gitlab-org/gitlab-shell/-/issues/9/realtime_changes',
updateEndpoint: gl.TEST_HOST,
issuableRef: '#1',
initialTitleHtml: '',
......
......@@ -216,7 +216,7 @@ export default {
remove_wip_path: '/root/acets-app/-/merge_requests/22/remove_wip',
cancel_auto_merge_path: '/root/acets-app/-/merge_requests/22/cancel_auto_merge',
create_issue_to_resolve_discussions_path:
'/root/acets-app/issues/new?merge_request_to_resolve_discussions_of=22',
'/root/acets-app/-/issues/new?merge_request_to_resolve_discussions_of=22',
merge_path: '/root/acets-app/-/merge_requests/22/merge',
cherry_pick_in_fork_path:
'/root/acets-app/forks?continue%5Bnotice%5D=You%27re+not+allowed+to+make+changes+to+this+project+directly.+A+fork+of+this+project+has+been+created+that+you+can+make+changes+in%2C+so+you+can+submit+a+merge+request.+Try+to+revert+this+commit+again.&continue%5Bnotice_now%5D=You%27re+not+allowed+to+make+changes+to+this+project+directly.+A+fork+of+this+project+is+being+created+that+you+can+make+changes+in%2C+so+you+can+submit+a+merge+request.&continue%5Bto%5D=%2Froot%2Facets-app%2Fmerge_requests%2F22&namespace_key=1',
......
# frozen_string_literal: true
require 'spec_helper'
describe Gitlab::Ci::Pipeline::Chain::Build::Associations do
let(:project) { create(:project, :repository) }
let(:user) { create(:user, developer_projects: [project]) }
let(:pipeline) { Ci::Pipeline.new }
let(:step) { described_class.new(pipeline, command) }
let(:command) do
Gitlab::Ci::Pipeline::Chain::Command.new(
source: :push,
origin_ref: 'master',
checkout_sha: project.commit.id,
after_sha: nil,
before_sha: nil,
trigger_request: nil,
schedule: nil,
merge_request: nil,
project: project,
current_user: user,
bridge: bridge)
end
context 'when a bridge is passed in to the pipeline creation' do
let(:bridge) { create(:ci_bridge) }
it 'links the pipeline to the upstream bridge job' do
step.perform!
expect(pipeline.source_pipeline).to be_present
expect(pipeline.source_pipeline).to be_valid
expect(pipeline.source_pipeline).to have_attributes(
source_pipeline: bridge.pipeline, source_project: bridge.project,
source_bridge: bridge, project: project
)
end
it 'never breaks the chain' do
step.perform!
expect(step.break?).to eq(false)
end
end
context 'when a bridge is not passed in to the pipeline creation' do
let(:bridge) { nil }
it 'leaves the source pipeline empty' do
step.perform!
expect(pipeline.source_pipeline).to be_nil
end
it 'never breaks the chain' do
step.perform!
expect(step.break?).to eq(false)
end
end
end
......@@ -20,7 +20,7 @@ describe Gitlab::UrlBuilder do
url = described_class.build(issue)
expect(url).to eq "#{Settings.gitlab['url']}/#{issue.project.full_path}/issues/#{issue.iid}"
expect(url).to eq "#{Settings.gitlab['url']}/#{issue.project.full_path}/-/issues/#{issue.iid}"
end
end
......@@ -107,7 +107,7 @@ describe Gitlab::UrlBuilder do
url = described_class.build(note)
expect(url).to eq "#{Settings.gitlab['url']}/#{issue.project.full_path}/issues/#{issue.iid}#note_#{note.id}"
expect(url).to eq "#{Settings.gitlab['url']}/#{issue.project.full_path}/-/issues/#{issue.iid}#note_#{note.id}"
end
end
......
......@@ -33,9 +33,9 @@ describe GitlabIssueTrackerService do
end
it 'gives the correct path' do
expect(service.project_url).to eq("http://#{Gitlab.config.gitlab.host}/gitlab/root/#{project.full_path}/issues")
expect(service.new_issue_url).to eq("http://#{Gitlab.config.gitlab.host}/gitlab/root/#{project.full_path}/issues/new")
expect(service.issue_url(432)).to eq("http://#{Gitlab.config.gitlab.host}/gitlab/root/#{project.full_path}/issues/432")
expect(service.project_url).to eq("http://#{Gitlab.config.gitlab.host}/gitlab/root/#{project.full_path}/-/issues")
expect(service.new_issue_url).to eq("http://#{Gitlab.config.gitlab.host}/gitlab/root/#{project.full_path}/-/issues/new")
expect(service.issue_url(432)).to eq("http://#{Gitlab.config.gitlab.host}/gitlab/root/#{project.full_path}/-/issues/432")
end
end
......@@ -45,9 +45,9 @@ describe GitlabIssueTrackerService do
end
it 'gives the correct path' do
expect(service.issue_tracker_path).to eq("/gitlab/root/#{project.full_path}/issues")
expect(service.new_issue_path).to eq("/gitlab/root/#{project.full_path}/issues/new")
expect(service.issue_path(432)).to eq("/gitlab/root/#{project.full_path}/issues/432")
expect(service.issue_tracker_path).to eq("/gitlab/root/#{project.full_path}/-/issues")
expect(service.new_issue_path).to eq("/gitlab/root/#{project.full_path}/-/issues/new")
expect(service.issue_path(432)).to eq("/gitlab/root/#{project.full_path}/-/issues/432")
end
end
end
......
......@@ -17,7 +17,7 @@ describe IssuePresenter do
describe '#web_url' do
it 'returns correct path' do
expect(presenter.web_url).to eq("http://localhost/#{group.name}/#{project.name}/issues/#{issue.iid}")
expect(presenter.web_url).to eq("http://localhost/#{group.name}/#{project.name}/-/issues/#{issue.iid}")
end
end
......@@ -37,7 +37,7 @@ describe IssuePresenter do
describe '#issue_path' do
it 'returns correct path' do
expect(presenter.issue_path).to eq("/#{group.name}/#{project.name}/issues/#{issue.iid}")
expect(presenter.issue_path).to eq("/#{group.name}/#{project.name}/-/issues/#{issue.iid}")
end
end
end
......@@ -128,11 +128,11 @@ describe MergeRequestPresenter do
subject { described_class.new(resource, current_user: user).closing_issues_links }
it 'presents closing issues links' do
is_expected.to match("#{project.full_path}/issues/#{issue_a.iid}")
is_expected.to match("#{project.full_path}/-/issues/#{issue_a.iid}")
end
it 'does not present related issues links' do
is_expected.not_to match("#{project.full_path}/issues/#{issue_b.iid}")
is_expected.not_to match("#{project.full_path}/-/issues/#{issue_b.iid}")
end
it 'appends status when closing issue is already closed' do
......@@ -148,11 +148,11 @@ describe MergeRequestPresenter do
end
it 'presents related issues links' do
is_expected.to match("#{project.full_path}/issues/#{issue_b.iid}")
is_expected.to match("#{project.full_path}/-/issues/#{issue_b.iid}")
end
it 'does not present closing issues links' do
is_expected.not_to match("#{project.full_path}/issues/#{issue_a.iid}")
is_expected.not_to match("#{project.full_path}/-/issues/#{issue_a.iid}")
end
it 'appends status when mentioned issue is already closed' do
......@@ -275,7 +275,7 @@ describe MergeRequestPresenter do
project.add_maintainer(user)
is_expected
.to eq("/#{resource.project.full_path}/issues/new?merge_request_to_resolve_discussions_of=#{resource.iid}")
.to eq("/#{resource.project.full_path}/-/issues/new?merge_request_to_resolve_discussions_of=#{resource.iid}")
end
end
......
......@@ -78,7 +78,7 @@ describe API::Releases do
issue_uri = URI.parse(links['issues_url'])
expect(mr_uri.path).to eq("#{path_base}/-/merge_requests")
expect(issue_uri.path).to eq("#{path_base}/issues")
expect(issue_uri.path).to eq("#{path_base}/-/issues")
expect(mr_uri.query).to eq(expected_query)
expect(issue_uri.query).to eq(expected_query)
end
......
......@@ -109,7 +109,7 @@ describe Ci::CreateCrossProjectPipelineService, '#execute' do
expect(pipeline.source_bridge).to be_a ::Ci::Bridge
end
it 'updates bridge status when downstream pipeline gets proceesed' do
it 'updates bridge status when downstream pipeline gets processed' do
pipeline = service.execute(bridge)
expect(pipeline.reload).to be_pending
......@@ -128,6 +128,37 @@ describe Ci::CreateCrossProjectPipelineService, '#execute' do
end
end
context 'when downstream pipeline has yaml configuration error' do
before do
stub_ci_pipeline_yaml_file(YAML.dump(job: { invalid: 'yaml' }))
end
it 'creates only one new pipeline' do
expect { service.execute(bridge) }
.to change { Ci::Pipeline.count }.by(1)
end
it 'creates a new pipeline in a downstream project' do
pipeline = service.execute(bridge)
expect(pipeline.user).to eq bridge.user
expect(pipeline.project).to eq downstream_project
expect(bridge.sourced_pipelines.first.pipeline).to eq pipeline
expect(pipeline.triggered_by_pipeline).to eq upstream_pipeline
expect(pipeline.source_bridge).to eq bridge
expect(pipeline.source_bridge).to be_a ::Ci::Bridge
end
it 'does not update bridge status when downstream pipeline gets processed' do
pipeline = service.execute(bridge)
expect(pipeline.reload).to be_failed
# TODO: This should change to failed once #198354 gets fixed.
# https://gitlab.com/gitlab-org/gitlab/-/merge_requests/25706
expect(bridge.reload).to be_pending
end
end
context 'when downstream project is the same as the job project' do
let(:trigger) do
{ trigger: { project: upstream_project.full_path } }
......@@ -173,7 +204,7 @@ describe Ci::CreateCrossProjectPipelineService, '#execute' do
expect(pipeline.source_bridge).to be_a ::Ci::Bridge
end
it 'updates bridge status when downstream pipeline gets proceesed' do
it 'updates bridge status when downstream pipeline gets processed' do
pipeline = service.execute(bridge)
expect(pipeline.reload).to be_pending
......
......@@ -4,12 +4,15 @@ require 'spec_helper'
describe Ci::CreatePipelineService do
let_it_be(:project) { create(:project, :repository) }
let_it_be(:user) { create(:admin) }
let(:upstream_pipeline) { create(:ci_pipeline) }
let(:ref) { 'refs/heads/master' }
let(:service) { described_class.new(project, user, { ref: ref }) }
context 'custom config content' do
let(:bridge) do
double(:bridge, yaml_for_downstream: <<~YML
create(:ci_bridge, status: 'running', pipeline: upstream_pipeline, project: upstream_pipeline.project).tap do |bridge|
allow(bridge).to receive(:yaml_for_downstream).and_return(
<<~YML
rspec:
script: rspec
custom:
......@@ -17,6 +20,7 @@ describe Ci::CreatePipelineService do
YML
)
end
end
subject { service.execute(:push, bridge: bridge) }
......
......@@ -27,7 +27,7 @@ describe ErrorTracking::IssueDetailsService do
create(:sentry_issue, issue: gitlab_issue, sentry_issue_identifier: detailed_error.id)
expect(result[:issue].gitlab_issue).to include(
"http", "/#{project.full_path}/issues/#{gitlab_issue.iid}"
"http", "/#{project.full_path}/-/issues/#{gitlab_issue.iid}"
)
end
......
......@@ -11,7 +11,6 @@ describe 'admin/application_settings/integrations.html.haml' do
before do
assign(:application_setting, app_settings)
allow(Gitlab::Sourcegraph).to receive(:feature_available?).and_return(sourcegraph_flag)
allow(License).to receive(:feature_available?).with(:elastic_search).and_return(false) if defined?(License)
end
context 'when sourcegraph feature is enabled' do
......
......@@ -801,10 +801,10 @@
resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-1.104.0.tgz#ebbf99788d74b7224f116f1c0040fa0c90034d99"
integrity sha512-lWg/EzxFdbx4YIdDWB2p5ag6Cna78AYGET8nXQYXYwd21/U3wKXKL7vsGR4kOxe1goA9ZAYG9eY+MK7cf+X2cA==
"@gitlab/ui@^9.18.2":
version "9.18.2"
resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-9.18.2.tgz#b82387a8c7bde1db069670596d5ef05d4a16400a"
integrity sha512-nBJMIdTX+LYYVGWiF3tdhQ5/tPaYIW80rz8DBzxfLaZYw9pJPolXZ8Vj7xlJWRHbqiM+HghvJPPvgcBXIfKzPw==
"@gitlab/ui@^9.20.0":
version "9.20.0"
resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-9.20.0.tgz#69d8d345408a727cfe7ebde3554c78c58f9065b2"
integrity sha512-ZWMpvK2Zd2xwQ9svvjzSSD3jI3NnE5izc/bR6kbzXoAe+KdUzLeHDih1ePwhU87BCJeS8JrhJhXT8xnYv/dICg==
dependencies:
"@babel/standalone" "^7.0.0"
"@gitlab/vue-toasted" "^1.3.0"
......
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