Merge branch 'zj-unadressable-url-variables' into 'master'
Do not check for valid url for .gitlab-ci.yml Closes #22970 See merge request !8451
This commit is contained in:
commit
764fc0dd69
4 changed files with 17 additions and 18 deletions
4
changelogs/unreleased/zj-unadressable-url-variables.yml
Normal file
4
changelogs/unreleased/zj-unadressable-url-variables.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: Don't validate environment urls on .gitlab-ci.yml
|
||||
merge_request:
|
||||
author:
|
|
@ -33,7 +33,6 @@ module Gitlab
|
|||
|
||||
validates :url,
|
||||
length: { maximum: 255 },
|
||||
addressable_url: true,
|
||||
allow_nil: true
|
||||
|
||||
validates :action,
|
||||
|
|
|
@ -769,6 +769,19 @@ module Ci
|
|||
expect(builds.first[:environment]).to eq(environment[:name])
|
||||
expect(builds.first[:options]).to include(environment: environment)
|
||||
end
|
||||
|
||||
context 'the url has a port as variable' do
|
||||
let(:environment) do
|
||||
{ name: 'production',
|
||||
url: 'http://production.gitlab.com:$PORT' }
|
||||
end
|
||||
|
||||
it 'allows a variable for the port' do
|
||||
expect(builds.size).to eq(1)
|
||||
expect(builds.first[:environment]).to eq(environment[:name])
|
||||
expect(builds.first[:options]).to include(environment: environment)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when no environment is specified' do
|
||||
|
|
|
@ -196,22 +196,5 @@ describe Gitlab::Ci::Config::Entry::Environment do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when invalid URL is used' do
|
||||
let(:config) { { name: 'test', url: 'invalid-example.gitlab.com' } }
|
||||
|
||||
describe '#valid?' do
|
||||
it 'is not valid' do
|
||||
expect(entry).not_to be_valid
|
||||
end
|
||||
end
|
||||
|
||||
describe '#errors?' do
|
||||
it 'contains error about invalid URL' do
|
||||
expect(entry.errors)
|
||||
.to include "environment url must be a valid url"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue