diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-31 12:10:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-31 12:10:44 +0300 |
commit | de0c73ffc58e75c1304a2b76e51ee49a89a2162a (patch) | |
tree | d69807ace2a59a285e345faab27a1486a9c7e8fa | |
parent | fffced70e176bc1279a03ac0d98f3cf8f92d97b7 (diff) |
Add latest changes from gitlab-org/gitlab@master
-rw-r--r-- | Gemfile | 2 | ||||
-rw-r--r-- | Gemfile.lock | 4 | ||||
-rw-r--r-- | app/assets/javascripts/boards/components/modal/header.vue | 22 | ||||
-rw-r--r-- | app/assets/javascripts/lib/utils/datetime_utility.js | 8 | ||||
-rw-r--r-- | app/policies/ci/build_policy.rb | 7 | ||||
-rw-r--r-- | app/views/layouts/nav/sidebar/_project.html.haml | 6 | ||||
-rw-r--r-- | changelogs/unreleased/sh-azure-custom-domains.yml | 5 | ||||
-rw-r--r-- | doc/user/packages/composer_repository/index.md | 4 | ||||
-rw-r--r-- | doc/user/packages/pypi_repository/index.md | 36 | ||||
-rw-r--r-- | lib/object_storage/config.rb | 6 | ||||
-rw-r--r-- | lib/object_storage/direct_upload.rb | 3 | ||||
-rw-r--r-- | locale/gitlab.pot | 3 | ||||
-rw-r--r-- | spec/features/issues/user_views_issue_spec.rb | 26 | ||||
-rw-r--r-- | spec/lib/object_storage/direct_upload_spec.rb | 19 |
14 files changed, 107 insertions, 44 deletions
@@ -119,7 +119,7 @@ gem 'fog-local', '~> 0.6' gem 'fog-openstack', '~> 1.0' gem 'fog-rackspace', '~> 0.1.1' gem 'fog-aliyun', '~> 0.3' -gem 'gitlab-fog-azure-rm', '~> 0.7', require: false +gem 'gitlab-fog-azure-rm', '~> 0.8', require: false # for Google storage gem 'google-api-client', '~> 0.33' diff --git a/Gemfile.lock b/Gemfile.lock index 6e3c5f88ebd..5d64692e6fb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -419,7 +419,7 @@ GEM github-markup (1.7.0) gitlab-chronic (0.10.5) numerizer (~> 0.2) - gitlab-fog-azure-rm (0.7.0) + gitlab-fog-azure-rm (0.8.1) azure-storage (~> 0.15.0.preview) fog-core (= 2.1.0) fog-json (~> 1.2.0) @@ -1301,7 +1301,7 @@ DEPENDENCIES gitaly (~> 13.3.0.pre.rc1) github-markup (~> 1.7.0) gitlab-chronic (~> 0.10.5) - gitlab-fog-azure-rm (~> 0.7) + gitlab-fog-azure-rm (~> 0.8) gitlab-labkit (= 0.12.1) gitlab-license (~> 1.0) gitlab-mail_room (~> 0.0.6) diff --git a/app/assets/javascripts/boards/components/modal/header.vue b/app/assets/javascripts/boards/components/modal/header.vue index ae811cff542..3e96ecca24c 100644 --- a/app/assets/javascripts/boards/components/modal/header.vue +++ b/app/assets/javascripts/boards/components/modal/header.vue @@ -1,5 +1,6 @@ <script> /* eslint-disable @gitlab/vue-require-i18n-strings */ +import { GlButton } from '@gitlab/ui'; import { __ } from '~/locale'; import ModalFilters from './filters'; import ModalTabs from './tabs.vue'; @@ -10,6 +11,7 @@ export default { components: { ModalTabs, ModalFilters, + GlButton, }, mixins: [modalMixin], props: { @@ -39,7 +41,7 @@ export default { }, methods: { toggleAll() { - this.$refs.selectAllBtn.blur(); + this.$refs.selectAllBtn.$el.blur(); ModalStore.toggleAll(); }, @@ -51,28 +53,28 @@ export default { <header class="add-issues-header border-top-0 form-actions"> <h2 class="m-0"> Add issues - <button - type="button" + <gl-button + category="tertiary" + icon="close" class="close" data-dismiss="modal" :aria-label="__('Close')" @click="toggleModal(false)" - > - <span aria-hidden="true">×</span> - </button> + /> </h2> </header> <modal-tabs v-if="!loading && issuesCount > 0" /> <div v-if="showSearch" class="d-flex gl-mb-3"> <modal-filters :store="filter" /> - <button + <gl-button ref="selectAllBtn" - type="button" - class="btn btn-success btn-inverted gl-ml-3" + category="secondary" + variant="success" + class="gl-ml-3" @click="toggleAll" > {{ selectAllText }} - </button> + </gl-button> </div> </div> </template> diff --git a/app/assets/javascripts/lib/utils/datetime_utility.js b/app/assets/javascripts/lib/utils/datetime_utility.js index e26b63fbb85..7e3f1231a30 100644 --- a/app/assets/javascripts/lib/utils/datetime_utility.js +++ b/app/assets/javascripts/lib/utils/datetime_utility.js @@ -702,13 +702,7 @@ export const approximateDuration = (seconds = 0) => { * @return {Date} the date object from the params */ export const dateFromParams = (year, month, day) => { - const date = new Date(); - - date.setFullYear(year); - date.setMonth(month); - date.setDate(day); - - return date; + return new Date(year, month, day); }; /** diff --git a/app/policies/ci/build_policy.rb b/app/policies/ci/build_policy.rb index cc66ad0577d..b3950c6a0e3 100644 --- a/app/policies/ci/build_policy.rb +++ b/app/policies/ci/build_policy.rb @@ -20,6 +20,11 @@ module Ci end end + # overridden in EE + condition(:protected_environment_access) do + false + end + condition(:owner_of_job) do @subject.triggered_by?(@user) end @@ -40,7 +45,7 @@ module Ci @subject.pipeline.webide? end - rule { protected_ref | archived }.policy do + rule { ~protected_environment_access & (protected_ref | archived) }.policy do prevent :update_build prevent :update_commit_status prevent :erase_build diff --git a/app/views/layouts/nav/sidebar/_project.html.haml b/app/views/layouts/nav/sidebar/_project.html.haml index 054311214ab..0eef587d7c7 100644 --- a/app/views/layouts/nav/sidebar/_project.html.haml +++ b/app/views/layouts/nav/sidebar/_project.html.haml @@ -167,7 +167,7 @@ = render_if_exists "layouts/nav/requirements_link", project: @project - if project_nav_tab? :pipelines - = nav_link(controller: [:pipelines, :builds, :jobs, :pipeline_schedules, :artifacts], unless: -> { current_path?('projects/pipelines#charts') }) do + = nav_link(controller: [:pipelines, :builds, :jobs, :pipeline_schedules, :artifacts, :test_cases], unless: -> { current_path?('projects/pipelines#charts') }) do = link_to project_pipelines_path(@project), class: 'shortcuts-pipelines qa-link-pipelines rspec-link-pipelines', data: { qa_selector: 'ci_cd_link' } do .nav-icon-container = sprite_icon('rocket') @@ -175,7 +175,7 @@ = _('CI / CD') %ul.sidebar-sub-level-items - = nav_link(controller: [:pipelines, :builds, :jobs, :pipeline_schedules, :artifacts], html_options: { class: "fly-out-top-item" }) do + = nav_link(controller: [:pipelines, :builds, :jobs, :pipeline_schedules, :artifacts, :test_cases], html_options: { class: "fly-out-top-item" }) do = link_to project_pipelines_path(@project) do %strong.fly-out-top-item-name = _('CI / CD') @@ -204,6 +204,8 @@ %span = _('Schedules') + = render_if_exists "layouts/nav/test_cases_link", project: @project + = render_if_exists 'layouts/nav/sidebar/project_security_link' # EE-specific - if project_nav_tab? :operations diff --git a/changelogs/unreleased/sh-azure-custom-domains.yml b/changelogs/unreleased/sh-azure-custom-domains.yml new file mode 100644 index 00000000000..d94fb1a700c --- /dev/null +++ b/changelogs/unreleased/sh-azure-custom-domains.yml @@ -0,0 +1,5 @@ +--- +title: Support custom Azure Blob Storage domains +merge_request: 40694 +author: +type: added diff --git a/doc/user/packages/composer_repository/index.md b/doc/user/packages/composer_repository/index.md index cc3c1c48a62..54e7c4e56be 100644 --- a/doc/user/packages/composer_repository/index.md +++ b/doc/user/packages/composer_repository/index.md @@ -80,6 +80,10 @@ Now that the basics of our project is completed, we can publish the package. To publish the package, you need: - A personal access token. You can generate a [personal access token](../../../user/profile/personal_access_tokens.md) with the scope set to `api` for repository authentication. + NOTE: **Note:** + + [Deploy tokens](./../../project/deploy_tokens/index.md) are not yet supported for use with Composer. + - Your project ID which can be found on the home page of your project. To publish the package hosted on GitLab, make a `POST` request to the GitLab package API. diff --git a/doc/user/packages/pypi_repository/index.md b/doc/user/packages/pypi_repository/index.md index 73cf0ecae20..8e3a5f6eb5f 100644 --- a/doc/user/packages/pypi_repository/index.md +++ b/doc/user/packages/pypi_repository/index.md @@ -248,6 +248,13 @@ Uploading mypypipackage-0.0.1.tar.gz This indicates that the package was uploaded successfully. You can then navigate to your project's **Packages & Registries** page and see the uploaded packages. +If you would rather not use a `.pypirc` file to define your repository source, +you can upload to the repository with the authentication inline: + +```shell +TWINE_PASSWORD=<personal_access_token or deploy_token> TWINE_USERNAME=<username or deploy_token_username> python3 -m twine upload --repository-url https://gitlab.com/api/v4/projects/<project_id>/packages/pypi dist/* +``` + If you did not follow the guide above, then you need to ensure your package has been properly built and you [created a PyPi package with `setuptools`](https://packaging.python.org/tutorials/packaging-projects/). @@ -292,3 +299,32 @@ Collecting mypypipackage Installing collected packages: mypypipackage Successfully installed mypypipackage-0.0.1 ``` + +## Using GitLab CI with PyPI packages + +NOTE: **Note:** +`CI_JOB_TOKEN`s are not yet supported for use with PyPI. + +To work with PyPI commands within [GitLab CI/CD](./../../../ci/README.md), you can use +[environment variables](./../../../ci/variables/README.md#custom-environment-variables) +to access your authentication tokens in your commands. + +Set up environment variables for `TWINE_PASSWORD` and `TWINE_USERNAME` using either: + +- A [personal access token](../../../user/profile/personal_access_tokens.md) and your GitLab username. +- A [deploy token](./../../project/deploy_tokens/index.md) and its associated deploy token username. + +You can now access your `TWINE_USERNAME` and `TWINE_PASSWORD` using any `twine` command in your +`.gitlab-ci.yml` file. + +For example: + +```yaml +image: python:latest + +run: + script: + - pip install twine + - python setup.py sdist bdist_wheel + - TWINE_PASSWORD=${TWINE_PASSWORD} TWINE_USERNAME=${TWINE_USERNAME} python -m twine upload --repository-url https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/packages/pypi dist/* +``` diff --git a/lib/object_storage/config.rb b/lib/object_storage/config.rb index d0777914cb5..e91fda29880 100644 --- a/lib/object_storage/config.rb +++ b/lib/object_storage/config.rb @@ -54,6 +54,12 @@ module ObjectStorage end # End AWS-specific options + # Begin Azure-specific options + def azure_storage_domain + credentials[:azure_storage_domain] + end + # End Azure-specific options + def google? provider == 'Google' end diff --git a/lib/object_storage/direct_upload.rb b/lib/object_storage/direct_upload.rb index 90199114f2c..75d6cdb8912 100644 --- a/lib/object_storage/direct_upload.rb +++ b/lib/object_storage/direct_upload.rb @@ -98,6 +98,9 @@ module ObjectStorage RemoteTempObjectID: object_name, ObjectStorage: { Provider: 'AzureRM', + AzureConfig: { + StorageDomain: config.azure_storage_domain + }, GoCloudConfig: { URL: "azblob://#{bucket_name}" } diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 411cbdd5097..8b819f2acb7 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -24263,6 +24263,9 @@ msgstr "" msgid "Test" msgstr "" +msgid "Test Cases" +msgstr "" + msgid "Test coverage parsing" msgstr "" diff --git a/spec/features/issues/user_views_issue_spec.rb b/spec/features/issues/user_views_issue_spec.rb index 2b610bab9f0..b5d7e2691e5 100644 --- a/spec/features/issues/user_views_issue_spec.rb +++ b/spec/features/issues/user_views_issue_spec.rb @@ -3,12 +3,16 @@ require "spec_helper" RSpec.describe "User views issue" do - let(:project) { create(:project_empty_repo, :public) } - let(:user) { create(:user) } - let(:issue) { create(:issue, project: project, description: "# Description header", author: user) } + let_it_be(:project) { create(:project_empty_repo, :public) } + let_it_be(:user) { create(:user) } + let_it_be(:issue) { create(:issue, project: project, description: "# Description header", author: user) } + let_it_be(:note) { create(:note, noteable: issue, project: project, author: user) } - before do + before_all do project.add_developer(user) + end + + before do sign_in(user) visit(project_issue_path(project, issue)) @@ -37,24 +41,20 @@ RSpec.describe "User views issue" do context 'when showing status of the author of the issue' do it_behaves_like 'showing user status' do - let(:user_with_status) { issue.author } + let(:user_with_status) { user } end end context 'when showing status of a user who commented on an issue', :js do - let!(:note) { create(:note, noteable: issue, project: project, author: user_with_status) } - it_behaves_like 'showing user status' do - let(:user_with_status) { create(:user) } + let(:user_with_status) { user } end end context 'when status message has an emoji', :js do - let(:message) { 'My status with an emoji' } - let(:message_emoji) { 'basketball' } - - let!(:note) { create(:note, noteable: issue, project: project, author: user) } - let!(:status) { create(:user_status, user: user, emoji: 'smirk', message: "#{message} :#{message_emoji}:") } + let_it_be(:message) { 'My status with an emoji' } + let_it_be(:message_emoji) { 'basketball' } + let_it_be(:status) { create(:user_status, user: user, emoji: 'smirk', message: "#{message} :#{message_emoji}:") } it 'correctly renders the emoji' do tooltip_span = page.first(".user-status-emoji[title^='#{message}']") diff --git a/spec/lib/object_storage/direct_upload_spec.rb b/spec/lib/object_storage/direct_upload_spec.rb index b11926aeb49..f73cc1f73dc 100644 --- a/spec/lib/object_storage/direct_upload_spec.rb +++ b/spec/lib/object_storage/direct_upload_spec.rb @@ -211,6 +211,7 @@ RSpec.describe ObjectStorage::DirectUpload do expect(subject[:UseWorkhorseClient]).to be true expect(subject[:RemoteTempObjectID]).to eq(object_name) expect(subject[:ObjectStorage][:Provider]).to eq('AzureRM') + expect(subject[:ObjectStorage][:AzureConfig][:StorageDomain]).to eq(storage_domain) expect(subject[:ObjectStorage][:GoCloudConfig]).to eq({ URL: "azblob://#{bucket_name}" }) end end @@ -395,20 +396,22 @@ RSpec.describe ObjectStorage::DirectUpload do } end + let(:has_length) { false } + let(:storage_domain) { nil } let(:storage_url) { 'https://azuretest.blob.core.windows.net' } - context 'when length is known' do - let(:has_length) { true } + it_behaves_like 'a valid AzureRM upload' + it_behaves_like 'a valid upload without multipart data' - it_behaves_like 'a valid AzureRM upload' - it_behaves_like 'a valid upload without multipart data' - end + context 'when a custom storage domain is used' do + let(:storage_domain) { 'blob.core.chinacloudapi.cn' } + let(:storage_url) { "https://azuretest.#{storage_domain}" } - context 'when length is unknown' do - let(:has_length) { false } + before do + credentials[:azure_storage_domain] = storage_domain + end it_behaves_like 'a valid AzureRM upload' - it_behaves_like 'a valid upload without multipart data' end end end |