Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2020-01-15 15:08:32 +00:00
parent 0820b29dca
commit 9044365a91
22 changed files with 192 additions and 35 deletions

View file

@ -1,4 +1,5 @@
<script>
import _ from 'underscore';
import { GlTooltip } from '@gitlab/ui';
import { __, sprintf } from '~/locale';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
@ -56,17 +57,36 @@ export default {
collapseIcon() {
return this.isExpanded ? 'chevron-down' : 'chevron-right';
},
noCodeFn() {
return this.errorFn ? sprintf(__('in %{errorFn} '), { errorFn: this.errorFn }) : '';
errorFnText() {
return this.errorFn
? sprintf(
__(`%{spanStart}in%{spanEnd} %{errorFn}`),
{
errorFn: `<strong>${_.escape(this.errorFn)}</strong>`,
spanStart: `<span class="text-tertiary">`,
spanEnd: `</span>`,
},
noCodeLine() {
return this.errorLine
? sprintf(__('at line %{errorLine}%{errorColumn}'), {
errorLine: this.errorLine,
errorColumn: this.errorColumn ? `:${this.errorColumn}` : '',
})
false,
)
: '';
},
errorPositionText() {
return this.errorLine
? sprintf(
__(`%{spanStart}at line%{spanEnd} %{errorLine}%{errorColumn}`),
{
errorLine: `<strong>${this.errorLine}</strong>`,
errorColumn: this.errorColumn ? `:<strong>${this.errorColumn}</strong>` : ``,
spanStart: `<span class="text-tertiary">`,
spanEnd: `</span>`,
},
false,
)
: '';
},
errorInfo() {
return `${this.errorFnText} ${this.errorPositionText}`;
},
},
methods: {
isHighlighted(lineNum) {
@ -102,8 +122,7 @@ export default {
<strong
v-gl-tooltip
:title="filePath"
class="file-title-name d-inline-block overflow-hidden text-truncate"
:class="{ 'limited-width': !hasCode }"
class="file-title-name d-inline-block overflow-hidden text-truncate limited-width"
data-container="body"
>
{{ filePath }}
@ -113,7 +132,7 @@ export default {
:text="filePath"
css-class="btn-default btn-transparent btn-clipboard position-static"
/>
<span v-if="!hasCode" class="text-tertiary">{{ noCodeFn }}{{ noCodeLine }}</span>
<span v-html="errorInfo"></span>
</div>
</div>

View file

@ -222,7 +222,7 @@ document.addEventListener('DOMContentLoaded', () => {
// Disable form buttons while a form is submitting
$body.on('ajax:complete, ajax:beforeSend, submit', 'form', function ajaxCompleteCallback(e) {
const $buttons = $('[type="submit"], .js-disable-on-submit', this);
const $buttons = $('[type="submit"], .js-disable-on-submit', this).not('.js-no-auto-disable');
switch (e.type) {
case 'ajax:beforeSend':
case 'submit':

View file

@ -5,6 +5,7 @@ import FileTable from './table/index.vue';
import getRefMixin from '../mixins/get_ref';
import getFiles from '../queries/getFiles.query.graphql';
import getProjectPath from '../queries/getProjectPath.query.graphql';
import getVueFileListLfsBadge from '../queries/getVueFileListLfsBadge.query.graphql';
import FilePreview from './preview/index.vue';
import { readmeFile } from '../utils/readme';
@ -20,6 +21,9 @@ export default {
projectPath: {
query: getProjectPath,
},
vueFileListLfsBadge: {
query: getVueFileListLfsBadge,
},
},
props: {
path: {
@ -43,6 +47,7 @@ export default {
blobs: [],
},
isLoadingFiles: false,
vueFileListLfsBadge: false,
};
},
computed: {
@ -77,6 +82,7 @@ export default {
path: this.path || '/',
nextPageCursor: this.nextPageCursor,
pageSize: PAGE_SIZE,
vueLfsEnabled: this.vueFileListLfsBadge,
},
})
.then(({ data }) => {

View file

@ -23,6 +23,7 @@ export default function setupVueRepositoryList() {
projectPath,
projectShortPath,
ref,
vueFileListLfsBadge: gon?.features?.vueFileListLfsBadge,
commits: [],
},
});

View file

@ -14,6 +14,7 @@ query getFiles(
$ref: String!
$pageSize: Int!
$nextPageCursor: String
$vueLfsEnabled: Boolean = false
) {
project(fullPath: $projectPath) {
repository {
@ -46,7 +47,7 @@ query getFiles(
node {
...TreeEntry
webUrl
lfsOid
lfsOid @include(if: $vueLfsEnabled)
}
}
pageInfo {

View file

@ -0,0 +1,3 @@
query getProjectShortPath {
vueFileListLfsBadge @client
}

View file

@ -15,6 +15,10 @@ class Projects::TreeController < Projects::ApplicationController
before_action :authorize_download_code!
before_action :authorize_edit_tree!, only: [:create_dir]
before_action only: [:show] do
push_frontend_feature_flag(:vue_file_list_lfs_badge)
end
def show
return render_404 unless @repository.commit(@ref)

View file

@ -266,7 +266,7 @@ module Ci
end
before_transition on: :enqueue_preparing do |build|
build.any_unmet_prerequisites? # If false is returned, it stops the transition
!build.any_unmet_prerequisites? # If false is returned, it stops the transition
end
after_transition created: :scheduled do |build|

View file

@ -11,6 +11,8 @@ module Clusters
def on_success
app.make_installed!
Gitlab::Tracking.event('cluster:applications', "cluster_application_#{app.name}_installed")
ensure
remove_installation_pod
end

View file

@ -0,0 +1,5 @@
---
title: Prevent builds from halting unnecessarily when completing prerequisites
merge_request: 22938
author:
type: fixed

View file

@ -0,0 +1,5 @@
---
title: Display fn, line num and column in stacktrace entry caption
merge_request: 22905
author:
type: added

View file

@ -0,0 +1,5 @@
---
title: Gracefully handle marking a project deletion multiple times
merge_request: 22949
author:
type: fixed

View file

@ -21,7 +21,6 @@
- cloud_native_installation
- cluster_cost_optimization
- cluster_monitoring
- code_analytics
- code_quality
- code_review
- collection

View file

@ -35,7 +35,7 @@ production: &base
https: false # Set to true if using HTTPS, see installation.md#using-https for additional HTTPS configuration details
# The maximum time unicorn/puma can spend on the request. This needs to be smaller than the worker timeout.
# Default is 95% of the worker timeout
max_request_duration: 57
max_request_duration_seconds: 57
# Uncomment this line below if your ssh host is different from HTTP/HTTPS one
# (you'd obviously need to replace ssh.host_example.com with your own host).

View file

@ -123,6 +123,20 @@ a single node only, rather than as a PostgreSQL cluster.
Configure the [**secondary** database](database.md) as a read-only replica of
the **primary** database. Use the following as a guide.
1. Generate an MD5 hash of the desired password for the database user that the
GitLab application will use to access the read-replica database:
Note that the username (`gitlab` by default) is incorporated into the hash.
```sh
gitlab-ctl pg-password-md5 gitlab
# Enter password: <your_password_here>
# Confirm password: <your_password_here>
# fca0b89a972d69f00eb3ec98a5838484
```
Use this hash to fill in `<md5_hash_of_your_password>` in the next step.
1. Edit `/etc/gitlab/gitlab.rb` in the replica database machine, and add the
following:
@ -167,6 +181,22 @@ only a single machine, rather than as a PostgreSQL cluster.
Configure the tracking database.
1. Generate an MD5 hash of the desired password for the database user that the
GitLab application will use to access the tracking database:
Note that the username (`gitlab_geo` by default) is incorporated into the
hash.
```sh
gitlab-ctl pg-password-md5 gitlab_geo
# Enter password: <your_password_here>
# Confirm password: <your_password_here>
# fca0b89a972d69f00eb3ec98a5838484
```
Use this hash to fill in `<tracking_database_password_md5_hash>` in the next
step.
1. Edit `/etc/gitlab/gitlab.rb` in the tracking database machine, and add the
following:

View file

@ -494,16 +494,55 @@ The following steps are for Omnibus installs only. Using Geo with source-based i
To check the configuration:
1. SSH into an app node in the **secondary**:
```sh
sudo -i
```
Note: An app node is any machine running at least one of the following services:
- `puma`
- `unicorn`
- `sidekiq`
- `geo-logcursor`
1. Enter the database console:
If the tracking database is running on the same node:
```sh
gitlab-geo-psql
```
1. Check whether any tables are present. If everything is working, you
should see something like this:
Or, if the tracking database is running on a different node, you must specify
the user and host when entering the database console:
```sh
gitlab-geo-psql -U gitlab_geo -h <IP of tracking database>
```
You will be prompted for the password of the `gitlab_geo` user. You can find
it in plaintext in `/etc/gitlab/gitlab.rb` at:
```ruby
geo_secondary['db_password'] = '<geo_tracking_db_password>'
```
This password is normally set on the tracking database during
[Step 3: Configure the tracking database on the secondary node](high_availability.md#step-3-configure-the-tracking-database-on-the-secondary-node),
and it is set on the app nodes during
[Step 4: Configure the frontend application servers on the secondary node](high_availability.md#step-4-configure-the-frontend-application-servers-on-the-secondary-node).
1. Check whether any tables are present with the following statement:
```sql
SELECT * from information_schema.foreign_tables;
```
If everything is working, you should see something like this:
```
gitlabhq_geo_production=# SELECT * from information_schema.foreign_tables;
foreign_table_catalog | foreign_table_schema | foreign_table_name | foreign_server_catalog | foreign_server_name
-------------------------+----------------------+-------------------------------------------------+-------------------------+---------------------
@ -519,7 +558,7 @@ To check the configuration:
1. Check that the foreign server mapping is correct via `\des+`. The
results should look something like this:
```sql
```
gitlabhq_geo_production=# \des+
List of foreign servers
-[ RECORD 1 ]--------+------------------------------------------------------------
@ -555,7 +594,7 @@ To check the configuration:
1. Check that the user mapping is configured properly via `\deu+`:
```sql
```
gitlabhq_geo_production=# \deu+
List of user mappings
Server | User name | FDW Options

View file

@ -185,9 +185,9 @@ their color is `#428BCA`.
`<Category Name>` is the category name as it is in the single source of truth for categories at
<https://gitlab.com/gitlab-com/www-gitlab-com/blob/master/data/categories.yml>.
For instance, the "Code Analytics" category is represented by the
~"Category:Code Analytics" label in the `gitlab-org` group since its
`code_analytics.name` value is "Code Analytics".
For instance, the "DevOps Score" category is represented by the
~"Category:DevOps Score" label in the `gitlab-org` group since its
`devops_score.name` value is "DevOps Score".
If a category's label doesn't respect this naming convention, it should be specified
with [the `label` attribute](https://about.gitlab.com/handbook/marketing/website/#category-attributes)

View file

@ -73,3 +73,8 @@ Ensure a [Product Designer](https://about.gitlab.com/company/team/?department=ux
reviews the use of the non-conforming component as part of the MR review. Make a
follow up issue and attach it to the component implementation epic found within the
[Components of Pajamas Design System epic](https://gitlab.com/groups/gitlab-org/-/epics/973).
### 4. My submit form button becomes disabled after submitting
If you are using a submit button inside a form and you attach an `onSubmit` event listener on the form element, [this piece of code](https://gitlab.com/gitlab-org/gitlab/blob/794c247a910e2759ce9b401356432a38a4535d49/app/assets/javascripts/main.js#L225) will add a `disabled` class selector to the submit button when the form is submitted.
To avoid this behavior, add the class `js-no-auto-disable` to the button.

View file

@ -373,6 +373,12 @@ msgstr ""
msgid "%{spammable_titlecase} was submitted to Akismet successfully."
msgstr ""
msgid "%{spanStart}at line%{spanEnd} %{errorLine}%{errorColumn}"
msgstr ""
msgid "%{spanStart}in%{spanEnd} %{errorFn}"
msgstr ""
msgid "%{start} to %{end}"
msgstr ""
@ -4544,9 +4550,6 @@ msgstr ""
msgid "Code"
msgstr ""
msgid "Code Analytics"
msgstr ""
msgid "Code Owners"
msgstr ""
@ -21522,9 +21525,6 @@ msgstr ""
msgid "assign yourself"
msgstr ""
msgid "at line %{errorLine}%{errorColumn}"
msgstr ""
msgid "attach a new file"
msgstr ""
@ -21997,9 +21997,6 @@ msgstr ""
msgid "importing"
msgstr ""
msgid "in %{errorFn} "
msgstr ""
msgid "in group %{link_to_group}"
msgstr ""

View file

@ -46,8 +46,8 @@ describe('Stacktrace Entry', () => {
expect(wrapper.findAll('.line_content.old').length).toBe(1);
});
describe('no code block', () => {
const findFileHeaderContent = () => wrapper.find('.file-header-content').html();
describe('entry caption', () => {
const findFileHeaderContent = () => wrapper.find('.file-header-content').text();
it('should hide collapse icon and render error fn name and error line when there is no code block', () => {
const extraInfo = { errorLine: 34, errorFn: 'errorFn', errorColumn: 77 };

View file

@ -341,6 +341,36 @@ describe Ci::Build do
end
end
describe '#enqueue_preparing' do
let(:build) { create(:ci_build, :preparing) }
subject { build.enqueue_preparing }
before do
allow(build).to receive(:any_unmet_prerequisites?).and_return(has_unmet_prerequisites)
end
context 'build completed prerequisites' do
let(:has_unmet_prerequisites) { false }
it 'transitions to pending' do
subject
expect(build).to be_pending
end
end
context 'build did not complete prerequisites' do
let(:has_unmet_prerequisites) { true }
it 'remains in preparing' do
subject
expect(build).to be_preparing
end
end
end
describe '#actionize' do
context 'when build is a created' do
before do

View file

@ -160,6 +160,12 @@ describe Clusters::Applications::CheckInstallationProgressService, '#execute' do
expect(application).to be_installed
expect(application.status_reason).to be_nil
end
it 'tracks application install' do
expect(Gitlab::Tracking).to receive(:event).with('cluster:applications', "cluster_application_helm_installed")
service.execute
end
end
context 'when installation POD failed' do