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
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
907c0e67
Commit
907c0e67
authored
Jun 10, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added initial version of deployments
parent
cf7da039
Changes
22
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
311 additions
and
111 deletions
+311
-111
app/controllers/projects/builds_controller.rb
app/controllers/projects/builds_controller.rb
+1
-1
app/controllers/projects/commit_controller.rb
app/controllers/projects/commit_controller.rb
+1
-1
app/controllers/projects/environments_controller.rb
app/controllers/projects/environments_controller.rb
+8
-6
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+4
-0
app/models/ability.rb
app/models/ability.rb
+11
-1
app/models/ci/build.rb
app/models/ci/build.rb
+8
-5
app/models/deployment.rb
app/models/deployment.rb
+25
-0
app/models/environment.rb
app/models/environment.rb
+11
-0
app/models/project.rb
app/models/project.rb
+2
-0
app/services/ci/create_builds_service.rb
app/services/ci/create_builds_service.rb
+2
-1
app/services/create_deployment_service.rb
app/services/create_deployment_service.rb
+45
-0
app/views/projects/deployments/_deployment.html.haml
app/views/projects/deployments/_deployment.html.haml
+32
-0
app/views/projects/environments/_environment.html.haml
app/views/projects/environments/_environment.html.haml
+21
-47
app/views/projects/environments/index.html.haml
app/views/projects/environments/index.html.haml
+19
-19
app/views/projects/environments/show.html.haml
app/views/projects/environments/show.html.haml
+21
-25
app/views/projects/pipelines/_head.html.haml
app/views/projects/pipelines/_head.html.haml
+6
-0
db/migrate/20160610204157_add_deployments.rb
db/migrate/20160610204157_add_deployments.rb
+27
-0
db/migrate/20160610204158_add_environments.rb
db/migrate/20160610204158_add_environments.rb
+17
-0
db/migrate/20160610211845_add_environment_to_builds.rb
db/migrate/20160610211845_add_environment_to_builds.rb
+10
-0
db/schema.rb
db/schema.rb
+32
-3
lib/api/builds.rb
lib/api/builds.rb
+1
-1
lib/ci/gitlab_ci_yaml_processor.rb
lib/ci/gitlab_ci_yaml_processor.rb
+7
-1
No files found.
app/controllers/projects/builds_controller.rb
View file @
907c0e67
...
...
@@ -51,7 +51,7 @@ class Projects::BuildsController < Projects::ApplicationController
return
render_404
end
build
=
Ci
::
Build
.
retry
(
@build
)
build
=
Ci
::
Build
.
retry
(
@build
,
current_user
)
redirect_to
build_path
(
build
)
end
...
...
app/controllers/projects/commit_controller.rb
View file @
907c0e67
...
...
@@ -46,7 +46,7 @@ class Projects::CommitController < Projects::ApplicationController
def
retry_builds
ci_builds
.
latest
.
failed
.
each
do
|
build
|
if
build
.
retryable?
Ci
::
Build
.
retry
(
build
)
Ci
::
Build
.
retry
(
build
,
current_user
)
end
end
...
...
app/controllers/projects/environments_controller.rb
View file @
907c0e67
class
Projects::EnvironmentsController
<
Projects
::
ApplicationController
layout
'project'
before_action
:authorize_read_environment!
before_action
:environment
,
only:
[
:show
]
def
index
@environments
=
project
.
builds
.
where
.
not
(
environment:
nil
).
pluck
(
:environment
).
uniq
@environments
=
@environments
.
map
{
|
env
|
build_for_env
(
env
)
}.
compact
@environments
=
project
.
environments
end
def
show
@environment
=
params
[
:id
].
to_s
@builds
=
project
.
builds
.
where
.
not
(
status:
[
"manual"
]).
where
(
environment:
params
[
:id
].
to_s
).
order
(
id: :desc
).
page
(
params
[
:page
]).
per
(
30
)
end
def
build_for_env
(
environment
)
project
.
builds
.
success
.
order
(
id: :desc
).
find_by
(
environment:
environment
)
private
def
environment
@environment
||=
project
.
environments
.
find
(
params
[
:id
].
to_s
)
@environment
||
render_404
end
end
app/helpers/projects_helper.rb
View file @
907c0e67
...
...
@@ -156,6 +156,10 @@ module ProjectsHelper
nav_tabs
<<
:container_registry
end
if
can?
(
current_user
,
:read_environment
,
project
)
nav_tabs
<<
:environments
end
if
can?
(
current_user
,
:admin_project
,
project
)
nav_tabs
<<
:settings
end
...
...
app/models/ability.rb
View file @
907c0e67
...
...
@@ -228,6 +228,8 @@ class Ability
:read_build
,
:read_container_image
,
:read_pipeline
,
:read_environment
,
:read_deployment
]
end
...
...
@@ -246,6 +248,10 @@ class Ability
:push_code
,
:create_container_image
,
:update_container_image
,
:create_environment
,
:update_environment
,
:create_deployment
,
:update_deployment
,
]
end
...
...
@@ -273,7 +279,9 @@ class Ability
:admin_commit_status
,
:admin_build
,
:admin_container_image
,
:admin_pipeline
:admin_pipeline
,
:admin_environment
,
:admin_deployment
]
end
...
...
@@ -317,6 +325,8 @@ class Ability
unless
project
.
builds_enabled
rules
+=
named_abilities
(
'build'
)
rules
+=
named_abilities
(
'pipeline'
)
rules
+=
named_abilities
(
'environment'
)
rules
+=
named_abilities
(
'deployment'
)
end
unless
project
.
container_registry_enabled
...
...
app/models/ci/build.rb
View file @
907c0e67
...
...
@@ -38,7 +38,7 @@ module Ci
new_build
.
save
end
def
retry
(
build
)
def
retry
(
build
,
user
=
nil
)
new_build
=
Ci
::
Build
.
new
(
status:
'pending'
)
new_build
.
ref
=
build
.
ref
new_build
.
tag
=
build
.
tag
...
...
@@ -52,6 +52,7 @@ module Ci
new_build
.
stage
=
build
.
stage
new_build
.
stage_idx
=
build
.
stage_idx
new_build
.
trigger_request
=
build
.
trigger_request
new_build
.
user
=
user
new_build
.
save
MergeRequests
::
AddTodoWhenBuildFailsService
.
new
(
build
.
project
,
nil
).
close
(
new_build
)
new_build
...
...
@@ -73,6 +74,12 @@ module Ci
build
.
update_coverage
build
.
execute_hooks
end
after_transition
any: :success
do
|
build
|
if
build
.
environment
.
present?
CreateDeploymentService
.
new
(
build
.
project
,
build
.
user
,
environment:
build
.
environment
).
execute
(
build
)
end
end
end
def
retryable?
...
...
@@ -83,10 +90,6 @@ module Ci
!
self
.
pipeline
.
statuses
.
latest
.
include?
(
self
)
end
def
retry
Ci
::
Build
.
retry
(
self
)
end
def
depends_on_builds
# Get builds of the same type
latest_builds
=
self
.
pipeline
.
builds
.
latest
...
...
app/models/deployment.rb
0 → 100644
View file @
907c0e67
class
Deployment
<
ActiveRecord
::
Base
include
InternalId
belongs_to
:project
belongs_to
:environment
belongs_to
:user
belongs_to
:deployable
,
polymorphic:
true
validates_presence_of
:sha
validates_presence_of
:ref
delegate
:name
,
to: :environment
,
prefix:
true
def
commit
project
.
commit
(
sha
)
end
def
commit_title
commit
.
try
(
:title
)
end
def
short_sha
Commit
::
truncate_sha
(
sha
)
end
end
app/models/environment.rb
0 → 100644
View file @
907c0e67
class
Environment
<
ActiveRecord
::
Base
belongs_to
:project
has_many
:deployments
validates_presence_of
:name
def
last_deployment
deployments
.
last
end
end
app/models/project.rb
View file @
907c0e67
...
...
@@ -125,6 +125,8 @@ class Project < ActiveRecord::Base
has_many
:runners
,
through: :runner_projects
,
source: :runner
,
class_name:
'Ci::Runner'
has_many
:variables
,
dependent: :destroy
,
class_name:
'Ci::Variable'
,
foreign_key: :gl_project_id
has_many
:triggers
,
dependent: :destroy
,
class_name:
'Ci::Trigger'
,
foreign_key: :gl_project_id
has_many
:environments
,
dependent: :destroy
has_many
:deployments
,
dependent: :destroy
accepts_nested_attributes_for
:variables
,
allow_destroy:
true
...
...
app/services/ci/create_builds_service.rb
View file @
907c0e67
...
...
@@ -29,7 +29,8 @@ module Ci
:options
,
:allow_failure
,
:stage
,
:stage_idx
)
:stage_idx
,
:environment
)
build_attrs
.
merge!
(
ref:
@pipeline
.
ref
,
tag:
@pipeline
.
tag
,
...
...
app/services/create_deployment_service.rb
0 → 100644
View file @
907c0e67
require_relative
'base_service'
class
CreateDeploymentService
<
BaseService
def
execute
(
deployable
)
environment
=
find_or_create_environment
(
params
[
:environment
])
deployment
=
create_deployment
(
environment
,
deployable
)
if
deployment
.
persisted?
success
(
deployment
)
else
error
(
deployment
.
errors
)
end
end
private
def
find_or_create_environment
(
environment
)
find_environment
(
environment
)
||
create_environment
(
environment
)
end
def
create_environment
(
environment
)
project
.
environments
.
create
(
name:
environment
)
end
def
find_environment
(
environment
)
project
.
environments
.
find_by
(
name:
environment
)
end
def
create_deployment
(
environment
,
deployable
)
environment
.
deployments
.
create
(
project:
project
,
ref:
build
.
ref
,
tag:
build
.
tag
,
sha:
build
.
sha
,
user:
current_user
,
deployable:
deployable
,
)
end
def
success
(
deployment
)
out
=
super
()
out
[
:deployment
]
=
deployment
out
end
end
app/views/projects/deployments/_deployment.html.haml
0 → 100644
View file @
907c0e67
%tr
.deployment
%td
%strong
=
"#
#{
environment
.
id
}
"
%td
%div
.branch-commit
-
if
deployment
.
ref
=
link_to
last
.
ref
,
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
deployment
.
ref
),
class:
"monospace"
·
=
link_to
deployment
.
short_sha
,
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
deployment
.
sha
),
class:
"commit-id monospace"
%p
%span
-
if
commit_title
=
deployment
.
commit_title
=
link_to_gfm
commit_title
,
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
deployment
.
sha
),
class:
"commit-row-message"
-
else
Cant find HEAD commit for this branch
%td
-
if
deployment
.
deployable
=
link_to
[
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
deployment
.
deployable
],
class:
"monospace"
do
=
"
#{
deployment
.
deployable
.
name
}
(#
#{
deployment
.
deployable
.
id
}
)"
%td
%p
%i
.fa.fa-calendar
#{
time_ago_with_tooltip
(
deployment
.
created_at
)
}
%td
-
if
can?
(
current_user
,
:update_deployment
,
@project
)
&&
deployment
.
deployable
=
link_to
[
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
deployment
.
deployable
,
:retry
],
method: :post
,
title:
'Retry'
,
class:
'btn btn-build'
app/views/projects/environments/_environment.html.haml
View file @
907c0e67
%tr
.commit
-
commit
=
build
.
commit
-
status
=
build
.
status
-
last_deployment
=
environment
.
last_deployment
%tr
.environment
%td
%strong
=
link_to
build
.
environment
,
namespace_project_environment_path
(
@project
.
namespace
,
@project
,
build
.
environment
),
class:
"monospace"
%td
.commit-link
=
link_to
namespace_project_pipeline_path
(
@project
.
namespace
,
@project
,
commit
.
id
),
class:
"ci-status ci-
#{
commit
.
status
}
"
do
=
ci_icon_for_status
(
commit
.
status
)
%strong
##{commit.id}
%td
.commit-link
=
link_to
namespace_project_build_path
(
@project
.
namespace
,
@project
,
build
.
id
),
class:
"ci-status ci-
#{
build
.
status
}
"
do
=
ci_icon_for_status
(
build
.
status
)
%strong
##{build.id}
=
link_to
environment
.
name
,
namespace_project_environment_path
(
@project
.
namespace
,
@project
,
environment
),
class:
"monospace"
%td
-
if
last_deployment
%div
.branch-commit
-
if
commi
t
.
ref
=
link_to
commit
.
ref
,
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
commi
t
.
ref
),
class:
"monospace"
-
if
last_deploymen
t
.
ref
=
link_to
last
.
ref
,
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
last_deploymen
t
.
ref
),
class:
"monospace"
·
=
link_to
commit
.
short_sha
,
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
commi
t
.
sha
),
class:
"commit-id monospace"
=
link_to
last_deployment
.
short_sha
,
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
last_deploymen
t
.
sha
),
class:
"commit-id monospace"
%p
%span
-
if
commit_data
=
commit
.
commit_data
=
link_to_gfm
commit_data
.
title
,
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
commit_data
.
id
),
class:
"commit-row-message"
-
if
commit_title
=
last_deployment
.
commit_title
=
link_to_gfm
commit_title
,
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
last_deployment
.
sha
),
class:
"commit-row-message"
-
else
Cant find HEAD commit for this branch
-
else
%p
No deployments yet
%td
-
if
build
.
started_at
&&
build
.
finished_at
%p
%i
.fa.fa-clock-o
#{
duration_in_words
(
build
.
finished_at
,
build
.
started_at
)
}
-
if
build
.
finished_at
%p
%i
.fa.fa-calendar
#{
time_ago_with_tooltip
(
build
.
finish
ed_at
)
}
#{
time_ago_with_tooltip
(
last_deployment
.
creat
ed_at
)
}
%td
.controls.hidden-xs.pull-right
-
manual
=
commit
.
builds
.
latest
.
manual_actions
.
to_a
-
if
manual
.
any?
.dropdown.inline
%button
.dropdown-toggle.btn
{
type:
'button'
,
'data-toggle'
=>
'dropdown'
}
=
icon
(
'play'
)
%b
.caret
%ul
.dropdown-menu.dropdown-menu-align-right
-
manual
.
each
do
|
manual_build
|
%li
=
link_to
'#'
,
rel:
'nofollow'
do
%i
.fa.fa-play
%span
#{
manual_build
.
name
}
app/views/projects/environments/index.html.haml
View file @
907c0e67
-
@no_container
=
true
-
page_title
"Environments"
=
render
"
header_title
"
=
render
"
projects/pipelines/head
"
.gray-content-block
%div
{
class:
(
container_class
)
}
.gray-content-block
Environments for this project
%ul
.content-list
%ul
.content-list
-
if
@environments
.
blank?
%li
.nothing-here-block
No environments to show
...
...
@@ -13,10 +15,8 @@
%table
.table.builds
%tbody
%th
Environment
%th
Pipeline ID
%th
Build ID
%th
Changes
%th
Last deployment
%th
Date
%th
%th
-
@environments
.
each
do
|
build
|
=
render
"environment"
,
build:
build
-
@environments
.
each
do
|
environment
|
=
render
'environment'
,
environment:
environment
app/views/projects/environments/show.html.haml
View file @
907c0e67
-
@no_container
=
true
-
page_title
"Environments"
=
render
"projects/pipelines/head"
=
render
"header_title"
.gray-content-block
%div
{
class:
(
container_class
)
}
.gray-content-block
Latest deployments for
%strong
=
@environment
%strong
=
@environment
.
name
%ul
.content-list
-
if
@build
s
.
blank?
%ul
.content-list
-
if
@deployment
s
.
blank?
%li
.nothing-here-block
No builds to show
for specific environment
.nothing-here-block
No deployment
for specific environment
-
else
.table-holder
%table
.table.builds
%thead
%tr
%th
Status
%th
Build ID
%th
Commit
%th
Ref
%th
Name
%th
Duration
%th
Finished at
%th
Context
%th
Date
%th
=
render
@builds
,
commit_sha:
true
,
ref:
true
,
allow_retry:
true
=
render
@deployments
=
paginate
@build
s
,
theme:
'gitlab'
=
paginate
@deployment
s
,
theme:
'gitlab'
app/views/projects/pipelines/_head.html.haml
View file @
907c0e67
...
...
@@ -13,3 +13,9 @@
%span
Builds
%span
.badge.count.builds_counter
=
number_with_delimiter
(
@project
.
running_or_pending_build_count
)
-
if
project_nav_tab?
:environments
=
nav_link
(
controller:
%w(environments)
)
do
=
link_to
project_environments_path
(
@project
),
title:
'Environments'
,
class:
'shortcuts-environments'
do
%span
Environments
db/migrate/20160610204157_add_deployments.rb
0 → 100644
View file @
907c0e67
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class
AddDeployments
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
def
change
create_table
:deployments
,
force:
true
do
|
t
|
t
.
integer
:iid
t
.
integer
:project_id
t
.
integer
:environment_id
t
.
string
:ref
t
.
boolean
:tag
t
.
string
:sha
t
.
integer
:user_id
t
.
integer
:deployable_id
,
null:
false
t
.
string
:deployable_type
,
null:
false
t
.
datetime
:created_at
t
.
datetime
:updated_at
end
add_index
:deployments
,
:project_id
add_index
:deployments
,
[
:project_id
,
:iid
]
add_index
:deployments
,
[
:project_id
,
:environment_id
]
add_index
:deployments
,
[
:project_id
,
:environment_id
,
:iid
]
end
end
db/migrate/20160610204158_add_environments.rb
0 → 100644
View file @
907c0e67
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class
AddEnvironments
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
def
change
create_table
:environments
,
force:
true
do
|
t
|
t
.
integer
:project_id
t
.
string
:name
,
null:
false
t
.
datetime
:created_at
t
.
datetime
:updated_at
end
add_index
:environments
,
[
:project_id
,
:name
]
end
end
db/migrate/20160610211845_add_environment_to_builds.rb
0 → 100644
View file @
907c0e67
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class
AddEnvironmentToBuilds
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
def
change
add_column
:ci_builds
,
:environment
,
:string
end
end
db/schema.rb
View file @
907c0e67
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
201606
08155312
)
do
ActiveRecord
::
Schema
.
define
(
version:
201606
10211845
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -161,6 +161,7 @@ ActiveRecord::Schema.define(version: 20160608155312) do
t
.
text
"artifacts_metadata"
t
.
integer
"erased_by_id"
t
.
datetime
"erased_at"
t
.
string
"environment"
end
add_index
"ci_builds"
,
[
"commit_id"
,
"stage_idx"
,
"created_at"
],
name:
"index_ci_builds_on_commit_id_and_stage_idx_and_created_at"
,
using: :btree
...
...
@@ -381,6 +382,25 @@ ActiveRecord::Schema.define(version: 20160608155312) do
add_index
"deploy_keys_projects"
,
[
"project_id"
],
name:
"index_deploy_keys_projects_on_project_id"
,
using: :btree
create_table
"deployments"
,
force: :cascade
do
|
t
|
t
.
integer
"iid"
t
.
integer
"project_id"
t
.
integer
"environment_id"
t
.
string
"ref"
t
.
boolean
"tag"
t
.
string
"sha"
t
.
integer
"user_id"
t
.
integer
"deployable_id"
,
null:
false
t
.
string
"deployable_type"
,
null:
false
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
end
add_index
"deployments"
,
[
"project_id"
,
"environment_id"
,
"iid"
],
name:
"index_deployments_on_project_id_and_environment_id_and_iid"
,
using: :btree
add_index
"deployments"
,
[
"project_id"
,
"environment_id"
],
name:
"index_deployments_on_project_id_and_environment_id"
,
using: :btree
add_index
"deployments"
,
[
"project_id"
,
"iid"
],
name:
"index_deployments_on_project_id_and_iid"
,
using: :btree
add_index
"deployments"
,
[
"project_id"
],
name:
"index_deployments_on_project_id"
,
using: :btree
create_table
"emails"
,
force: :cascade
do
|
t
|
t
.
integer
"user_id"
,
null:
false
t
.
string
"email"
,
null:
false
...
...
@@ -391,6 +411,15 @@ ActiveRecord::Schema.define(version: 20160608155312) do
add_index
"emails"
,
[
"email"
],
name:
"index_emails_on_email"
,
unique:
true
,
using: :btree
add_index
"emails"
,
[
"user_id"
],
name:
"index_emails_on_user_id"
,
using: :btree
create_table
"environments"
,
force: :cascade
do
|
t
|
t
.
integer
"project_id"
t
.
string
"name"
,
null:
false
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
end
add_index
"environments"
,
[
"project_id"
,
"name"
],
name:
"index_environments_on_project_id_and_name"
,
using: :btree
create_table
"events"
,
force: :cascade
do
|
t
|
t
.
string
"target_type"
t
.
integer
"target_id"
...
...
lib/api/builds.rb
View file @
907c0e67
...
...
@@ -142,7 +142,7 @@ module API
return
not_found!
(
build
)
unless
build
return
forbidden!
(
'Build is not retryable'
)
unless
build
.
retryable?
build
=
Ci
::
Build
.
retry
(
build
)
build
=
Ci
::
Build
.
retry
(
build
,
current_user
)
present
build
,
with:
Entities
::
Build
,
user_can_download_artifacts:
can?
(
current_user
,
:read_build
,
user_project
)
...
...
lib/ci/gitlab_ci_yaml_processor.rb
View file @
907c0e67
...
...
@@ -7,7 +7,8 @@ module Ci
ALLOWED_YAML_KEYS
=
[
:before_script
,
:after_script
,
:image
,
:services
,
:types
,
:stages
,
:variables
,
:cache
]
ALLOWED_JOB_KEYS
=
[
:tags
,
:script
,
:only
,
:except
,
:type
,
:image
,
:services
,
:allow_failure
,
:type
,
:stage
,
:when
,
:artifacts
,
:cache
,
:dependencies
,
:before_script
,
:after_script
,
:variables
]
:dependencies
,
:before_script
,
:after_script
,
:variables
,
:environment
]
attr_reader
:before_script
,
:after_script
,
:image
,
:services
,
:path
,
:cache
...
...
@@ -85,6 +86,7 @@ module Ci
except:
job
[
:except
],
allow_failure:
job
[
:allow_failure
]
||
false
,
when:
job
[
:when
]
||
'on_success'
,
environment:
job
[
:environment
],
options:
{
image:
job
[
:image
]
||
@image
,
services:
job
[
:services
]
||
@services
,
...
...
@@ -203,6 +205,10 @@ module Ci
if
job
[
:when
]
&&
!
job
[
:when
].
in?
(
%w(on_success on_failure always)
)
raise
ValidationError
,
"
#{
name
}
job: when parameter should be on_success, on_failure or always"
end
if
job
[
:environment
]
&&
!
validate_string
(
job
[
:environment
])
raise
ValidationError
,
"
#{
name
}
job: environment should be a string"
end
end
def
validate_job_script!
(
name
,
job
)
...
...
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