Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
271e563cf6
commit
11bfe6f383
27 changed files with 106 additions and 195 deletions
|
@ -68,6 +68,7 @@ variables:
|
|||
ELASTIC_URL: "http://elastic:changeme@elasticsearch:9200"
|
||||
DOCKER_VERSION: "20.10.1"
|
||||
CACHE_CLASSES: "true"
|
||||
CHECK_PRECOMPILED_ASSETS: "true"
|
||||
FF_USE_FASTZIP: "true"
|
||||
|
||||
# Preparing custom clone path to reduce space used by all random forks
|
||||
|
|
|
@ -1 +1 @@
|
|||
1966c1d9d4f11d05e73519e13ed8d0f56e3f0155
|
||||
7ad4fcea44bc4c1a8682d77ad6b46aeacb8c6e1d
|
||||
|
|
|
@ -36,10 +36,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
|
||||
initSettingsPipelinesTriggers();
|
||||
initArtifactsSettings();
|
||||
|
||||
if (gon?.features?.vueifySharedRunnersToggle) {
|
||||
initSharedRunnersToggle();
|
||||
}
|
||||
|
||||
initSharedRunnersToggle();
|
||||
initInstallRunner();
|
||||
});
|
||||
|
|
|
@ -52,23 +52,13 @@ class Projects::RunnersController < Projects::ApplicationController
|
|||
|
||||
def toggle_shared_runners
|
||||
if !project.shared_runners_enabled && project.group && project.group.shared_runners_setting == 'disabled_and_unoverridable'
|
||||
|
||||
if Feature.enabled?(:vueify_shared_runners_toggle, @project)
|
||||
render json: { error: _('Cannot enable shared runners because parent group does not allow it') }, status: :unauthorized
|
||||
else
|
||||
redirect_to project_runners_path(@project), alert: _('Cannot enable shared runners because parent group does not allow it')
|
||||
end
|
||||
|
||||
render json: { error: _('Cannot enable shared runners because parent group does not allow it') }, status: :unauthorized
|
||||
return
|
||||
end
|
||||
|
||||
project.toggle!(:shared_runners_enabled)
|
||||
|
||||
if Feature.enabled?(:vueify_shared_runners_toggle, @project)
|
||||
render json: {}, status: :ok
|
||||
else
|
||||
redirect_to project_settings_ci_cd_path(@project, anchor: 'js-runners-settings')
|
||||
end
|
||||
render json: {}, status: :ok
|
||||
end
|
||||
|
||||
def toggle_group_runners
|
||||
|
|
|
@ -12,7 +12,6 @@ module Projects
|
|||
before_action :define_variables
|
||||
before_action do
|
||||
push_frontend_feature_flag(:ajax_new_deploy_token, @project)
|
||||
push_frontend_feature_flag(:vueify_shared_runners_toggle, @project)
|
||||
end
|
||||
|
||||
helper_method :highlight_badge
|
||||
|
|
|
@ -1,23 +1,6 @@
|
|||
- isVueifySharedRunnersToggleEnabled = Feature.enabled?(:vueify_shared_runners_toggle, @project)
|
||||
= render 'shared/runners/shared_runners_description'
|
||||
|
||||
= render layout: 'shared/runners/shared_runners_description' do
|
||||
- if !isVueifySharedRunnersToggleEnabled
|
||||
%br
|
||||
%br
|
||||
- if @project.group&.shared_runners_setting == 'disabled_and_unoverridable'
|
||||
%h5.gl-text-red-500
|
||||
= _('Shared runners disabled on group level')
|
||||
- else
|
||||
- if @project.shared_runners_enabled?
|
||||
= link_to toggle_shared_runners_project_runners_path(@project), class: 'btn gl-button btn-default', method: :post do
|
||||
= _('Disable shared runners')
|
||||
- else
|
||||
= link_to toggle_shared_runners_project_runners_path(@project), class: 'btn gl-button btn-confirm-secondary', method: :post do
|
||||
= _('Enable shared runners')
|
||||
for this project
|
||||
|
||||
- if isVueifySharedRunnersToggleEnabled
|
||||
#toggle-shared-runners-form{ data: toggle_shared_runners_settings_data(@project) }
|
||||
#toggle-shared-runners-form{ data: toggle_shared_runners_settings_data(@project) }
|
||||
|
||||
- if @shared_runners_count == 0
|
||||
= _('This GitLab instance does not provide any shared runners yet. Instance administrators can register shared runners in the admin area.')
|
||||
|
|
|
@ -9,4 +9,3 @@
|
|||
= markdown(Gitlab::CurrentSettings.current_application_settings.shared_runners_text)
|
||||
- else
|
||||
%p= _('The same shared runner executes code from multiple projects, unless you configure autoscaling with %{link} set to 1 (which it is on GitLab.com).').html_safe % { link: link }
|
||||
= yield
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Add asset links to release keyword
|
||||
merge_request: 60896
|
||||
author:
|
||||
type: added
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Update appearance of "Enable shared runners for this project" toggle in Project > Settings > CI/CD
|
||||
merge_request: 61043
|
||||
author:
|
||||
type: changed
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Improve the performance of Release LIST v4 API endpoint by short-interval caching
|
||||
merge_request: 61223
|
||||
author:
|
||||
type: performance
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Remove description_html field from Release Rest API
|
||||
merge_request: 61327
|
||||
author:
|
||||
type: removed
|
|
@ -23,6 +23,9 @@ Rails.application.configure do
|
|||
|
||||
# Configure static asset server for tests with Cache-Control for performance
|
||||
config.assets.compile = false if ENV['CI']
|
||||
# There is no need to check if assets are precompiled locally
|
||||
# To debug AssetNotPrecompiled errors locally, set CHECK_PRECOMPILED_ASSETS to true
|
||||
config.assets.check_precompiled_asset = Gitlab::Utils.to_boolean(ENV['CHECK_PRECOMPILED_ASSETS'], default: false)
|
||||
|
||||
config.public_file_server.enabled = true
|
||||
config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
name: api_caching_releases
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/60194
|
||||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/329861
|
||||
milestone: '13.12'
|
||||
type: development
|
||||
group: group::release
|
||||
default_enabled: false
|
|
@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/329188
|
|||
milestone: '13.12'
|
||||
type: development
|
||||
group: group::release
|
||||
default_enabled: false
|
||||
default_enabled: true
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
name: vueify_shared_runners_toggle
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48452
|
||||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/292441
|
||||
milestone: '13.7'
|
||||
type: development
|
||||
group: group::continuous integration
|
||||
default_enabled: false
|
|
@ -10,6 +10,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w
|
|||
> - Using this API you can manipulate GitLab [Release](../../user/project/releases/index.md) entries.
|
||||
> - For manipulating links as a release asset, see [Release Links API](links.md).
|
||||
> - Release Evidences were [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/26019) in GitLab 12.5.
|
||||
> - `description_html` field was [removed](https://gitlab.com/gitlab-org/gitlab/-/issues/299447) in GitLab 13.12.
|
||||
|
||||
## List Releases
|
||||
|
||||
|
@ -39,7 +40,6 @@ Example response:
|
|||
"tag_name":"v0.2",
|
||||
"description":"## CHANGELOG\r\n\r\n- Escape label and milestone titles to prevent XSS in GFM autocomplete. !2740\r\n- Prevent private snippets from being embeddable.\r\n- Add subresources removal to member destroy service.",
|
||||
"name":"Awesome app v0.2 beta",
|
||||
"description_html":"\u003ch2 dir=\"auto\"\u003e\n\u003ca id=\"user-content-changelog\" class=\"anchor\" href=\"#changelog\" aria-hidden=\"true\"\u003e\u003c/a\u003eCHANGELOG\u003c/h2\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eEscape label and milestone titles to prevent XSS in GFM autocomplete. !2740\u003c/li\u003e\n\u003cli\u003ePrevent private snippets from being embeddable.\u003c/li\u003e\n\u003cli\u003eAdd subresources removal to member destroy service.\u003c/li\u003e\n\u003c/ul\u003e",
|
||||
"created_at":"2019-01-03T01:56:19.539Z",
|
||||
"released_at":"2019-01-03T01:56:19.539Z",
|
||||
"author":{
|
||||
|
@ -154,7 +154,6 @@ Example response:
|
|||
"tag_name":"v0.1",
|
||||
"description":"## CHANGELOG\r\n\r\n-Remove limit of 100 when searching repository code. !8671\r\n- Show error message when attempting to reopen an MR and there is an open MR for the same branch. !16447 (Akos Gyimesi)\r\n- Fix a bug where internal email pattern wasn't respected. !22516",
|
||||
"name":"Awesome app v0.1 alpha",
|
||||
"description_html":"\u003ch2 dir=\"auto\"\u003e\n\u003ca id=\"user-content-changelog\" class=\"anchor\" href=\"#changelog\" aria-hidden=\"true\"\u003e\u003c/a\u003eCHANGELOG\u003c/h2\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eRemove limit of 100 when searching repository code. !8671\u003c/li\u003e\n\u003cli\u003eShow error message when attempting to reopen an MR and there is an open MR for the same branch. !16447 (Akos Gyimesi)\u003c/li\u003e\n\u003cli\u003eFix a bug where internal email pattern wasn't respected. !22516\u003c/li\u003e\n\u003c/ul\u003e",
|
||||
"created_at":"2019-01-03T01:55:18.203Z",
|
||||
"released_at":"2019-01-03T01:55:18.203Z",
|
||||
"author":{
|
||||
|
@ -243,7 +242,6 @@ Example response:
|
|||
"tag_name":"v0.1",
|
||||
"description":"## CHANGELOG\r\n\r\n- Remove limit of 100 when searching repository code. !8671\r\n- Show error message when attempting to reopen an MR and there is an open MR for the same branch. !16447 (Akos Gyimesi)\r\n- Fix a bug where internal email pattern wasn't respected. !22516",
|
||||
"name":"Awesome app v0.1 alpha",
|
||||
"description_html":"\u003ch2 dir=\"auto\"\u003e\n\u003ca id=\"user-content-changelog\" class=\"anchor\" href=\"#changelog\" aria-hidden=\"true\"\u003e\u003c/a\u003eCHANGELOG\u003c/h2\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eRemove limit of 100 when searching repository code. !8671\u003c/li\u003e\n\u003cli\u003eShow error message when attempting to reopen an MR and there is an open MR for the same branch. !16447 (Akos Gyimesi)\u003c/li\u003e\n\u003cli\u003eFix a bug where internal email pattern wasn't respected. !22516\u003c/li\u003e\n\u003c/ul\u003e",
|
||||
"created_at":"2019-01-03T01:55:18.203Z",
|
||||
"released_at":"2019-01-03T01:55:18.203Z",
|
||||
"author":{
|
||||
|
@ -386,7 +384,6 @@ Example response:
|
|||
"tag_name":"v0.3",
|
||||
"description":"Super nice release",
|
||||
"name":"New release",
|
||||
"description_html":"\u003cp dir=\"auto\"\u003eSuper nice release\u003c/p\u003e",
|
||||
"created_at":"2019-01-03T02:22:45.118Z",
|
||||
"released_at":"2019-01-03T02:22:45.118Z",
|
||||
"author":{
|
||||
|
@ -552,7 +549,6 @@ Example response:
|
|||
"tag_name":"v0.1",
|
||||
"description":"## CHANGELOG\r\n\r\n- Remove limit of 100 when searching repository code. !8671\r\n- Show error message when attempting to reopen an MR and there is an open MR for the same branch. !16447 (Akos Gyimesi)\r\n- Fix a bug where internal email pattern wasn't respected. !22516",
|
||||
"name":"new name",
|
||||
"description_html":"\u003ch2 dir=\"auto\"\u003e\n\u003ca id=\"user-content-changelog\" class=\"anchor\" href=\"#changelog\" aria-hidden=\"true\"\u003e\u003c/a\u003eCHANGELOG\u003c/h2\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eRemove limit of 100 when searching repository code. !8671\u003c/li\u003e\n\u003cli\u003eShow error message when attempting to reopen an MR and there is an open MR for the same branch. !16447 (Akos Gyimesi)\u003c/li\u003e\n\u003cli\u003eFix a bug where internal email pattern wasn't respected. !22516\u003c/li\u003e\n\u003c/ul\u003e",
|
||||
"created_at":"2019-01-03T01:55:18.203Z",
|
||||
"released_at":"2019-01-03T01:55:18.203Z",
|
||||
"author":{
|
||||
|
@ -655,7 +651,6 @@ Example response:
|
|||
"tag_name":"v0.1",
|
||||
"description":"## CHANGELOG\r\n\r\n- Remove limit of 100 when searching repository code. !8671\r\n- Show error message when attempting to reopen an MR and there is an open MR for the same branch. !16447 (Akos Gyimesi)\r\n- Fix a bug where internal email pattern wasn't respected. !22516",
|
||||
"name":"new name",
|
||||
"description_html":"\u003ch2 dir=\"auto\"\u003e\n\u003ca id=\"user-content-changelog\" class=\"anchor\" href=\"#changelog\" aria-hidden=\"true\"\u003e\u003c/a\u003eCHANGELOG\u003c/h2\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eRemove limit of 100 when searching repository code. !8671\u003c/li\u003e\n\u003cli\u003eShow error message when attempting to reopen an MR and there is an open MR for the same branch. !16447 (Akos Gyimesi)\u003c/li\u003e\n\u003cli\u003eFix a bug where internal email pattern wasn't respected. !22516\u003c/li\u003e\n\u003c/ul\u003e",
|
||||
"created_at":"2019-01-03T01:55:18.203Z",
|
||||
"released_at":"2019-01-03T01:55:18.203Z",
|
||||
"author":{
|
||||
|
|
|
@ -66,6 +66,9 @@ the user details need to be passed to GitLab as SAML assertions.
|
|||
At a minimum, the user's email address *must* be specified as an assertion named `email` or `mail`.
|
||||
See [the assertions list](../../../integration/saml.md#assertions) for other available claims.
|
||||
|
||||
NOTE:
|
||||
The `username` assertion is not supported for GitLab.com SaaS integrations.
|
||||
|
||||
### Metadata configuration
|
||||
|
||||
GitLab provides metadata XML that can be used to configure your identity provider.
|
||||
|
|
|
@ -33,21 +33,17 @@ module API
|
|||
get ':id/releases' do
|
||||
releases = ::ReleasesFinder.new(user_project, current_user, declared_params.slice(:order_by, :sort)).execute
|
||||
|
||||
if Feature.enabled?(:api_caching_releases, user_project, default_enabled: :yaml)
|
||||
# We cache the serialized payload per user in order to avoid repeated renderings.
|
||||
# Since the cached result could contain sensitive information,
|
||||
# it will expire in a short interval.
|
||||
present_cached paginate(releases),
|
||||
with: Entities::Release,
|
||||
# `current_user` could be absent if the releases are publicly accesible.
|
||||
# We should not use `cache_key` for the user because the version/updated_at
|
||||
# context is unnecessary here.
|
||||
cache_context: -> (_) { "user:{#{current_user&.id}}" },
|
||||
expires_in: 5.minutes,
|
||||
current_user: current_user
|
||||
else
|
||||
present paginate(releases), with: Entities::Release, current_user: current_user
|
||||
end
|
||||
# We cache the serialized payload per user in order to avoid repeated renderings.
|
||||
# Since the cached result could contain sensitive information,
|
||||
# it will expire in a short interval.
|
||||
present_cached paginate(releases),
|
||||
with: Entities::Release,
|
||||
# `current_user` could be absent if the releases are publicly accesible.
|
||||
# We should not use `cache_key` for the user because the version/updated_at
|
||||
# context is unnecessary here.
|
||||
cache_context: -> (_) { "user:{#{current_user&.id}}" },
|
||||
expires_in: 5.minutes,
|
||||
current_user: current_user
|
||||
end
|
||||
|
||||
desc 'Get a single project release' do
|
||||
|
|
|
@ -18,8 +18,9 @@ module Gitlab
|
|||
command = BASE_COMMAND.dup
|
||||
single_flags.each { |k, v| command.concat(" --#{k.to_s.dasherize} \"#{v}\"") }
|
||||
array_commands.each { |k, v| v.each { |elem| command.concat(" --#{k.to_s.singularize.dasherize} \"#{elem}\"") } }
|
||||
asset_links.each { |link| command.concat(" --assets-link #{stringified_json(link)}") }
|
||||
|
||||
[command]
|
||||
[command.freeze]
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -31,6 +32,14 @@ module Gitlab
|
|||
def array_commands
|
||||
config.slice(*ARRAY_FLAGS)
|
||||
end
|
||||
|
||||
def asset_links
|
||||
config.dig(:assets, :links) || []
|
||||
end
|
||||
|
||||
def stringified_json(object)
|
||||
"#{object.to_json.to_json}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11463,9 +11463,6 @@ msgstr ""
|
|||
msgid "Disable public access to Pages sites"
|
||||
msgstr ""
|
||||
|
||||
msgid "Disable shared runners"
|
||||
msgstr ""
|
||||
|
||||
msgid "Disable two-factor authentication"
|
||||
msgstr ""
|
||||
|
||||
|
@ -12203,9 +12200,6 @@ msgstr ""
|
|||
msgid "Enable reCAPTCHA, Invisible Captcha, Akismet and set IP limits. For reCAPTCHA, we currently only support %{recaptcha_v2_link_start}v2%{recaptcha_v2_link_end}"
|
||||
msgstr ""
|
||||
|
||||
msgid "Enable shared runners"
|
||||
msgstr ""
|
||||
|
||||
msgid "Enable shared runners for all projects and subgroups in this group."
|
||||
msgstr ""
|
||||
|
||||
|
@ -29617,9 +29611,6 @@ msgstr ""
|
|||
msgid "Shared runners are disabled on group level"
|
||||
msgstr ""
|
||||
|
||||
msgid "Shared runners disabled on group level"
|
||||
msgstr ""
|
||||
|
||||
msgid "Shared runners help link"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -78,84 +78,40 @@ RSpec.describe Projects::RunnersController do
|
|||
let(:group) { create(:group) }
|
||||
let(:project) { create(:project, group: group) }
|
||||
|
||||
context 'without feature flag' do
|
||||
before do
|
||||
stub_feature_flags(vueify_shared_runners_toggle: false)
|
||||
end
|
||||
it 'toggles shared_runners_enabled when the group allows shared runners' do
|
||||
project.update!(shared_runners_enabled: true)
|
||||
|
||||
it 'toggles shared_runners_enabled when the group allows shared runners' do
|
||||
project.update!(shared_runners_enabled: true)
|
||||
post :toggle_shared_runners, params: params
|
||||
|
||||
post :toggle_shared_runners, params: params
|
||||
project.reload
|
||||
|
||||
project.reload
|
||||
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(project.shared_runners_enabled).to eq(false)
|
||||
end
|
||||
|
||||
it 'toggles shared_runners_enabled when the group disallows shared runners but allows overrides' do
|
||||
group.update!(shared_runners_enabled: false, allow_descendants_override_disabled_shared_runners: true)
|
||||
project.update!(shared_runners_enabled: false)
|
||||
|
||||
post :toggle_shared_runners, params: params
|
||||
|
||||
project.reload
|
||||
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(project.shared_runners_enabled).to eq(true)
|
||||
end
|
||||
|
||||
it 'does not enable if the group disallows shared runners' do
|
||||
group.update!(shared_runners_enabled: false, allow_descendants_override_disabled_shared_runners: false)
|
||||
project.update!(shared_runners_enabled: false)
|
||||
|
||||
post :toggle_shared_runners, params: params
|
||||
|
||||
project.reload
|
||||
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(project.shared_runners_enabled).to eq(false)
|
||||
expect(flash[:alert]).to eq('Cannot enable shared runners because parent group does not allow it')
|
||||
end
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(project.shared_runners_enabled).to eq(false)
|
||||
end
|
||||
|
||||
context 'with feature flag: vueify_shared_runners_toggle' do
|
||||
it 'toggles shared_runners_enabled when the group allows shared runners' do
|
||||
project.update!(shared_runners_enabled: true)
|
||||
it 'toggles shared_runners_enabled when the group disallows shared runners but allows overrides' do
|
||||
group.update!(shared_runners_enabled: false, allow_descendants_override_disabled_shared_runners: true)
|
||||
project.update!(shared_runners_enabled: false)
|
||||
|
||||
post :toggle_shared_runners, params: params
|
||||
post :toggle_shared_runners, params: params
|
||||
|
||||
project.reload
|
||||
project.reload
|
||||
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(project.shared_runners_enabled).to eq(false)
|
||||
end
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(project.shared_runners_enabled).to eq(true)
|
||||
end
|
||||
|
||||
it 'toggles shared_runners_enabled when the group disallows shared runners but allows overrides' do
|
||||
group.update!(shared_runners_enabled: false, allow_descendants_override_disabled_shared_runners: true)
|
||||
project.update!(shared_runners_enabled: false)
|
||||
it 'does not enable if the group disallows shared runners' do
|
||||
group.update!(shared_runners_enabled: false, allow_descendants_override_disabled_shared_runners: false)
|
||||
project.update!(shared_runners_enabled: false)
|
||||
|
||||
post :toggle_shared_runners, params: params
|
||||
post :toggle_shared_runners, params: params
|
||||
|
||||
project.reload
|
||||
project.reload
|
||||
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(project.shared_runners_enabled).to eq(true)
|
||||
end
|
||||
|
||||
it 'does not enable if the group disallows shared runners' do
|
||||
group.update!(shared_runners_enabled: false, allow_descendants_override_disabled_shared_runners: false)
|
||||
project.update!(shared_runners_enabled: false)
|
||||
|
||||
post :toggle_shared_runners, params: params
|
||||
|
||||
project.reload
|
||||
|
||||
expect(response).to have_gitlab_http_status(:unauthorized)
|
||||
expect(project.shared_runners_enabled).to eq(false)
|
||||
expect(json_response['error']).to eq('Cannot enable shared runners because parent group does not allow it')
|
||||
end
|
||||
expect(response).to have_gitlab_http_status(:unauthorized)
|
||||
expect(project.shared_runners_enabled).to eq(false)
|
||||
expect(json_response['error']).to eq('Cannot enable shared runners because parent group does not allow it')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -431,7 +431,8 @@ FactoryBot.define do
|
|||
name: 'Release $CI_COMMIT_SHA',
|
||||
description: 'Created using the release-cli $EXTRA_DESCRIPTION',
|
||||
tag_name: 'release-$CI_COMMIT_SHA',
|
||||
ref: '$CI_COMMIT_SHA'
|
||||
ref: '$CI_COMMIT_SHA',
|
||||
assets: { links: [{ name: 'asset1', url: 'https://example.com/assets/1' }] }
|
||||
}
|
||||
}
|
||||
end
|
||||
|
|
|
@ -225,34 +225,27 @@ RSpec.describe 'Runners' do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when a project has disabled shared_runners' do
|
||||
let(:project) { create(:project, shared_runners_enabled: false) }
|
||||
context 'enable shared runners in project settings', :js do
|
||||
before do
|
||||
project.add_maintainer(user)
|
||||
|
||||
context 'when feature flag: vueify_shared_runners_toggle is disabled' do
|
||||
before do
|
||||
stub_feature_flags(vueify_shared_runners_toggle: false)
|
||||
project.add_maintainer(user)
|
||||
end
|
||||
visit project_runners_path(project)
|
||||
end
|
||||
|
||||
it 'user enables shared runners' do
|
||||
visit project_runners_path(project)
|
||||
context 'when a project has enabled shared_runners' do
|
||||
let(:project) { create(:project, shared_runners_enabled: true) }
|
||||
|
||||
click_on 'Enable shared runners'
|
||||
|
||||
expect(page.find("[data-testid='shared-runners-description']")).to have_content('Disable shared runners')
|
||||
expect(page).not_to have_selector('#toggle-shared-runners-form')
|
||||
it 'shared runners toggle is on' do
|
||||
expect(page).to have_selector('[data-testid="toggle-shared-runners"]')
|
||||
expect(page).to have_selector('[data-testid="toggle-shared-runners"] .is-checked')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when feature flag: vueify_shared_runners_toggle is enabled' do
|
||||
before do
|
||||
project.add_maintainer(user)
|
||||
end
|
||||
context 'when a project has disabled shared_runners' do
|
||||
let(:project) { create(:project, shared_runners_enabled: false) }
|
||||
|
||||
it 'user enables shared runners' do
|
||||
visit project_runners_path(project)
|
||||
|
||||
expect(page).to have_selector('#toggle-shared-runners-form')
|
||||
it 'shared runners toggle is off' do
|
||||
expect(page).not_to have_selector('[data-testid="toggle-shared-runners"] .is-checked')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,18 +15,25 @@ RSpec.describe Gitlab::Ci::Build::Releaser do
|
|||
tag_name: 'release-$CI_COMMIT_SHA',
|
||||
ref: '$CI_COMMIT_SHA',
|
||||
milestones: %w[m1 m2 m3],
|
||||
released_at: '2020-07-15T08:00:00Z'
|
||||
released_at: '2020-07-15T08:00:00Z',
|
||||
assets: {
|
||||
links: [
|
||||
{ name: 'asset1', url: 'https://example.com/assets/1', link_type: 'other', filepath: '/pretty/asset/1' },
|
||||
{ name: 'asset2', url: 'https://example.com/assets/2' }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
it 'generates the script' do
|
||||
expect(subject).to eq(['release-cli create --name "Release $CI_COMMIT_SHA" --description "Created using the release-cli $EXTRA_DESCRIPTION" --tag-name "release-$CI_COMMIT_SHA" --ref "$CI_COMMIT_SHA" --released-at "2020-07-15T08:00:00Z" --milestone "m1" --milestone "m2" --milestone "m3"'])
|
||||
expect(subject).to eq(['release-cli create --name "Release $CI_COMMIT_SHA" --description "Created using the release-cli $EXTRA_DESCRIPTION" --tag-name "release-$CI_COMMIT_SHA" --ref "$CI_COMMIT_SHA" --released-at "2020-07-15T08:00:00Z" --milestone "m1" --milestone "m2" --milestone "m3" --assets-link "{\"name\":\"asset1\",\"url\":\"https://example.com/assets/1\",\"link_type\":\"other\",\"filepath\":\"/pretty/asset/1\"}" --assets-link "{\"name\":\"asset2\",\"url\":\"https://example.com/assets/2\"}"'])
|
||||
end
|
||||
end
|
||||
|
||||
context 'individual nodes' do
|
||||
using RSpec::Parameterized::TableSyntax
|
||||
links = { links: [{ name: 'asset1', url: 'https://example.com/assets/1', link_type: 'other', filepath: '/pretty/asset/1' }] }
|
||||
|
||||
where(:node_name, :node_value, :result) do
|
||||
:name | 'Release $CI_COMMIT_SHA' | 'release-cli create --name "Release $CI_COMMIT_SHA"'
|
||||
|
@ -35,6 +42,7 @@ RSpec.describe Gitlab::Ci::Build::Releaser do
|
|||
:ref | '$CI_COMMIT_SHA' | 'release-cli create --ref "$CI_COMMIT_SHA"'
|
||||
:milestones | %w[m1 m2 m3] | 'release-cli create --milestone "m1" --milestone "m2" --milestone "m3"'
|
||||
:released_at | '2020-07-15T08:00:00Z' | 'release-cli create --released-at "2020-07-15T08:00:00Z"'
|
||||
:assets | links | "release-cli create --assets-link #{links[:links][0].to_json.to_json}"
|
||||
end
|
||||
|
||||
with_them do
|
||||
|
|
|
@ -62,7 +62,7 @@ RSpec.describe Gitlab::Ci::Build::Step do
|
|||
let(:job) { create(:ci_build, :release_options) }
|
||||
|
||||
it 'returns the release-cli command line' do
|
||||
expect(subject.script).to eq(["release-cli create --name \"Release $CI_COMMIT_SHA\" --description \"Created using the release-cli $EXTRA_DESCRIPTION\" --tag-name \"release-$CI_COMMIT_SHA\" --ref \"$CI_COMMIT_SHA\""])
|
||||
expect(subject.script).to eq(["release-cli create --name \"Release $CI_COMMIT_SHA\" --description \"Created using the release-cli $EXTRA_DESCRIPTION\" --tag-name \"release-$CI_COMMIT_SHA\" --ref \"$CI_COMMIT_SHA\" --assets-link \"{\\\"name\\\":\\\"asset1\\\",\\\"url\\\":\\\"https://example.com/assets/1\\\"}\""])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -378,7 +378,7 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do
|
|||
{
|
||||
"name" => "release",
|
||||
"script" =>
|
||||
["release-cli create --name \"Release $CI_COMMIT_SHA\" --description \"Created using the release-cli $EXTRA_DESCRIPTION\" --tag-name \"release-$CI_COMMIT_SHA\" --ref \"$CI_COMMIT_SHA\""],
|
||||
["release-cli create --name \"Release $CI_COMMIT_SHA\" --description \"Created using the release-cli $EXTRA_DESCRIPTION\" --tag-name \"release-$CI_COMMIT_SHA\" --ref \"$CI_COMMIT_SHA\" --assets-link \"{\\\"url\\\":\\\"https://example.com/assets/1\\\",\\\"name\\\":\\\"asset1\\\"}\""],
|
||||
"timeout" => 3600,
|
||||
"when" => "on_success",
|
||||
"allow_failure" => false
|
||||
|
|
|
@ -185,22 +185,6 @@ RSpec.describe API::Releases do
|
|||
3.times { get api("/projects/#{project.id}/releases", maintainer) }
|
||||
end
|
||||
|
||||
context 'when api_caching_releases feature flag is disabled' do
|
||||
before do
|
||||
stub_feature_flags(api_caching_releases: false)
|
||||
end
|
||||
|
||||
it 'serializes releases everytime' do
|
||||
create_list(:release, 2, project: project)
|
||||
|
||||
expect(API::Entities::Release)
|
||||
.to receive(:represent).with(kind_of(ActiveRecord::Relation), any_args)
|
||||
.exactly(5).times
|
||||
|
||||
5.times { get api("/projects/#{project.id}/releases", maintainer) }
|
||||
end
|
||||
end
|
||||
|
||||
context 'when tag does not exist in git repository' do
|
||||
let!(:release) { create(:release, project: project, tag: 'v1.1.5') }
|
||||
|
||||
|
|
Loading…
Reference in a new issue