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
ed9c54b5
Commit
ed9c54b5
authored
Nov 25, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add latest changes from gitlab-org/gitlab@master
parent
8f1f6b37
Changes
24
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
280 additions
and
18 deletions
+280
-18
.gitlab-ci.yml
.gitlab-ci.yml
+2
-0
.gitlab/ci/global.gitlab-ci.yml
.gitlab/ci/global.gitlab-ci.yml
+4
-4
.gitlab/ci/notifications.gitlab-ci.yml
.gitlab/ci/notifications.gitlab-ci.yml
+18
-0
app/assets/javascripts/frequent_items/store/mutations.js
app/assets/javascripts/frequent_items/store/mutations.js
+1
-1
app/assets/javascripts/lib/utils/datetime_utility.js
app/assets/javascripts/lib/utils/datetime_utility.js
+16
-0
app/assets/javascripts/monitoring/stores/state.js
app/assets/javascripts/monitoring/stores/state.js
+0
-2
app/models/clusters/applications/runner.rb
app/models/clusters/applications/runner.rb
+1
-1
changelogs/unreleased/27630-specify-kubernetes-namespace-in-ci-template.yml
...sed/27630-specify-kubernetes-namespace-in-ci-template.yml
+5
-0
changelogs/unreleased/fix-groups-search-dropdown.yml
changelogs/unreleased/fix-groups-search-dropdown.yml
+5
-0
changelogs/unreleased/update-gitlab-runner-helm-chart-to-0-11-0.yml
.../unreleased/update-gitlab-runner-helm-chart-to-0-11-0.yml
+5
-0
doc/ci/yaml/README.md
doc/ci/yaml/README.md
+1
-0
doc/development/pipelines.md
doc/development/pipelines.md
+6
-0
lib/gitlab/ci/config/entry/default.rb
lib/gitlab/ci/config/entry/default.rb
+6
-2
lib/gitlab/ci/config/entry/environment.rb
lib/gitlab/ci/config/entry/environment.rb
+13
-2
lib/gitlab/ci/config/entry/job.rb
lib/gitlab/ci/config/entry/job.rb
+4
-4
lib/gitlab/ci/config/entry/kubernetes.rb
lib/gitlab/ci/config/entry/kubernetes.rb
+25
-0
scripts/notify-slack
scripts/notify-slack
+14
-0
spec/frontend/lib/utils/datetime_utility_spec.js
spec/frontend/lib/utils/datetime_utility_spec.js
+24
-0
spec/javascripts/frequent_items/mock_data.js
spec/javascripts/frequent_items/mock_data.js
+1
-1
spec/lib/gitlab/ci/config/entry/default_spec.rb
spec/lib/gitlab/ci/config/entry/default_spec.rb
+1
-1
spec/lib/gitlab/ci/config/entry/environment_spec.rb
spec/lib/gitlab/ci/config/entry/environment_spec.rb
+24
-0
spec/lib/gitlab/ci/config/entry/kubernetes_spec.rb
spec/lib/gitlab/ci/config/entry/kubernetes_spec.rb
+56
-0
spec/lib/gitlab/ci/yaml_processor_spec.rb
spec/lib/gitlab/ci/yaml_processor_spec.rb
+22
-0
spec/services/ci/create_pipeline_service_spec.rb
spec/services/ci/create_pipeline_service_spec.rb
+26
-0
No files found.
.gitlab-ci.yml
View file @
ed9c54b5
...
@@ -9,6 +9,7 @@ stages:
...
@@ -9,6 +9,7 @@ stages:
-
review
-
review
-
qa
-
qa
-
post-test
-
post-test
-
notification
-
pages
-
pages
variables
:
variables
:
...
@@ -33,6 +34,7 @@ include:
...
@@ -33,6 +34,7 @@ include:
-
local
:
.gitlab/ci/frontend.gitlab-ci.yml
-
local
:
.gitlab/ci/frontend.gitlab-ci.yml
-
local
:
.gitlab/ci/global.gitlab-ci.yml
-
local
:
.gitlab/ci/global.gitlab-ci.yml
-
local
:
.gitlab/ci/memory.gitlab-ci.yml
-
local
:
.gitlab/ci/memory.gitlab-ci.yml
-
local
:
.gitlab/ci/notifications.gitlab-ci.yml
-
local
:
.gitlab/ci/pages.gitlab-ci.yml
-
local
:
.gitlab/ci/pages.gitlab-ci.yml
-
local
:
.gitlab/ci/qa.gitlab-ci.yml
-
local
:
.gitlab/ci/qa.gitlab-ci.yml
-
local
:
.gitlab/ci/reports.gitlab-ci.yml
-
local
:
.gitlab/ci/reports.gitlab-ci.yml
...
...
.gitlab/ci/global.gitlab-ci.yml
View file @
ed9c54b5
...
@@ -93,7 +93,7 @@
...
@@ -93,7 +93,7 @@
-
"
config.ru"
-
"
config.ru"
-
"
{package.json,yarn.lock}"
-
"
{package.json,yarn.lock}"
-
"
{,ee/}{app,bin,config,db,haml_lint,lib,locale,public,scripts,symbol,vendor}/**/*"
-
"
{,ee/}{app,bin,config,db,haml_lint,lib,locale,public,scripts,symbol,vendor}/**/*"
-
"
doc/api/graphql/
**/*"
-
"
doc/api/graphql/
reference/*"
# Files in this folder are auto-generated
.backstage-patterns
:
&backstage-patterns
.backstage-patterns
:
&backstage-patterns
-
"
Dangerfile"
-
"
Dangerfile"
...
@@ -139,7 +139,7 @@
...
@@ -139,7 +139,7 @@
-
"
config.ru"
-
"
config.ru"
-
"
{package.json,yarn.lock}"
-
"
{package.json,yarn.lock}"
-
"
{,ee/}{app,bin,config,db,haml_lint,lib,locale,public,scripts,symbol,vendor}/**/*"
-
"
{,ee/}{app,bin,config,db,haml_lint,lib,locale,public,scripts,symbol,vendor}/**/*"
-
"
doc/api/graphql/
**/*"
-
"
doc/api/graphql/
reference/*"
# Files in this folder are auto-generated
# Backstage changes
# Backstage changes
-
"
Dangerfile"
-
"
Dangerfile"
-
"
danger/**/*"
-
"
danger/**/*"
...
@@ -163,7 +163,7 @@
...
@@ -163,7 +163,7 @@
-
"
config.ru"
-
"
config.ru"
-
"
{package.json,yarn.lock}"
-
"
{package.json,yarn.lock}"
-
"
{,ee/}{app,bin,config,db,haml_lint,lib,locale,public,scripts,symbol,vendor}/**/*"
-
"
{,ee/}{app,bin,config,db,haml_lint,lib,locale,public,scripts,symbol,vendor}/**/*"
-
"
doc/api/graphql/
**/*"
-
"
doc/api/graphql/
reference/*"
# Files in this folder are auto-generated
# QA changes
# QA changes
-
"
.dockerignore"
-
"
.dockerignore"
-
"
qa/**/*"
-
"
qa/**/*"
...
@@ -183,7 +183,7 @@
...
@@ -183,7 +183,7 @@
-
"
config.ru"
-
"
config.ru"
-
"
{package.json,yarn.lock}"
-
"
{package.json,yarn.lock}"
-
"
{,ee/}{app,bin,config,db,haml_lint,lib,locale,public,scripts,symbol,vendor}/**/*"
-
"
{,ee/}{app,bin,config,db,haml_lint,lib,locale,public,scripts,symbol,vendor}/**/*"
-
"
doc/api/graphql/
**/*"
-
"
doc/api/graphql/
reference/*"
# Files in this folder are auto-generated
# Backstage changes
# Backstage changes
-
"
Dangerfile"
-
"
Dangerfile"
-
"
danger/**/*"
-
"
danger/**/*"
...
...
.gitlab/ci/notifications.gitlab-ci.yml
0 → 100644
View file @
ed9c54b5
.notify
:
image
:
alpine
stage
:
notification
dependencies
:
[]
cache
:
{}
before_script
:
-
apk update && apk add git curl bash
variables
:
COMMIT_NOTES_URL
:
"
https://$CI_SERVER_HOST/$CI_PROJECT_PATH/commit/$CI_COMMIT_SHA#notes-list"
schedule:package-and-qa:notify-failure:
extends
:
-
.only:variables_refs-canonical-dot-com-schedules
-
.notify
script
:
-
'
scripts/notify-slack
qa-master
":skull_and_crossbones:
Scheduled
QA
against
master
failed!
:skull_and_crossbones:
See
$CI_PIPELINE_URL.
For
downstream
pipelines,
see
$COMMIT_NOTES_URL"
ci_failing'
needs
:
[
"
schedule:package-and-qa"
]
when
:
on_failure
app/assets/javascripts/frequent_items/store/mutations.js
View file @
ed9c54b5
...
@@ -48,7 +48,7 @@ export default {
...
@@ -48,7 +48,7 @@ export default {
});
});
},
},
[
types
.
RECEIVE_SEARCHED_ITEMS_SUCCESS
](
state
,
results
)
{
[
types
.
RECEIVE_SEARCHED_ITEMS_SUCCESS
](
state
,
results
)
{
const
rawItems
=
results
.
data
;
const
rawItems
=
results
.
data
?
results
.
data
:
results
;
// Api.groups returns array, Api.projects returns object
Object
.
assign
(
state
,
{
Object
.
assign
(
state
,
{
items
:
rawItems
.
map
(
rawItem
=>
({
items
:
rawItems
.
map
(
rawItem
=>
({
id
:
rawItem
.
id
,
id
:
rawItem
.
id
,
...
...
app/assets/javascripts/lib/utils/datetime_utility.js
View file @
ed9c54b5
...
@@ -602,3 +602,19 @@ export const getDatesInRange = (d1, d2, formatter = x => x) => {
...
@@ -602,3 +602,19 @@ export const getDatesInRange = (d1, d2, formatter = x => x) => {
* @return {Number} number of milliseconds
* @return {Number} number of milliseconds
*/
*/
export
const
secondsToMilliseconds
=
seconds
=>
seconds
*
1000
;
export
const
secondsToMilliseconds
=
seconds
=>
seconds
*
1000
;
/**
* Converts the supplied number of seconds to days.
*
* @param {Number} seconds
* @return {Number} number of days
*/
export
const
secondsToDays
=
seconds
=>
Math
.
round
(
seconds
/
86400
);
/**
* Returns the date after the date provided
*
* @param {Date} date the initial date
* @return {Date} the date following the date provided
*/
export
const
dayAfter
=
date
=>
new
Date
(
newDate
(
date
).
setDate
(
date
.
getDate
()
+
1
));
app/assets/javascripts/monitoring/stores/state.js
View file @
ed9c54b5
import
invalidUrl
from
'
~/lib/utils/invalid_url
'
;
import
invalidUrl
from
'
~/lib/utils/invalid_url
'
;
export
default
()
=>
({
export
default
()
=>
({
hasMetrics
:
false
,
showPanels
:
true
,
metricsEndpoint
:
null
,
metricsEndpoint
:
null
,
environmentsEndpoint
:
null
,
environmentsEndpoint
:
null
,
deploymentsEndpoint
:
null
,
deploymentsEndpoint
:
null
,
...
...
app/models/clusters/applications/runner.rb
View file @
ed9c54b5
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
module
Clusters
module
Clusters
module
Applications
module
Applications
class
Runner
<
ApplicationRecord
class
Runner
<
ApplicationRecord
VERSION
=
'0.1
0.1
'
VERSION
=
'0.1
1.0
'
self
.
table_name
=
'clusters_applications_runners'
self
.
table_name
=
'clusters_applications_runners'
...
...
changelogs/unreleased/27630-specify-kubernetes-namespace-in-ci-template.yml
0 → 100644
View file @
ed9c54b5
---
title
:
Allow specifying Kubernetes namespace for an environment in gitlab-ci.yml
merge_request
:
20270
author
:
type
:
added
changelogs/unreleased/fix-groups-search-dropdown.yml
0 → 100644
View file @
ed9c54b5
---
title
:
Fix group search in groups dropdown
merge_request
:
20535
author
:
type
:
fixed
changelogs/unreleased/update-gitlab-runner-helm-chart-to-0-11-0.yml
0 → 100644
View file @
ed9c54b5
---
title
:
Update GitLab Runner Helm Chart to 0.11.0
merge_request
:
20461
author
:
type
:
other
doc/ci/yaml/README.md
View file @
ed9c54b5
...
@@ -135,6 +135,7 @@ The following job parameters can be defined inside a `default:` block:
...
@@ -135,6 +135,7 @@ The following job parameters can be defined inside a `default:` block:
-
[
`before_script`
](
#before_script-and-after_script
)
-
[
`before_script`
](
#before_script-and-after_script
)
-
[
`after_script`
](
#before_script-and-after_script
)
-
[
`after_script`
](
#before_script-and-after_script
)
-
[
`cache`
](
#cache
)
-
[
`cache`
](
#cache
)
-
[
`retry`
](
#retry
)
-
[
`timeout`
](
#timeout
)
-
[
`timeout`
](
#timeout
)
-
[
`interruptible`
](
#interruptible
)
-
[
`interruptible`
](
#interruptible
)
...
...
doc/development/pipelines.md
View file @
ed9c54b5
...
@@ -29,6 +29,7 @@ The current stages are:
...
@@ -29,6 +29,7 @@ The current stages are:
-
`review`
: This stage includes jobs that deploy the GitLab and Docs Review Apps.
-
`review`
: This stage includes jobs that deploy the GitLab and Docs Review Apps.
-
`qa`
: This stage includes jobs that perform QA tasks against the Review App
-
`qa`
: This stage includes jobs that perform QA tasks against the Review App
that is deployed in the previous stage.
that is deployed in the previous stage.
-
`notification`
: This stage includes jobs that sends notifications about pipeline status.
-
`post-test`
: This stage includes jobs that build reports or gather data from
-
`post-test`
: This stage includes jobs that build reports or gather data from
the previous stages' jobs (e.g. coverage, Knapsack metadata etc.).
the previous stages' jobs (e.g. coverage, Knapsack metadata etc.).
-
`pages`
: This stage includes a job that deploys the various reports as
-
`pages`
: This stage includes a job that deploys the various reports as
...
@@ -209,6 +210,11 @@ subgraph "`qa` stage"
...
@@ -209,6 +210,11 @@ subgraph "`qa` stage"
dast -.-> |needs and depends on| G;
dast -.-> |needs and depends on| G;
end
end
subgraph "`notification` stage"
NOTIFICATION1["schedule:package-and-qa:notify-success<br>(on_success)"] -.-> |needs| P;
NOTIFICATION2["schedule:package-and-qa:notify-failure<br>(on_failure)"] -.-> |needs| P;
end
subgraph "`post-test` stage"
subgraph "`post-test` stage"
M
M
end
end
...
...
lib/gitlab/ci/config/entry/default.rb
View file @
ed9c54b5
...
@@ -15,7 +15,7 @@ module Gitlab
...
@@ -15,7 +15,7 @@ module Gitlab
ALLOWED_KEYS
=
%i[before_script image services
ALLOWED_KEYS
=
%i[before_script image services
after_script cache interruptible
after_script cache interruptible
timeout]
.
freeze
timeout
retry
]
.
freeze
validations
do
validations
do
validates
:config
,
allowed_keys:
ALLOWED_KEYS
validates
:config
,
allowed_keys:
ALLOWED_KEYS
...
@@ -49,7 +49,11 @@ module Gitlab
...
@@ -49,7 +49,11 @@ module Gitlab
description:
'Set jobs default timeout.'
,
description:
'Set jobs default timeout.'
,
inherit:
false
inherit:
false
helpers
:before_script
,
:image
,
:services
,
:after_script
,
:cache
,
:interruptible
,
:timeout
entry
:retry
,
Entry
::
Retry
,
description:
'Set retry default value.'
,
inherit:
false
helpers
:before_script
,
:image
,
:services
,
:after_script
,
:cache
,
:interruptible
,
:timeout
,
:retry
private
private
...
...
lib/gitlab/ci/config/entry/environment.rb
View file @
ed9c54b5
...
@@ -8,9 +8,11 @@ module Gitlab
...
@@ -8,9 +8,11 @@ module Gitlab
# Entry that represents an environment.
# Entry that represents an environment.
#
#
class
Environment
<
::
Gitlab
::
Config
::
Entry
::
Node
class
Environment
<
::
Gitlab
::
Config
::
Entry
::
Node
include
::
Gitlab
::
Config
::
Entry
::
Validat
able
include
::
Gitlab
::
Config
::
Entry
::
Configur
able
ALLOWED_KEYS
=
%i[name url action on_stop]
.
freeze
ALLOWED_KEYS
=
%i[name url action on_stop kubernetes]
.
freeze
entry
:kubernetes
,
Entry
::
Kubernetes
,
description:
'Kubernetes deployment configuration.'
validations
do
validations
do
validate
do
validate
do
...
@@ -46,6 +48,7 @@ module Gitlab
...
@@ -46,6 +48,7 @@ module Gitlab
allow_nil:
true
allow_nil:
true
validates
:on_stop
,
type:
String
,
allow_nil:
true
validates
:on_stop
,
type:
String
,
allow_nil:
true
validates
:kubernetes
,
type:
Hash
,
allow_nil:
true
end
end
end
end
...
@@ -73,6 +76,10 @@ module Gitlab
...
@@ -73,6 +76,10 @@ module Gitlab
value
[
:on_stop
]
value
[
:on_stop
]
end
end
def
kubernetes
value
[
:kubernetes
]
end
def
value
def
value
case
@config
case
@config
when
String
then
{
name:
@config
,
action:
'start'
}
when
String
then
{
name:
@config
,
action:
'start'
}
...
@@ -80,6 +87,10 @@ module Gitlab
...
@@ -80,6 +87,10 @@ module Gitlab
else
{}
else
{}
end
end
end
end
def
skip_config_hash_validation?
true
end
end
end
end
end
end
end
...
...
lib/gitlab/ci/config/entry/job.rb
View file @
ed9c54b5
...
@@ -105,6 +105,10 @@ module Gitlab
...
@@ -105,6 +105,10 @@ module Gitlab
description:
'Timeout duration of this job.'
,
description:
'Timeout duration of this job.'
,
inherit:
true
inherit:
true
entry
:retry
,
Entry
::
Retry
,
description:
'Retry configuration for this job.'
,
inherit:
true
entry
:only
,
Entry
::
Policy
,
entry
:only
,
Entry
::
Policy
,
description:
'Refs policy this job will be executed for.'
,
description:
'Refs policy this job will be executed for.'
,
default:
Entry
::
Policy
::
DEFAULT_ONLY
,
default:
Entry
::
Policy
::
DEFAULT_ONLY
,
...
@@ -142,10 +146,6 @@ module Gitlab
...
@@ -142,10 +146,6 @@ module Gitlab
description:
'Coverage configuration for this job.'
,
description:
'Coverage configuration for this job.'
,
inherit:
false
inherit:
false
entry
:retry
,
Entry
::
Retry
,
description:
'Retry configuration for this job.'
,
inherit:
false
helpers
:before_script
,
:script
,
:stage
,
:type
,
:after_script
,
helpers
:before_script
,
:script
,
:stage
,
:type
,
:after_script
,
:cache
,
:image
,
:services
,
:only
,
:except
,
:variables
,
:cache
,
:image
,
:services
,
:only
,
:except
,
:variables
,
:artifacts
,
:environment
,
:coverage
,
:retry
,
:rules
,
:artifacts
,
:environment
,
:coverage
,
:retry
,
:rules
,
...
...
lib/gitlab/ci/config/entry/kubernetes.rb
0 → 100644
View file @
ed9c54b5
# frozen_string_literal: true
module
Gitlab
module
Ci
class
Config
module
Entry
class
Kubernetes
<
::
Gitlab
::
Config
::
Entry
::
Node
include
::
Gitlab
::
Config
::
Entry
::
Validatable
include
::
Gitlab
::
Config
::
Entry
::
Attributable
ALLOWED_KEYS
=
%i[namespace]
.
freeze
attributes
ALLOWED_KEYS
validations
do
validates
:config
,
type:
Hash
validates
:config
,
allowed_keys:
ALLOWED_KEYS
validates
:namespace
,
type:
String
,
presence:
true
end
end
end
end
end
end
scripts/notify-slack
0 → 100755
View file @
ed9c54b5
#!/bin/bash
# Sends Slack notification MSG to CI_SLACK_WEBHOOK_URL (which needs to be set).
# ICON_EMOJI needs to be set to an icon emoji name (without the `:` around it).
CHANNEL
=
$1
MSG
=
$2
ICON_EMOJI
=
$3
if
[
-z
"
$CHANNEL
"
]
||
[
-z
"
$CI_SLACK_WEBHOOK_URL
"
]
||
[
-z
"
$MSG
"
]
||
[
-z
"
$ICON_EMOJI
"
]
;
then
echo
"Missing argument(s) - Use:
$0
channel message icon_emoji"
echo
"and set CI_SLACK_WEBHOOK_URL environment variable."
else
curl
-X
POST
--data-urlencode
'payload={"channel": "#'
"
$CHANNEL
"
'", "username": "GitLab QA Bot", "text": "'
"
$MSG
"
'", "icon_emoji": "'
":
$ICON_EMOJI
:"
'"}'
"
$CI_SLACK_WEBHOOK_URL
"
fi
spec/frontend/lib/utils/datetime_utility_spec.js
View file @
ed9c54b5
...
@@ -482,3 +482,27 @@ describe('secondsToMilliseconds', () => {
...
@@ -482,3 +482,27 @@ describe('secondsToMilliseconds', () => {
expect
(
datetimeUtility
.
secondsToMilliseconds
(
123
)).
toBe
(
123000
);
expect
(
datetimeUtility
.
secondsToMilliseconds
(
123
)).
toBe
(
123000
);
});
});
});
});
describe
(
'
dayAfter
'
,
()
=>
{
const
date
=
new
Date
(
'
2019-07-16T00:00:00.000Z
'
);
it
(
'
returns the following date
'
,
()
=>
{
const
nextDay
=
datetimeUtility
.
dayAfter
(
date
);
const
expectedNextDate
=
new
Date
(
'
2019-07-17T00:00:00.000Z
'
);
expect
(
nextDay
).
toStrictEqual
(
expectedNextDate
);
});
it
(
'
does not modifiy the original date
'
,
()
=>
{
datetimeUtility
.
dayAfter
(
date
);
expect
(
date
).
toStrictEqual
(
new
Date
(
'
2019-07-16T00:00:00.000Z
'
));
});
});
describe
(
'
secondsToDays
'
,
()
=>
{
it
(
'
converts seconds to days correctly
'
,
()
=>
{
expect
(
datetimeUtility
.
secondsToDays
(
0
)).
toBe
(
0
);
expect
(
datetimeUtility
.
secondsToDays
(
90000
)).
toBe
(
1
);
expect
(
datetimeUtility
.
secondsToDays
(
270000
)).
toBe
(
3
);
});
});
spec/javascripts/frequent_items/mock_data.js
View file @
ed9c54b5
...
@@ -68,7 +68,7 @@ export const mockFrequentGroups = [
...
@@ -68,7 +68,7 @@ export const mockFrequentGroups = [
},
},
];
];
export
const
mockSearchedGroups
=
{
data
:
[
mockRawGroup
]
}
;
export
const
mockSearchedGroups
=
[
mockRawGroup
]
;
export
const
mockProcessedSearchedGroups
=
[
mockGroup
];
export
const
mockProcessedSearchedGroups
=
[
mockGroup
];
export
const
mockProject
=
{
export
const
mockProject
=
{
...
...
spec/lib/gitlab/ci/config/entry/default_spec.rb
View file @
ed9c54b5
...
@@ -27,7 +27,7 @@ describe Gitlab::Ci::Config::Entry::Default do
...
@@ -27,7 +27,7 @@ describe Gitlab::Ci::Config::Entry::Default do
expect
(
described_class
.
nodes
.
keys
)
expect
(
described_class
.
nodes
.
keys
)
.
to
match_array
(
%i[before_script image services
.
to
match_array
(
%i[before_script image services
after_script cache interruptible
after_script cache interruptible
timeout]
)
timeout
retry
]
)
end
end
end
end
end
end
...
...
spec/lib/gitlab/ci/config/entry/environment_spec.rb
View file @
ed9c54b5
...
@@ -241,4 +241,28 @@ describe Gitlab::Ci::Config::Entry::Environment do
...
@@ -241,4 +241,28 @@ describe Gitlab::Ci::Config::Entry::Environment do
end
end
end
end
end
end
describe
'kubernetes'
do
let
(
:config
)
do
{
name:
'production'
,
kubernetes:
kubernetes_config
}
end
context
'is a string'
do
let
(
:kubernetes_config
)
{
'production'
}
it
{
expect
(
entry
).
not_to
be_valid
}
end
context
'is a hash'
do
let
(
:kubernetes_config
)
{
Hash
(
namespace:
'production'
)
}
it
{
expect
(
entry
).
to
be_valid
}
end
context
'is nil'
do
let
(
:kubernetes_config
)
{
nil
}
it
{
expect
(
entry
).
to
be_valid
}
end
end
end
end
spec/lib/gitlab/ci/config/entry/kubernetes_spec.rb
0 → 100644
View file @
ed9c54b5
# frozen_string_literal: true
require
'spec_helper'
describe
Gitlab
::
Ci
::
Config
::
Entry
::
Kubernetes
do
subject
{
described_class
.
new
(
config
)
}
describe
'attributes'
do
it
{
is_expected
.
to
respond_to
(
:namespace
)
}
it
{
is_expected
.
to
respond_to
(
:has_namespace?
)
}
end
describe
'validations'
do
describe
'config'
do
context
'is a hash containing known keys'
do
let
(
:config
)
{
Hash
(
namespace:
'namespace'
)
}
it
{
is_expected
.
to
be_valid
}
end
context
'is a hash containing an unknown key'
do
let
(
:config
)
{
Hash
(
unknown:
'attribute'
)
}
it
{
is_expected
.
not_to
be_valid
}
end
context
'is a string'
do
let
(
:config
)
{
'config'
}
it
{
is_expected
.
not_to
be_valid
}
end
end
describe
'namespace'
do
let
(
:config
)
{
Hash
(
namespace:
namespace
)
}
context
'is a string'
do
let
(
:namespace
)
{
'namespace'
}
it
{
is_expected
.
to
be_valid
}
end
context
'is a hash'
do
let
(
:namespace
)
{
Hash
(
key:
'namespace'
)
}
it
{
is_expected
.
not_to
be_valid
}
end
context
'is not present'
do
let
(
:namespace
)
{
''
}
it
{
is_expected
.
not_to
be_valid
}
end
end
end
end
spec/lib/gitlab/ci/yaml_processor_spec.rb
View file @
ed9c54b5
...
@@ -149,6 +149,28 @@ module Gitlab
...
@@ -149,6 +149,28 @@ module Gitlab
expect
(
subject
[
:options
]).
not_to
have_key
(
:retry
)
expect
(
subject
[
:options
]).
not_to
have_key
(
:retry
)
end
end
end
end
context
'when retry count is specified by default'
do
let
(
:config
)
do
YAML
.
dump
(
default:
{
retry:
{
max:
1
}
},
rspec:
{
script:
'rspec'
})
end
it
'does use the default value'
do
expect
(
subject
[
:options
]).
to
include
(
retry:
{
max:
1
})
end
end
context
'when retry count default value is overridden'
do
let
(
:config
)
do
YAML
.
dump
(
default:
{
retry:
{
max:
1
}
},
rspec:
{
script:
'rspec'
,
retry:
{
max:
2
}
})
end
it
'does use the job value'
do
expect
(
subject
[
:options
]).
to
include
(
retry:
{
max:
2
})
end
end
end
end
describe
'allow failure entry'
do
describe
'allow failure entry'
do
...
...
spec/services/ci/create_pipeline_service_spec.rb
View file @
ed9c54b5
...
@@ -801,6 +801,32 @@ describe Ci::CreatePipelineService do
...
@@ -801,6 +801,32 @@ describe Ci::CreatePipelineService do
end
end
end
end
context
'environment with Kubernetes configuration'
do
let
(
:kubernetes_namespace
)
{
'custom-namespace'
}
before
do
config
=
YAML
.
dump
(
deploy:
{
environment:
{
name:
"environment-name"
,
kubernetes:
{
namespace:
kubernetes_namespace
}
},
script:
'ls'
}
)
stub_ci_pipeline_yaml_file
(
config
)
end
it
'stores the requested namespace'
do
result
=
execute_service
build
=
result
.
builds
.
first
expect
(
result
).
to
be_persisted
expect
(
build
.
options
.
dig
(
:environment
,
:kubernetes
,
:namespace
)).
to
eq
(
kubernetes_namespace
)
end
end
context
'when environment with invalid name'
do
context
'when environment with invalid name'
do
before
do
before
do
config
=
YAML
.
dump
(
deploy:
{
environment:
{
name:
'name,with,commas'
},
script:
'ls'
})
config
=
YAML
.
dump
(
deploy:
{
environment:
{
name:
'name,with,commas'
},
script:
'ls'
})
...
...
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