Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
dcd7f2bd4b
commit
164814285e
23 changed files with 507 additions and 100 deletions
|
@ -63,7 +63,7 @@ export default {
|
|||
title: s__('DesignManagement|Are you sure you want to archive the selected designs?'),
|
||||
actionPrimary: {
|
||||
text: s__('DesignManagement|Archive designs'),
|
||||
attributes: { variant: 'warning', 'data-qa-selector': 'confirm_archiving_button' },
|
||||
attributes: { variant: 'confirm', 'data-qa-selector': 'confirm_archiving_button' },
|
||||
},
|
||||
actionCancel: {
|
||||
text: __('Cancel'),
|
||||
|
|
|
@ -38,7 +38,8 @@ export default {
|
|||
"
|
||||
:disabled="isSaving"
|
||||
:loading="isSaving"
|
||||
variant="default"
|
||||
category="secondary"
|
||||
variant="confirm"
|
||||
size="small"
|
||||
@click="openFileUpload"
|
||||
>
|
||||
|
|
|
@ -379,8 +379,7 @@ export default {
|
|||
<delete-button
|
||||
v-if="isLatestVersion"
|
||||
:is-deleting="loading"
|
||||
button-variant="warning"
|
||||
button-category="secondary"
|
||||
button-variant="default"
|
||||
button-class="gl-mr-3"
|
||||
button-size="small"
|
||||
data-qa-selector="archive_button"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script>
|
||||
import { GlButton, GlDropdown, GlDropdownItem, GlIcon, GlLink, GlModal } from '@gitlab/ui';
|
||||
import { GlButton, GlDropdown, GlDropdownItem, GlLink, GlModal } from '@gitlab/ui';
|
||||
import { mapActions, mapGetters, mapState } from 'vuex';
|
||||
import createFlash, { FLASH_TYPES } from '~/flash';
|
||||
import { EVENT_ISSUABLE_VUE_APP_CHANGE } from '~/issuable/constants';
|
||||
|
@ -17,7 +17,6 @@ export default {
|
|||
GlButton,
|
||||
GlDropdown,
|
||||
GlDropdownItem,
|
||||
GlIcon,
|
||||
GlLink,
|
||||
GlModal,
|
||||
},
|
||||
|
@ -88,9 +87,6 @@ export default {
|
|||
qaSelector() {
|
||||
return this.isClosed ? 'reopen_issue_button' : 'close_issue_button';
|
||||
},
|
||||
buttonVariant() {
|
||||
return this.isClosed ? 'default' : 'warning';
|
||||
},
|
||||
dropdownText() {
|
||||
return sprintf(__('%{issueType} actions'), {
|
||||
issueType: capitalizeFirstCharacter(this.issueType),
|
||||
|
@ -192,9 +188,9 @@ export default {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<div class="detail-page-header-actions">
|
||||
<div class="detail-page-header-actions gl-display-flex">
|
||||
<gl-dropdown
|
||||
class="gl-display-block gl-sm-display-none!"
|
||||
class="gl-sm-display-none! w-100"
|
||||
block
|
||||
:text="dropdownText"
|
||||
:loading="isToggleStateButtonLoading"
|
||||
|
@ -227,23 +223,20 @@ export default {
|
|||
category="secondary"
|
||||
:data-qa-selector="qaSelector"
|
||||
:loading="isToggleStateButtonLoading"
|
||||
:variant="buttonVariant"
|
||||
@click="toggleIssueState"
|
||||
>
|
||||
{{ buttonText }}
|
||||
</gl-button>
|
||||
|
||||
<gl-dropdown
|
||||
class="gl-display-none gl-sm-display-inline-flex!"
|
||||
toggle-class="gl-border-0! gl-shadow-none!"
|
||||
class="gl-display-none gl-sm-display-inline-flex! gl-ml-3"
|
||||
icon="ellipsis_v"
|
||||
category="tertiary"
|
||||
:text="dropdownText"
|
||||
:text-sr-only="true"
|
||||
no-caret
|
||||
right
|
||||
>
|
||||
<template #button-content>
|
||||
<gl-icon name="ellipsis_v" />
|
||||
<span class="gl-sr-only">{{ dropdownText }}</span>
|
||||
</template>
|
||||
|
||||
<gl-dropdown-item v-if="canCreateIssue" :href="newIssuePath">
|
||||
{{ newIssueTypeText }}
|
||||
</gl-dropdown-item>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
= render 'devise/shared/tab_single', tab_title:'Change your password'
|
||||
= render 'devise/shared/tab_single', tab_title: 'Change your password'
|
||||
.login-box
|
||||
.login-body
|
||||
= form_for(resource, as: resource_name, url: password_path(:user), html: { method: :put, class: 'gl-show-field-errors' }) do |f|
|
||||
|
|
|
@ -11,18 +11,18 @@
|
|||
- refs_path = refs_namespace_project_path(@project.namespace, @project, search: '')
|
||||
|
||||
.create-mr-dropdown-wrap.d-inline-block.full-width-mobile.js-create-mr{ data: { project_path: @project.full_path, project_id: @project.id, can_create_path: can_create_path, create_mr_path: create_mr_path, create_branch_path: create_branch_path, refs_path: refs_path, is_confidential: can_create_confidential_merge_request?.to_s } }
|
||||
.btn-group.btn-group-sm.unavailable
|
||||
%button.btn.btn-grouped{ type: 'button', disabled: 'disabled' }
|
||||
.spinner.align-text-bottom.mr-1.hide
|
||||
.btn-group.unavailable
|
||||
%button.gl-button.btn{ type: 'button', disabled: 'disabled' }
|
||||
.spinner.align-text-bottom.gl-button-icon.hide
|
||||
%span.text
|
||||
Checking branch availability…
|
||||
|
||||
.btn-group.btn-group-sm.available.hidden
|
||||
%button.gl-button.btn.js-create-merge-request.btn-success.btn-inverted{ type: 'button', data: { action: data_action } }
|
||||
.btn-group.available.hidden
|
||||
%button.gl-button.btn.js-create-merge-request.btn-confirm{ type: 'button', data: { action: data_action } }
|
||||
.spinner.js-spinner.gl-mr-2.gl-display-none
|
||||
= value
|
||||
|
||||
%button.btn.gl-button.create-merge-request-dropdown-toggle.dropdown-toggle.btn-success.btn-inverted.js-dropdown-toggle.gl-flex-grow-0.gl-h-7{ type: 'button', data: { dropdown: { trigger: '#create-merge-request-dropdown' }, display: 'static' } }
|
||||
%button.gl-button.btn.btn-confirm.btn-icon.dropdown-toggle.create-merge-request-dropdown-toggle.js-dropdown-toggle{ type: 'button', data: { dropdown: { trigger: '#create-merge-request-dropdown' }, display: 'static' } }
|
||||
= sprite_icon('chevron-down')
|
||||
|
||||
.droplab-dropdown
|
||||
|
|
|
@ -54,25 +54,25 @@
|
|||
= link_to '#tab-members', class: ['nav-link', ('active' unless groups_tab_active?)], data: { toggle: 'tab' } do
|
||||
%span
|
||||
= _('Members')
|
||||
%span.badge.badge-pill= @project_members.total_count
|
||||
%span.badge.gl-tab-counter-badge.badge-muted.badge-pill.gl-badge.sm= @project_members.total_count
|
||||
- if show_groups?(@group_links)
|
||||
%li.nav-item
|
||||
= link_to '#tab-groups', class: ['nav-link', ('active' if groups_tab_active?)] , data: { toggle: 'tab', qa_selector: 'groups_list_tab' } do
|
||||
%span
|
||||
= _('Groups')
|
||||
%span.badge.badge-pill= @group_links.count
|
||||
%span.badge.gl-tab-counter-badge.badge-muted.badge-pill.gl-badge.sm= @group_links.count
|
||||
- if show_invited_members?(@project, @invited_members)
|
||||
%li.nav-item
|
||||
= link_to '#tab-invited-members', class: 'nav-link', data: { toggle: 'tab' } do
|
||||
%span
|
||||
= _('Invited')
|
||||
%span.badge.badge-pill= @invited_members.count
|
||||
%span.badge.gl-tab-counter-badge.badge-muted.badge-pill.gl-badge.sm= @invited_members.count
|
||||
- if show_access_requests?(@project, @requesters)
|
||||
%li.nav-item
|
||||
= link_to '#tab-access-requests', class: 'nav-link', data: { toggle: 'tab' } do
|
||||
%span
|
||||
= _('Access requests')
|
||||
%span.badge.badge-pill= @requesters.count
|
||||
%span.badge.gl-tab-counter-badge.badge-muted.badge-pill.gl-badge.sm= @requesters.count
|
||||
.tab-content
|
||||
#tab-members.tab-pane{ class: ('active' unless groups_tab_active?) }
|
||||
.js-project-members-list{ data: project_members_list_data_attributes(@project, @project_members) }
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#js-issuable-header-warnings
|
||||
= issuable_meta(issuable, @project)
|
||||
|
||||
%a.btn.gl-button.btn-default.float-right.gl-display-block.d-sm-none.gutter-toggle.issuable-gutter-toggle.js-sidebar-toggle{ href: "#" }
|
||||
%a.btn.gl-button.btn-default.btn-icon.float-right.gl-display-block.d-sm-none.gutter-toggle.issuable-gutter-toggle.js-sidebar-toggle{ href: "#" }
|
||||
= sprite_icon('chevron-double-lg-left')
|
||||
|
||||
.js-issue-header-actions{ data: issue_header_actions_data(@project, issuable, current_user) }
|
||||
|
|
5
changelogs/unreleased/273274-update-issue-buttons.yml
Normal file
5
changelogs/unreleased/273274-update-issue-buttons.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Update buttons on issue page
|
||||
merge_request: 56425
|
||||
author:
|
||||
type: changed
|
5
changelogs/unreleased/gl-badge-project-members.yml
Normal file
5
changelogs/unreleased/gl-badge-project-members.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Add gl-badge for badges in project members page
|
||||
merge_request: 57934
|
||||
author: Yogi (@yo)
|
||||
type: changed
|
3
qa/qa.rb
3
qa/qa.rb
|
@ -80,6 +80,7 @@ module QA
|
|||
autoload :CiVariable, 'qa/resource/ci_variable'
|
||||
autoload :Runner, 'qa/resource/runner'
|
||||
autoload :PersonalAccessToken, 'qa/resource/personal_access_token'
|
||||
autoload :ProjectAccessToken, 'qa/resource/project_access_token'
|
||||
autoload :User, 'qa/resource/user'
|
||||
autoload :ProjectMilestone, 'qa/resource/project_milestone'
|
||||
autoload :GroupMilestone, 'qa/resource/group_milestone'
|
||||
|
@ -318,6 +319,7 @@ module QA
|
|||
autoload :MirroringRepositories, 'qa/page/project/settings/mirroring_repositories'
|
||||
autoload :ProtectedTags, 'qa/page/project/settings/protected_tags'
|
||||
autoload :VisibilityFeaturesPermissions, 'qa/page/project/settings/visibility_features_permissions'
|
||||
autoload :AccessTokens, 'qa/page/project/settings/access_tokens'
|
||||
|
||||
module Services
|
||||
autoload :Jira, 'qa/page/project/settings/services/jira'
|
||||
|
@ -500,6 +502,7 @@ module QA
|
|||
autoload :Wiki, 'qa/page/component/wiki'
|
||||
autoload :WikiSidebar, 'qa/page/component/wiki_sidebar'
|
||||
autoload :WikiPageForm, 'qa/page/component/wiki_page_form'
|
||||
autoload :AccessTokens, 'qa/page/component/access_tokens'
|
||||
autoload :CommitModal, 'qa/page/component/commit_modal'
|
||||
|
||||
module Issuable
|
||||
|
|
75
qa/qa/page/component/access_tokens.rb
Normal file
75
qa/qa/page/component/access_tokens.rb
Normal file
|
@ -0,0 +1,75 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module QA
|
||||
module Page
|
||||
module Component
|
||||
module AccessTokens
|
||||
extend QA::Page::PageConcern
|
||||
|
||||
def self.included(base)
|
||||
super
|
||||
|
||||
base.view 'app/assets/javascripts/access_tokens/components/expires_at_field.vue' do
|
||||
element :expiry_date_field
|
||||
end
|
||||
|
||||
base.view 'app/views/shared/access_tokens/_form.html.haml' do
|
||||
element :access_token_name_field
|
||||
element :create_token_button
|
||||
end
|
||||
|
||||
base.view 'app/views/shared/tokens/_scopes_form.html.haml' do
|
||||
element :api_radio, 'qa-#{scope}-radio' # rubocop:disable QA/ElementWithPattern, Lint/InterpolationCheck
|
||||
end
|
||||
|
||||
base.view 'app/views/shared/access_tokens/_created_container.html.haml' do
|
||||
element :created_access_token
|
||||
end
|
||||
|
||||
base.view 'app/views/shared/access_tokens/_table.html.haml' do
|
||||
element :revoke_button
|
||||
end
|
||||
end
|
||||
|
||||
def fill_token_name(name)
|
||||
fill_element(:access_token_name_field, name)
|
||||
end
|
||||
|
||||
def check_api
|
||||
check_element(:api_radio)
|
||||
end
|
||||
|
||||
def click_create_token_button
|
||||
click_element(:create_token_button)
|
||||
end
|
||||
|
||||
def created_access_token
|
||||
find_element(:created_access_token, wait: 30).value
|
||||
end
|
||||
|
||||
def fill_expiry_date(date)
|
||||
date = date.to_s if date.is_a?(Date)
|
||||
Date.strptime(date, '%Y-%m-%d') rescue ArgumentError raise "Expiry date must be in YYYY-MM-DD format"
|
||||
|
||||
fill_element(:expiry_date_field, date)
|
||||
end
|
||||
|
||||
def has_token_row_for_name?(token_name)
|
||||
page.has_css?('tr', text: token_name, wait: 1.0)
|
||||
end
|
||||
|
||||
def first_token_row_for_name(token_name)
|
||||
page.find('tr', text: token_name, match: :first, wait: 1.0)
|
||||
end
|
||||
|
||||
def revoke_first_token_with_name(token_name)
|
||||
within first_token_row_for_name(token_name) do
|
||||
accept_confirm do
|
||||
click_element(:revoke_button)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -6,64 +6,7 @@ module QA
|
|||
module Page
|
||||
module Profile
|
||||
class PersonalAccessTokens < Page::Base
|
||||
view 'app/assets/javascripts/access_tokens/components/expires_at_field.vue' do
|
||||
element :expiry_date_field
|
||||
end
|
||||
|
||||
view 'app/views/shared/access_tokens/_form.html.haml' do
|
||||
element :access_token_name_field
|
||||
element :create_token_button
|
||||
end
|
||||
|
||||
view 'app/views/shared/tokens/_scopes_form.html.haml' do
|
||||
element :api_radio, 'qa-#{scope}-radio' # rubocop:disable QA/ElementWithPattern, Lint/InterpolationCheck
|
||||
end
|
||||
|
||||
view 'app/views/shared/access_tokens/_created_container.html.haml' do
|
||||
element :created_access_token
|
||||
end
|
||||
view 'app/views/shared/access_tokens/_table.html.haml' do
|
||||
element :revoke_button
|
||||
end
|
||||
|
||||
def fill_token_name(name)
|
||||
fill_element(:access_token_name_field, name)
|
||||
end
|
||||
|
||||
def check_api
|
||||
check_element(:api_radio)
|
||||
end
|
||||
|
||||
def click_create_token_button
|
||||
click_element(:create_token_button)
|
||||
end
|
||||
|
||||
def created_access_token
|
||||
find_element(:created_access_token, wait: 30).value
|
||||
end
|
||||
|
||||
def fill_expiry_date(date)
|
||||
date = date.to_s if date.is_a?(Date)
|
||||
Date.strptime(date, '%Y-%m-%d') rescue ArgumentError raise "Expiry date must be in YYYY-MM-DD format"
|
||||
|
||||
fill_element(:expiry_date_field, date)
|
||||
end
|
||||
|
||||
def has_token_row_for_name?(token_name)
|
||||
page.has_css?('tr', text: token_name, wait: 1.0)
|
||||
end
|
||||
|
||||
def first_token_row_for_name(token_name)
|
||||
page.find('tr', text: token_name, match: :first, wait: 1.0)
|
||||
end
|
||||
|
||||
def revoke_first_token_with_name(token_name)
|
||||
within first_token_row_for_name(token_name) do
|
||||
accept_confirm do
|
||||
click_element(:revoke_button)
|
||||
end
|
||||
end
|
||||
end
|
||||
include Page::Component::AccessTokens
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
15
qa/qa/page/project/settings/access_tokens.rb
Normal file
15
qa/qa/page/project/settings/access_tokens.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'date'
|
||||
|
||||
module QA
|
||||
module Page
|
||||
module Project
|
||||
module Settings
|
||||
class AccessTokens < Page::Base
|
||||
include Page::Component::AccessTokens
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -18,6 +18,7 @@ module QA
|
|||
element :general_settings_link
|
||||
element :integrations_settings_link
|
||||
element :operations_settings_link
|
||||
element :access_tokens_settings_link
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -68,6 +69,14 @@ module QA
|
|||
end
|
||||
end
|
||||
|
||||
def go_to_access_token_settings
|
||||
hover_settings do
|
||||
within_submenu do
|
||||
click_element :access_tokens_settings_link
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def hover_settings
|
||||
|
|
74
qa/qa/resource/project_access_token.rb
Normal file
74
qa/qa/resource/project_access_token.rb
Normal file
|
@ -0,0 +1,74 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'date'
|
||||
|
||||
module QA
|
||||
module Resource
|
||||
class ProjectAccessToken < Base
|
||||
attr_writer :name
|
||||
|
||||
attribute :id
|
||||
attribute :project do
|
||||
Project.fabricate!
|
||||
end
|
||||
attribute :token do
|
||||
Page::Project::Settings::AccessTokens.perform(&:created_access_token)
|
||||
end
|
||||
|
||||
def fabricate_via_api!
|
||||
super
|
||||
end
|
||||
|
||||
def api_get_path
|
||||
"/projects/#{project.api_resource[:id]}/access_tokens"
|
||||
end
|
||||
|
||||
def api_post_path
|
||||
api_get_path
|
||||
end
|
||||
|
||||
def name
|
||||
@name || 'api-project-access-token'
|
||||
end
|
||||
|
||||
def api_post_body
|
||||
{
|
||||
name: name,
|
||||
scopes: ["api"]
|
||||
}
|
||||
end
|
||||
|
||||
def api_delete_path
|
||||
"projects/#{project.api_resource[:id]}/access_tokens/#{id}"
|
||||
end
|
||||
|
||||
def resource_web_url(resource)
|
||||
super
|
||||
rescue ResourceURLMissingError
|
||||
# this particular resource does not expose a web_url property
|
||||
end
|
||||
|
||||
def revoke_via_ui!
|
||||
Page::Project::Settings::AccessTokens.perform do |tokens_page|
|
||||
tokens_page.revoke_first_token_with_name(name)
|
||||
end
|
||||
end
|
||||
|
||||
def fabricate!
|
||||
Flow::Login.sign_in_unless_signed_in
|
||||
|
||||
project.visit!
|
||||
|
||||
Page::Project::Menu.perform(&:go_to_access_token_settings)
|
||||
|
||||
Page::Project::Settings::AccessTokens.perform do |token_page|
|
||||
token_page.fill_token_name(name || 'api-project-access-token')
|
||||
token_page.check_api
|
||||
# Expire in 2 days just in case the token is created just before midnight
|
||||
token_page.fill_expiry_date(Time.now.utc.to_date + 2)
|
||||
token_page.click_create_token_button
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -6,7 +6,7 @@ module QA
|
|||
module Resource
|
||||
class RegistryRepository < Base
|
||||
attr_accessor :name,
|
||||
:repository_id
|
||||
:tag_name
|
||||
|
||||
attribute :project do
|
||||
Project.fabricate_via_api! do |resource|
|
||||
|
@ -15,9 +15,17 @@ module QA
|
|||
end
|
||||
end
|
||||
|
||||
attribute :id do
|
||||
registry_repositories = project.registry_repositories
|
||||
|
||||
return unless (this_registry_repository = registry_repositories&.find { |registry_repository| registry_repository[:path] == name }) # rubocop:disable Cop/AvoidReturnFromBlocks
|
||||
|
||||
this_registry_repository[:id]
|
||||
end
|
||||
|
||||
def initialize
|
||||
@name = project.path_with_namespace
|
||||
@repository_id = nil
|
||||
@tag_name = 'master'
|
||||
end
|
||||
|
||||
def fabricate!
|
||||
|
@ -31,23 +39,57 @@ module QA
|
|||
|
||||
def remove_via_api!
|
||||
registry_repositories = project.registry_repositories
|
||||
|
||||
if registry_repositories && !registry_repositories.empty?
|
||||
this_registry_repository = registry_repositories.find { |registry_repository| registry_repository[:path] == name }
|
||||
|
||||
@repository_id = this_registry_repository[:id]
|
||||
|
||||
QA::Runtime::Logger.debug("Deleting registry '#{name}'")
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
def api_delete_path
|
||||
"/projects/#{project.id}/registry/repositories/#{@repository_id}"
|
||||
"/projects/#{project.id}/registry/repositories/#{id}"
|
||||
end
|
||||
|
||||
def api_delete_tag_path
|
||||
"/projects/#{project.id}/registry/repositories/#{id}/tags/#{tag_name}"
|
||||
end
|
||||
|
||||
def api_get_path
|
||||
"/projects/#{project.id}/registry/repositories"
|
||||
end
|
||||
|
||||
def api_get_tags_path
|
||||
"/projects/#{project.id}/registry/repositories/#{id}/tags"
|
||||
end
|
||||
|
||||
def has_tag?(tag_name)
|
||||
response = get Runtime::API::Request.new(api_client, api_get_tags_path).url
|
||||
|
||||
raise ResourceNotFoundError, "Request returned (#{response.code}): `#{response}`." if response.code == HTTP_STATUS_NOT_FOUND
|
||||
|
||||
tag_list = parse_body(response)
|
||||
tag_list.any? { |tag| tag[:name] == tag_name }
|
||||
end
|
||||
|
||||
def has_no_tag?(tag_name)
|
||||
response = get Runtime::API::Request.new(api_client, api_get_tags_path).url
|
||||
|
||||
raise ResourceNotFoundError, "Request returned (#{response.code}): `#{response}`." if response.code == HTTP_STATUS_NOT_FOUND
|
||||
|
||||
tag_list = parse_body(response)
|
||||
tag_list.none? { |tag| tag[:name] == tag_name }
|
||||
end
|
||||
|
||||
def delete_tag
|
||||
QA::Runtime::Logger.debug("Deleting registry tag '#{tag_name}'")
|
||||
|
||||
request = Runtime::API::Request.new(api_client, api_delete_tag_path)
|
||||
response = delete(request.url)
|
||||
|
||||
unless [HTTP_STATUS_NO_CONTENT, HTTP_STATUS_ACCEPTED, HTTP_STATUS_OK].include? response.code
|
||||
raise ResourceNotDeletedError, "Resource at #{request.mask_url} could not be deleted (#{response.code}): `#{response}`."
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module QA
|
||||
RSpec.describe 'Manage' do
|
||||
describe 'Project access token' do
|
||||
before(:all) do
|
||||
@project_access_token = QA::Resource::ProjectAccessToken.fabricate_via_api!
|
||||
@user_api_client = Runtime::API::Client.new(:gitlab, personal_access_token: @project_access_token.token)
|
||||
end
|
||||
|
||||
context 'for the same project' do
|
||||
it 'can be used to create a file via the project API', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1734' do
|
||||
expect do
|
||||
Resource::File.fabricate_via_api! do |file|
|
||||
file.api_client = @user_api_client
|
||||
file.project = @project_access_token.project
|
||||
file.branch = 'new_branch'
|
||||
file.commit_message = 'Add new file'
|
||||
file.name = "text-#{SecureRandom.hex(8)}.txt"
|
||||
file.content = 'New file'
|
||||
end
|
||||
end.not_to raise_error
|
||||
end
|
||||
|
||||
it 'can be used to commit via the API', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1735' do
|
||||
expect do
|
||||
Resource::Repository::Commit.fabricate_via_api! do |commit|
|
||||
commit.api_client = @user_api_client
|
||||
commit.project = @project_access_token.project
|
||||
commit.branch = 'new_branch'
|
||||
commit.start_branch = @project_access_token.project.default_branch
|
||||
commit.commit_message = 'Add new file'
|
||||
commit.add_files([
|
||||
{ file_path: "text-#{SecureRandom.hex(8)}.txt", content: 'new file' }
|
||||
])
|
||||
end
|
||||
end.not_to raise_error
|
||||
end
|
||||
end
|
||||
|
||||
context 'for a different project' do
|
||||
before(:all) do
|
||||
@different_project = Resource::Project.fabricate!
|
||||
end
|
||||
|
||||
it 'cannot be used to create a file via the project API', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1736' do
|
||||
expect do
|
||||
Resource::File.fabricate_via_api! do |file|
|
||||
file.api_client = @user_api_client
|
||||
file.project = @different_project
|
||||
file.branch = 'new_branch'
|
||||
file.commit_message = 'Add new file'
|
||||
file.name = "text-#{SecureRandom.hex(8)}.txt"
|
||||
file.content = 'New file'
|
||||
end
|
||||
end.to raise_error(Resource::ApiFabricator::ResourceFabricationFailedError, /403 Forbidden/)
|
||||
end
|
||||
|
||||
it 'cannot be used to commit via the API', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1737' do
|
||||
expect do
|
||||
Resource::Repository::Commit.fabricate_via_api! do |commit|
|
||||
commit.api_client = @user_api_client
|
||||
commit.project = @different_project
|
||||
commit.branch = 'new_branch'
|
||||
commit.start_branch = @different_project.default_branch
|
||||
commit.commit_message = 'Add new file'
|
||||
commit.add_files([
|
||||
{ file_path: "text-#{SecureRandom.hex(8)}.txt", content: 'new file' }
|
||||
])
|
||||
end
|
||||
end.to raise_error(Resource::ApiFabricator::ResourceFabricationFailedError, /403 Forbidden - You are not allowed to push into this branch/)
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
@different_project.remove_via_api!
|
||||
end
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
@project_access_token.remove_via_api!
|
||||
@project_access_token.project.remove_via_api!
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
119
qa/qa/specs/features/api/5_package/container_registry_spec.rb
Normal file
119
qa/qa/specs/features/api/5_package/container_registry_spec.rb
Normal file
|
@ -0,0 +1,119 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'airborne'
|
||||
|
||||
module QA
|
||||
RSpec.describe 'Package', only: { subdomain: :staging } do
|
||||
include Support::Api
|
||||
|
||||
describe 'Container Registry' do
|
||||
let(:api_client) { Runtime::API::Client.new(:gitlab) }
|
||||
|
||||
let(:project) do
|
||||
Resource::Project.fabricate_via_api! do |project|
|
||||
project.name = 'project-with-registry-api'
|
||||
project.template_name = 'express'
|
||||
end
|
||||
end
|
||||
|
||||
let(:registry) do
|
||||
Resource::RegistryRepository.new.tap do |repository|
|
||||
repository.name = "#{project.path_with_namespace}"
|
||||
repository.project = project
|
||||
repository.tag_name = 'master'
|
||||
end
|
||||
end
|
||||
|
||||
let(:gitlab_ci_yaml) do
|
||||
<<~YAML
|
||||
stages:
|
||||
- build
|
||||
- test
|
||||
|
||||
build:
|
||||
image: docker:19.03.12
|
||||
stage: build
|
||||
services:
|
||||
- docker:19.03.12-dind
|
||||
variables:
|
||||
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
|
||||
script:
|
||||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||
- docker build -t $IMAGE_TAG .
|
||||
- docker push $IMAGE_TAG
|
||||
- docker pull $IMAGE_TAG
|
||||
|
||||
test:
|
||||
image: dwdraju/alpine-curl-jq:latest
|
||||
stage: test
|
||||
variables:
|
||||
MEDIA_TYPE: 'application/vnd.docker.distribution.manifest.v2+json'
|
||||
before_script:
|
||||
- token=$(curl -u "$CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD" "https://$CI_SERVER_HOST/jwt/auth?service=container_registry&scope=repository:$CI_PROJECT_PATH:pull,push,delete" | jq -r '.token')
|
||||
script:
|
||||
- 'digest=$(curl -L -H "Authorization: Bearer $token" -H "Accept: $MEDIA_TYPE" "https://$CI_REGISTRY/v2/$CI_PROJECT_PATH/manifests/master" | jq -r ".layers[0].digest")'
|
||||
- 'curl -L -X DELETE -H "Authorization: Bearer $token" -H "Accept: $MEDIA_TYPE" "https://$CI_REGISTRY/v2/$CI_PROJECT_PATH/blobs/$digest"'
|
||||
- 'curl -L --head -H "Authorization: Bearer $token" -H "Accept: $MEDIA_TYPE" "https://$CI_REGISTRY/v2/$CI_PROJECT_PATH/blobs/$digest"'
|
||||
- 'digest=$(curl -L -H "Authorization: Bearer $token" -H "Accept: $MEDIA_TYPE" "https://$CI_REGISTRY/v2/$CI_PROJECT_PATH/manifests/master" | jq -r ".config.digest")'
|
||||
- 'curl -L -X DELETE -H "Authorization: Bearer $token" -H "Accept: $MEDIA_TYPE" "https://$CI_REGISTRY/v2/$CI_PROJECT_PATH/manifests/$digest"'
|
||||
- 'curl -L --head -H "Authorization: Bearer $token" -H "Accept: $MEDIA_TYPE" "https://$CI_REGISTRY/v2/$CI_PROJECT_PATH/manifests/$digest"'
|
||||
|
||||
YAML
|
||||
end
|
||||
|
||||
after do
|
||||
registry&.remove_via_api!
|
||||
end
|
||||
|
||||
it 'pushes, pulls image to the registry and deletes image blob, manifest and tag', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1738' do
|
||||
Resource::Repository::Commit.fabricate_via_api! do |commit|
|
||||
commit.project = project
|
||||
commit.commit_message = 'Add .gitlab-ci.yml'
|
||||
commit.add_files([{
|
||||
file_path: '.gitlab-ci.yml',
|
||||
content: gitlab_ci_yaml
|
||||
}])
|
||||
end
|
||||
|
||||
Support::Waiter.wait_until(max_duration: 10) { pipeline_is_triggered? }
|
||||
|
||||
Support::Retrier.retry_until(max_duration: 260, sleep_interval: 5) do
|
||||
latest_pipeline_succeed?
|
||||
end
|
||||
|
||||
expect(job_log).to have_content '404 Not Found'
|
||||
|
||||
expect(registry).to have_tag('master')
|
||||
|
||||
registry.delete_tag
|
||||
|
||||
expect(registry).not_to have_tag('master')
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def pipeline_is_triggered?
|
||||
!project.pipelines.empty?
|
||||
end
|
||||
|
||||
def latest_pipeline_succeed?
|
||||
latest_pipeline = project.pipelines.first
|
||||
latest_pipeline[:status] == 'success'
|
||||
end
|
||||
|
||||
def job_log
|
||||
pipeline = project.pipelines.first
|
||||
pipeline_id = pipeline[:id]
|
||||
|
||||
jobs = get Runtime::API::Request.new(api_client, "/projects/#{project.id}/pipelines/#{pipeline_id}/jobs").url
|
||||
test_job = parse_body(jobs).first
|
||||
test_job_id = test_job[:id]
|
||||
|
||||
log = get Runtime::API::Request.new(api_client, "/projects/#{project.id}/jobs/#{test_job_id}/trace").url
|
||||
QA::Runtime::Logger.debug(" \n\n ------- Test job log: ------- \n\n #{log} \n -------")
|
||||
|
||||
log
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,20 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module QA
|
||||
RSpec.describe 'Manage' do
|
||||
describe 'Project access tokens' do
|
||||
let(:project_access_token) {QA::Resource::ProjectAccessToken.fabricate_via_browser_ui!}
|
||||
|
||||
it 'can be created and revoked via the UI' do
|
||||
expect(project_access_token.token).not_to be_nil
|
||||
|
||||
project_access_token.revoke_via_ui!
|
||||
expect(page).to have_text("Revoked project access token #{project_access_token.name}!")
|
||||
end
|
||||
|
||||
after do
|
||||
project_access_token.project.remove_via_api!
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -6,11 +6,11 @@ exports[`Design management upload button component renders inverted upload desig
|
|||
>
|
||||
<gl-button-stub
|
||||
buttontextclasses=""
|
||||
category="primary"
|
||||
category="secondary"
|
||||
icon=""
|
||||
size="small"
|
||||
title="Adding a design with the same filename replaces the file in a new version."
|
||||
variant="default"
|
||||
variant="confirm"
|
||||
>
|
||||
|
||||
Upload designs
|
||||
|
@ -31,11 +31,11 @@ exports[`Design management upload button component renders upload design button
|
|||
<div>
|
||||
<gl-button-stub
|
||||
buttontextclasses=""
|
||||
category="primary"
|
||||
category="secondary"
|
||||
icon=""
|
||||
size="small"
|
||||
title="Adding a design with the same filename replaces the file in a new version."
|
||||
variant="default"
|
||||
variant="confirm"
|
||||
>
|
||||
|
||||
Upload designs
|
||||
|
|
19
vendor/shims/mimemagic/Gemfile.lock
vendored
Normal file
19
vendor/shims/mimemagic/Gemfile.lock
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
mimemagic (0.3.7)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
rake (12.3.3)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
mimemagic!
|
||||
rake (~> 12.0)
|
||||
|
||||
BUNDLED WITH
|
||||
2.1.4
|
Loading…
Reference in a new issue