Can't run DAST scan without repository

When no default branch is provided to the on-demand scans form, we
assume that no repository has been created yet and we show an error
message to recommend creating one.
parent 0d75eede
......@@ -439,6 +439,13 @@ export default {
searchPlaceholder: __('Search'),
}"
/>
<div v-if="!defaultBranch" class="gl-text-red-500 gl-mt-3">
{{
s__(
'OnDemandScans|You must create a repository within your project to run an on-demand scan.',
)
}}
</div>
</gl-form-group>
<scanner-profile-selector
......
---
title: Call out the inability to run on-demand scans without a repository being created
merge_request:
author:
type: changed
......@@ -630,6 +630,26 @@ describe('OnDemandScansForm', () => {
});
});
describe('when no repository exists', () => {
beforeEach(() => {
mountShallowSubject({
propsData: {
/**
* The assumption here is that, if a default branch is not defined, then the project
* does not have a repository.
*/
defaultBranch: '',
},
});
});
it('shows an error message', () => {
expect(subject.text()).toContain(
'You must create a repository within your project to run an on-demand scan.',
);
});
});
describe('dastBranchSelection feature flag disabled', () => {
describe.each`
action | actionFunction | runAfter
......
......@@ -21560,6 +21560,9 @@ msgstr ""
msgid "OnDemandScans|You cannot run an active scan against an unvalidated site."
msgstr ""
msgid "OnDemandScans|You must create a repository within your project to run an on-demand scan."
msgstr ""
msgid "Once a project is permanently deleted, it %{strongStart}cannot be recovered%{strongEnd}. Permanently deleting this project will %{strongStart}immediately delete%{strongEnd} its repositories and %{strongStart}all related resources%{strongEnd}, including issues, merge requests etc."
msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment