Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
97b2ec92
Commit
97b2ec92
authored
Jan 13, 2021
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab master
parents
bf9c14de
1cc51c95
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
196 additions
and
102 deletions
+196
-102
app/assets/javascripts/pipelines/components/pipelines_list/pipelines.vue
...scripts/pipelines/components/pipelines_list/pipelines.vue
+1
-1
app/assets/javascripts/vue_shared/components/navigation_tabs.vue
...ets/javascripts/vue_shared/components/navigation_tabs.vue
+20
-17
changelogs/unreleased/230728-nav-tabs-migration.yml
changelogs/unreleased/230728-nav-tabs-migration.yml
+5
-0
doc/user/application_security/coverage_fuzzing/index.md
doc/user/application_security/coverage_fuzzing/index.md
+1
-1
ee/app/models/concerns/geo/blob_replicator_strategy.rb
ee/app/models/concerns/geo/blob_replicator_strategy.rb
+1
-1
ee/app/models/concerns/geo/verifiable_replicator.rb
ee/app/models/concerns/geo/verifiable_replicator.rb
+4
-9
ee/lib/gitlab/geo/replicator.rb
ee/lib/gitlab/geo/replicator.rb
+2
-2
ee/lib/gitlab/geo/verification_state.rb
ee/lib/gitlab/geo/verification_state.rb
+37
-5
ee/spec/lib/gitlab/geo/verification_state_spec.rb
ee/spec/lib/gitlab/geo/verification_state_spec.rb
+49
-0
ee/spec/models/packages/package_file_spec.rb
ee/spec/models/packages/package_file_spec.rb
+1
-1
ee/spec/support/shared_examples/models/concerns/verifiable_replicator_shared_examples.rb
.../models/concerns/verifiable_replicator_shared_examples.rb
+26
-17
spec/frontend/deploy_keys/components/app_spec.js
spec/frontend/deploy_keys/components/app_spec.js
+6
-9
spec/frontend/vue_shared/components/navigation_tabs_spec.js
spec/frontend/vue_shared/components/navigation_tabs_spec.js
+43
-39
No files found.
app/assets/javascripts/pipelines/components/pipelines_list/pipelines.vue
View file @
97b2ec92
...
...
@@ -279,7 +279,7 @@ export default {
<div
class=
"pipelines-container"
>
<div
v-if=
"shouldRenderTabs || shouldRenderButtons"
class=
"top-area scrolling-tabs-container inner-page-scroll-tabs"
class=
"top-area scrolling-tabs-container inner-page-scroll-tabs
gl-border-none
"
>
<div
class=
"fade-left"
><gl-icon
name=
"chevron-lg-left"
:size=
"12"
/></div>
<div
class=
"fade-right"
><gl-icon
name=
"chevron-lg-right"
:size=
"12"
/></div>
...
...
app/assets/javascripts/vue_shared/components/navigation_tabs.vue
View file @
97b2ec92
<
script
>
import
$
from
'
jquery
'
;
import
{
GlBadge
,
GlTabs
,
GlTab
}
from
'
@gitlab/ui
'
;
/**
* Given an array of tabs, renders non linked bootstrap tabs.
...
...
@@ -23,6 +24,11 @@ import $ from 'jquery';
*/
export
default
{
name
:
'
NavigationTabs
'
,
components
:
{
GlBadge
,
GlTabs
,
GlTab
,
},
props
:
{
tabs
:
{
type
:
Array
,
...
...
@@ -50,24 +56,21 @@ export default {
};
</
script
>
<
template
>
<
ul
class=
"nav-links scrolling-tabs separator
"
>
<
li
<
gl-tabs
class=
"gl-display-flex gl-w-full"
nav-class=
"gl-border-0!
"
>
<
gl-tab
v-for=
"(tab, i) in tabs"
:key=
"i"
:class=
"
{
active: tab.isActive,
}"
:title-link-class=
"`js-$
{scope}-tab-${tab.scope} gl-display-inline-flex`"
:title-link-attributes="{ 'data-testid': `${scope}-tab-${tab.scope}` }"
:active="tab.isActive"
@click="onTabClick(tab)"
>
<a
:class=
"`js-$
{scope}-tab-${tab.scope}`"
:data-testid="`${scope}-tab-${tab.scope}`"
role="button"
@click="onTabClick(tab)"
>
{{
tab
.
name
}}
<span
v-if=
"shouldRenderBadge(tab.count)"
class=
"badge badge-pill"
>
{{
tab
.
count
}}
</span>
</a>
</li>
</ul>
<template
#title
>
<span
class=
"gl-mr-2"
>
{{
tab
.
name
}}
</span>
<gl-badge
v-if=
"shouldRenderBadge(tab.count)"
size=
"sm"
class=
"gl-tab-counter-badge"
>
{{
tab
.
count
}}
</gl-badge>
</
template
>
</gl-tab>
</gl-tabs>
</template>
changelogs/unreleased/230728-nav-tabs-migration.yml
0 → 100644
View file @
97b2ec92
---
title
:
Convert navigation_tabs.vue to gl-tabs
merge_request
:
47841
author
:
type
:
other
doc/user/application_security/coverage_fuzzing/index.md
View file @
97b2ec92
...
...
@@ -29,8 +29,8 @@ Docker image with the fuzz engine to run your app.
| GoLang |
[
go-fuzz (libFuzzer support)
](
https://github.com/dvyukov/go-fuzz
)
|
[
go-fuzzing-example
](
https://gitlab.com/gitlab-org/security-products/demos/coverage-fuzzing/go-fuzzing-example
)
|
| Swift |
[
libfuzzer
](
https://github.com/apple/swift/blob/master/docs/libFuzzerIntegration.md
)
|
[
swift-fuzzing-example
](
https://gitlab.com/gitlab-org/security-products/demos/coverage-fuzzing/swift-fuzzing-example
)
|
| Rust |
[
cargo-fuzz (libFuzzer support)
](
https://github.com/rust-fuzz/cargo-fuzz
)
|
[
rust-fuzzing-example
](
https://gitlab.com/gitlab-org/security-products/demos/coverage-fuzzing/rust-fuzzing-example
)
|
| Java |
[
JQF
](
https://github.com/rohanpadhye/JQF
)
|
[
java-fuzzing-example
](
https://gitlab.com/gitlab-org/security-products/demos/coverage-fuzzing/java-fuzzing-example
)
|
| Java |
[
javafuzz
](
https://gitlab.com/gitlab-org/security-products/analyzers/fuzzers/javafuzz
)
(
recommended
)
|
[
javafuzz-fuzzing-example
](
https://gitlab.com/gitlab-org/security-products/demos/coverage-fuzzing/javafuzz-fuzzing-example
)
|
| Java |
[
JQF
](
https://github.com/rohanpadhye/JQF
)
(
not
preferred) |
[
jqf-fuzzing-example
](
https://gitlab.com/gitlab-org/security-products/demos/coverage-fuzzing/java-fuzzing-example
)
|
| JavaScript |
[
jsfuzz
](
https://gitlab.com/gitlab-org/security-products/analyzers/fuzzers/jsfuzz
)
|
[
jsfuzz-fuzzing-example
](
https://gitlab.com/gitlab-org/security-products/demos/coverage-fuzzing/jsfuzz-fuzzing-example
)
|
| Python |
[
pythonfuzz
](
https://gitlab.com/gitlab-org/security-products/analyzers/fuzzers/pythonfuzz
)
|
[
pythonfuzz-fuzzing-example
](
https://gitlab.com/gitlab-org/security-products/demos/coverage-fuzzing/pythonfuzz-fuzzing-example
)
|
...
...
ee/app/models/concerns/geo/blob_replicator_strategy.rb
View file @
97b2ec92
...
...
@@ -13,7 +13,7 @@ module Geo
end
def
handle_after_create_commit
return
false
unless
Gitlab
::
Geo
.
enabled
?
return
false
unless
Gitlab
::
Geo
.
primary
?
return
unless
self
.
class
.
enabled?
publish
(
:created
,
**
created_params
)
...
...
ee/app/models/concerns/geo/verifiable_replicator.rb
View file @
97b2ec92
...
...
@@ -125,17 +125,12 @@ module Geo
Geo
::
VerificationWorker
.
perform_async
(
replicable_name
,
model_record
.
id
)
end
# Calculates checksum and asks the model/registry to
updat
e verification
# Calculates checksum and asks the model/registry to
manag
e verification
# state.
def
verify
model_record
.
verification_started!
unless
model_record
.
verification_started?
calculation_started_at
=
Time
.
current
checksum
=
model_record
.
calculate_checksum
model_record
.
verification_succeeded_with_checksum!
(
checksum
,
calculation_started_at
)
rescue
=>
e
model_record
.
verification_failed_with_message!
(
'Error calculating the checksum'
,
e
)
model_record
.
track_checksum_attempt!
do
model_record
.
calculate_checksum
end
end
# Check if given checksum matches known one
...
...
ee/lib/gitlab/geo/replicator.rb
View file @
97b2ec92
...
...
@@ -267,14 +267,14 @@ module Gitlab
end
def
handle_after_destroy
return
false
unless
Gitlab
::
Geo
.
enabled
?
return
false
unless
Gitlab
::
Geo
.
primary
?
return
unless
self
.
class
.
enabled?
publish
(
:deleted
,
**
deleted_params
)
end
def
handle_after_update
return
false
unless
Gitlab
::
Geo
.
enabled
?
return
false
unless
Gitlab
::
Geo
.
primary
?
return
unless
self
.
class
.
enabled?
publish
(
:updated
,
**
updated_params
)
...
...
ee/lib/gitlab/geo/verification_state.rb
View file @
97b2ec92
...
...
@@ -177,6 +177,25 @@ module Gitlab
end
end
# Provides a safe and easy way to manage the verification state for a
# synchronous checksum calculation.
#
# @yieldreturn [String] calculated checksum value
def
track_checksum_attempt!
(
&
block
)
# This line only applies to Geo::VerificationWorker, not
# Geo::VerificationBatchWorker, since the latter sets the whole batch to
# "verification_started" in the same DB query that fetches the batch.
verification_started!
unless
verification_started?
calculation_started_at
=
Time
.
current
checksum
=
yield
track_checksum_result!
(
checksum
,
calculation_started_at
)
rescue
=>
e
verification_failed_with_message!
(
'Error during verification'
,
e
)
end
# Convenience method to update checksum and transition to success state.
#
# @param [String] checksum value generated by the checksum routine
...
...
@@ -193,23 +212,36 @@ module Gitlab
end
end
def
resource_updated_during_checksum?
(
calculation_started_at
)
self
.
reset
.
verification_started_at
>
calculation_started_at
end
# Convenience method to update failure message and transition to failed
# state.
#
# @param [String] message error information
# @param [StandardError] error exception
def
verification_failed_with_message!
(
message
,
error
=
nil
)
log_error
(
'Error calculating the checksum'
,
error
)
log_error
(
message
,
error
)
self
.
verification_failure
=
message
self
.
verification_failure
+=
":
#{
error
.
message
}
"
if
error
.
respond_to?
(
:message
)
self
.
verification_failed!
end
private
# Records the calculated checksum result
#
# Overridden by ReplicableRegistry so it can also compare with primary
# checksum.
#
# @param [String] calculated checksum value
# @param [Time] when checksum calculation was started
def
track_checksum_result!
(
checksum
,
calculation_started_at
)
verification_succeeded_with_checksum!
(
checksum
,
calculation_started_at
)
end
def
resource_updated_during_checksum?
(
calculation_started_at
)
self
.
reset
.
verification_started_at
>
calculation_started_at
end
end
end
end
ee/spec/lib/gitlab/geo/verification_state_spec.rb
View file @
97b2ec92
...
...
@@ -157,6 +157,55 @@ RSpec.describe Gitlab::Geo::VerificationState do
end
end
describe
'#track_checksum_attempt!'
do
context
'when verification was not yet started'
do
it
'starts verification'
do
expect
do
subject
.
track_checksum_attempt!
do
'a_checksum_value'
end
end
.
to
change
{
subject
.
verification_started_at
}.
from
(
nil
)
end
it
'sets verification_succeeded'
do
expect
do
subject
.
track_checksum_attempt!
do
'a_checksum_value'
end
end
.
to
change
{
subject
.
verification_succeeded?
}.
from
(
false
).
to
(
true
)
end
end
context
'when verification was started'
do
it
'does not update verification_started_at'
do
subject
.
verification_started!
expected
=
subject
.
verification_started_at
subject
.
track_checksum_attempt!
do
'a_checksum_value'
end
expect
(
subject
.
verification_started_at
).
to
be_within
(
1
.
second
).
of
(
expected
)
end
end
it
'yields to the checksum calculation'
do
expect
do
|
probe
|
subject
.
track_checksum_attempt!
(
&
probe
)
end
.
to
yield_with_no_args
end
context
'when an error occurs while yielding'
do
it
'sets verification_failed'
do
subject
.
track_checksum_attempt!
do
raise
'an error'
end
expect
(
subject
.
reload
.
verification_failed?
).
to
be_truthy
end
end
end
describe
'#verification_succeeded_with_checksum!'
do
before
do
subject
.
verification_started!
...
...
ee/spec/models/packages/package_file_spec.rb
View file @
97b2ec92
...
...
@@ -22,7 +22,7 @@ RSpec.describe Packages::PackageFile, type: :model do
context
'new file'
do
it
'calls checksum worker'
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:enabled?
).
and_return
(
true
)
stub_primary_node
allow
(
Geo
::
VerificationWorker
).
to
receive
(
:perform_async
)
package_file
=
create
(
:conan_package_file
,
:conan_recipe_file
)
...
...
ee/spec/support/shared_examples/models/concerns/verifiable_replicator_shared_examples.rb
View file @
97b2ec92
...
...
@@ -326,30 +326,39 @@ RSpec.shared_examples 'a verifiable replicator' do
end
describe
'#verify'
do
context
'on a Geo primary'
do
it
'wraps the checksum calculation in track_checksum_attempt!'
do
tracker
=
double
(
'tracker'
,
calculate_checksum:
'abc123'
)
allow
(
replicator
).
to
receive
(
:model_record
).
and_return
(
tracker
)
expect
(
tracker
).
to
receive
(
:track_checksum_attempt!
).
and_yield
replicator
.
verify
end
end
context
'integration tests'
do
before
do
model_record
.
save!
end
context
'on a primary'
do
before
do
stub_primary_node
end
context
'when the checksum succeeds'
do
it
'delegates checksum calculation and the state change to model_record'
do
expect
(
model_record
).
to
receive
(
:calculate_checksum
).
and_return
(
'abc123'
)
expect
(
model_record
).
to
receive
(
:verification_succeeded_with_checksum!
).
with
(
'abc123'
,
kind_of
(
Time
))
replicator
.
verify
describe
'background backfill'
do
it
'verifies model records'
do
expect
do
Geo
::
VerificationBatchWorker
.
new
.
perform
(
replicator
.
replicable_name
)
end
.
to
change
{
model_record
.
reload
.
verification_succeeded?
}.
from
(
false
).
to
(
true
)
end
end
context
'when an error is raised during calculate_checksum'
do
it
'passes the error message'
do
error
=
StandardError
.
new
(
'Some exception'
)
allow
(
model_record
).
to
receive
(
:calculate_checksum
)
do
raise
error
end
expect
(
model_record
).
to
receive
(
:verification_failed_with_message!
).
with
(
'Error calculating the checksum'
,
error
)
replicator
.
verify
describe
'triggered by events'
do
it
'verifies model records'
do
expect
do
Geo
::
VerificationWorker
.
new
.
perform
(
replicator
.
replicable_name
,
replicator
.
model_record_id
)
end
.
to
change
{
model_record
.
reload
.
verification_succeeded?
}.
from
(
false
).
to
(
true
)
end
end
end
...
...
spec/frontend/deploy_keys/components/app_spec.js
View file @
97b2ec92
...
...
@@ -35,7 +35,7 @@ describe('Deploy keys app component', () => {
});
const
findLoadingIcon
=
()
=>
wrapper
.
find
(
'
.gl-spinner
'
);
const
findKeyPanels
=
()
=>
wrapper
.
findAll
(
'
.deploy-keys .
nav-links
li
'
);
const
findKeyPanels
=
()
=>
wrapper
.
findAll
(
'
.deploy-keys .
gl-tabs-nav
li
'
);
it
(
'
renders loading icon while waiting for request
'
,
()
=>
{
mock
.
onGet
(
TEST_ENDPOINT
).
reply
(()
=>
new
Promise
());
...
...
@@ -54,17 +54,14 @@ describe('Deploy keys app component', () => {
});
it
.
each
`
selector
| label | count
${
'
.js-deployKeys-tab-enabled_keys
'
}
|
${
'
Enabled deploy keys
'
}
|
${
1
}
${
'
.js-deployKeys-tab-available_project_keys
'
}
|
${
'
Privately accessible deploy keys
'
}
|
${
0
}
${
'
.js-deployKeys-tab-public_keys
'
}
|
${
'
Publicly accessible deploy keys
'
}
|
${
1
}
`
(
'
$selector title
is $label with keys count equal to $count
'
,
({
selector
,
label
,
count
})
=>
{
selector
${
'
.js-deployKeys-tab-enabled_keys
'
}
${
'
.js-deployKeys-tab-available_project_keys
'
}
${
'
.js-deployKeys-tab-public_keys
'
}
`
(
'
$selector title
exists
'
,
({
selector
})
=>
{
return
mountComponent
().
then
(()
=>
{
const
element
=
wrapper
.
find
(
selector
);
expect
(
element
.
exists
()).
toBe
(
true
);
expect
(
element
.
text
().
trim
()).
toContain
(
label
);
expect
(
element
.
find
(
'
.badge
'
).
text
().
trim
()).
toBe
(
count
.
toString
());
});
});
...
...
spec/frontend/vue_shared/components/navigation_tabs_spec.js
View file @
97b2ec92
import
Vue
from
'
vue
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
n
avigationTabs
from
'
~/vue_shared/components/navigation_tabs.vue
'
;
import
{
mount
}
from
'
@vue/test-utils
'
;
import
{
GlTab
}
from
'
@gitlab/ui
'
;
import
N
avigationTabs
from
'
~/vue_shared/components/navigation_tabs.vue
'
;
describe
(
'
navigation tabs component
'
,
()
=>
{
let
vm
;
let
Component
;
let
data
;
let
wrapper
;
beforeEach
(()
=>
{
data
=
[
{
name
:
'
All
'
,
scope
:
'
all
'
,
count
:
1
,
isActive
:
true
,
},
{
name
:
'
Pending
'
,
scope
:
'
pending
'
,
count
:
0
,
isActive
:
false
,
},
{
name
:
'
Running
'
,
scope
:
'
running
'
,
isActive
:
false
,
const
data
=
[
{
name
:
'
All
'
,
scope
:
'
all
'
,
count
:
1
,
isActive
:
true
,
},
{
name
:
'
Pending
'
,
scope
:
'
pending
'
,
count
:
0
,
isActive
:
false
,
},
{
name
:
'
Running
'
,
scope
:
'
running
'
,
isActive
:
false
,
},
];
const
createComponent
=
()
=>
{
wrapper
=
mount
(
NavigationTabs
,
{
propsData
:
{
tabs
:
data
,
scope
:
'
pipelines
'
,
},
];
});
};
Component
=
Vue
.
extend
(
navigationTabs
);
vm
=
mountComponent
(
Component
,
{
tabs
:
data
,
scope
:
'
pipelines
'
}
);
beforeEach
(()
=>
{
createComponent
(
);
});
afterEach
(()
=>
{
vm
.
$destroy
();
wrapper
.
destroy
();
wrapper
=
null
;
});
it
(
'
should render tabs
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelectorAll
(
'
li
'
).
length
).
toEqual
(
data
.
length
);
expect
(
wrapper
.
findAll
(
GlTab
)).
toHaveLength
(
data
.
length
);
});
it
(
'
should render active tab
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.active .js-pipelines-tab-all
'
)).
toBeDefined
(
);
expect
(
wrapper
.
find
(
'
.js-pipelines-tab-all
'
).
classes
(
'
active
'
)).
toBe
(
true
);
});
it
(
'
should render badge
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-pipelines-tab-all .badge
'
).
textContent
.
trim
()).
toEqual
(
'
1
'
);
expect
(
vm
.
$el
.
querySelector
(
'
.js-pipelines-tab-pending .badge
'
).
textContent
.
trim
()).
toEqual
(
'
0
'
,
);
expect
(
wrapper
.
find
(
'
.js-pipelines-tab-all
'
).
text
()).
toContain
(
'
1
'
);
expect
(
wrapper
.
find
(
'
.js-pipelines-tab-pending
'
).
text
()).
toContain
(
'
0
'
);
});
it
(
'
should not render badge
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-pipelines-tab-running .badge
'
)).
toEqual
(
null
);
expect
(
wrapper
.
find
(
'
.js-pipelines-tab-running .badge
'
).
exists
()).
toBe
(
false
);
});
it
(
'
should trigger onTabClick
'
,
()
=>
{
jest
.
spyOn
(
vm
,
'
$emit
'
).
mockImplementation
(()
=>
{});
vm
.
$el
.
querySelector
(
'
.js-pipelines-tab-pending
'
).
click
();
it
(
'
should trigger onTabClick
'
,
async
()
=>
{
await
wrapper
.
find
(
'
.js-pipelines-tab-pending
'
).
trigger
(
'
click
'
);
expect
(
vm
.
$emit
).
toHaveBeenCalledWith
(
'
onChangeTab
'
,
'
pending
'
);
expect
(
wrapper
.
emitted
(
'
onChangeTab
'
)).
toEqual
([[
'
pending
'
]]
);
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment