Commit d3e13277 authored by Stan Hu's avatar Stan Hu

Merge branch 'remove_dast_unlicensed_290958' into 'master'

Remove dast_unlicensed job

See merge request gitlab-org/gitlab!50129
parents 357eefa5 d18e6abe
---
title: Remove dast_unlicensed job
merge_request: 50129
author:
type: changed
......@@ -47,8 +47,8 @@ RSpec.describe 'Jobs/DAST-Default-Branch-Deploy.gitlab-ci.yml' do
end
context 'when project has no license' do
it 'includes dast_unlicensed job' do
expect(build_names).to match_array(%w(placeholder dast_unlicensed))
it 'includes no DAST jobs' do
expect(build_names).to match_array(%w(placeholder))
end
end
......
......@@ -21,72 +21,8 @@ RSpec.describe 'DAST.gitlab-ci.yml' do
end
context 'when project has no license' do
let(:cluster) { create(:cluster, :project, :provided_by_gcp, projects: [project]) }
context 'when k8 is active' do
before do
allow(cluster).to receive(:active?).and_return(true)
end
it 'includes dast_unlicensed job' do
expect(build_names).to match_array(%w[dast_unlicensed])
end
end
context 'when DAST_WEBSITE is active' do
before do
create(:ci_variable, project: project, key: 'DAST_WEBSITE', value: 'http://example.com')
end
it 'includes dast_unlicensed job' do
expect(build_names).to match_array(%w[dast_unlicensed])
end
end
context 'when DAST_API_SPECIFICATION is set' do
before do
create(:ci_variable, project: project, key: 'DAST_API_SPECIFICATION', value: 'http://example/open-api-v2.json')
end
it 'includes dast_unlicensed job' do
expect(build_names).to match_array(%w[dast_unlicensed])
end
end
context 'when DAST_DISABLED' do
before do
create(:ci_variable, project: project, key: 'DAST_DISABLED', value: '1')
end
it 'includes no job' do
expect { pipeline }.to raise_error(Ci::CreatePipelineService::CreateError)
end
end
context 'when DAST_DISABLED_FOR_DEFAULT_BRANCH and CI_DEFAULT_BRANCH equals CI_COMMIT_REF_NAME' do
before do
create(:ci_variable, project: project, key: 'DAST_DISABLED_FOR_DEFAULT_BRANCH', value: '1')
create(:ci_variable, project: project, key: 'CI_DEFAULT_BRANCH', value: 'test_branch')
create(:ci_variable, project: project, key: 'CI_COMMIT_REF_NAME', value: 'test_branch')
end
it 'includes no job' do
expect { pipeline }.to raise_error(Ci::CreatePipelineService::CreateError)
end
end
context 'when not on default branch and review disabled and both DAST_WEBSITE and DAST_API_SPECIFICATION are not set' do
before do
create(:ci_variable, project: project, key: 'CI_DEFAULT_BRANCH', value: 'main')
create(:ci_variable, project: project, key: 'CI_COMMIT_REF_NAME', value: 'test_branch')
create(:ci_variable, project: project, key: 'REVIEW_DISABLED', value: '1')
create(:ci_variable, project: project, key: 'DAST_WEBSITE', value: nil)
create(:ci_variable, project: project, key: 'DAST_API_SPECIFICATION', value: nil)
end
it 'includes no job' do
expect { pipeline }.to raise_error(Ci::CreatePipelineService::CreateError)
end
it 'includes no jobs' do
expect { pipeline }.to raise_error(Ci::CreatePipelineService::CreateError)
end
end
......
......@@ -49,32 +49,3 @@ dast:
- if: $CI_COMMIT_BRANCH &&
$GITLAB_FEATURES =~ /\bdast\b/ &&
$DAST_API_SPECIFICATION
dast_unlicensed:
stage: dast
allow_failure: true
variables:
GIT_STRATEGY: none
rules:
- if: $DAST_DISABLED
when: never
- if: $DAST_DISABLED_FOR_DEFAULT_BRANCH &&
$CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
when: never
- if: $CI_DEFAULT_BRANCH != $CI_COMMIT_REF_NAME &&
$REVIEW_DISABLED && $DAST_WEBSITE == null &&
$DAST_API_SPECIFICATION == null
when: never
- if: $CI_COMMIT_BRANCH &&
$CI_KUBERNETES_ACTIVE &&
$GITLAB_FEATURES !~ /\bdast\b/
- if: $CI_COMMIT_BRANCH &&
$GITLAB_FEATURES !~ /\bdast\b/ &&
$DAST_WEBSITE
- if: $CI_COMMIT_BRANCH &&
$GITLAB_FEATURES !~ /\bdast\b/ &&
$DAST_API_SPECIFICATION
script:
- |
echo "Error: Your GitLab project is not licensed for DAST."
- exit 1
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