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
7a85e798
Commit
7a85e798
authored
Jun 07, 2021
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ci: Change the way we skip env loading in some rake tasks
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
04d3dac0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
8 deletions
+14
-8
ee/lib/tasks/gitlab/indexer.rake
ee/lib/tasks/gitlab/indexer.rake
+1
-1
lib/tasks/gitlab/gitaly.rake
lib/tasks/gitlab/gitaly.rake
+1
-1
lib/tasks/gitlab/helpers.rake
lib/tasks/gitlab/helpers.rake
+2
-4
scripts/setup-test-env
scripts/setup-test-env
+2
-0
spec/support/helpers/test_env.rb
spec/support/helpers/test_env.rb
+8
-2
No files found.
ee/lib/tasks/gitlab/indexer.rake
View file @
7a85e798
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
namespace
:gitlab
do
namespace
:gitlab
do
namespace
:indexer
do
namespace
:indexer
do
desc
"GitLab | Indexer | Install or upgrade gitlab-elasticsearch-indexer"
desc
"GitLab | Indexer | Install or upgrade gitlab-elasticsearch-indexer"
task
:install
,
[
:dir
,
:repo
]
=>
:
with_gitlab_helpers
do
|
t
,
args
|
task
:install
,
[
:dir
,
:repo
]
=>
:
gitlab_environment
do
|
t
,
args
|
unless
args
.
dir
.
present?
unless
args
.
dir
.
present?
abort
%(Please specify the directory where you want to install the indexer
abort
%(Please specify the directory where you want to install the indexer
Usage: rake "gitlab:indexer:install[/installation/dir,repo]")
Usage: rake "gitlab:indexer:install[/installation/dir,repo]")
...
...
lib/tasks/gitlab/gitaly.rake
View file @
7a85e798
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
namespace
:gitlab
do
namespace
:gitlab
do
namespace
:gitaly
do
namespace
:gitaly
do
desc
'GitLab | Gitaly | Install or upgrade gitaly'
desc
'GitLab | Gitaly | Install or upgrade gitaly'
task
:install
,
[
:dir
,
:storage_path
,
:repo
]
=>
:
with_gitlab_helpers
do
|
t
,
args
|
task
:install
,
[
:dir
,
:storage_path
,
:repo
]
=>
:
gitlab_environment
do
|
t
,
args
|
warn_user_is_not_gitlab
warn_user_is_not_gitlab
unless
args
.
dir
.
present?
&&
args
.
storage_path
.
present?
unless
args
.
dir
.
present?
&&
args
.
storage_path
.
present?
...
...
lib/tasks/gitlab/helpers.rake
View file @
7a85e798
...
@@ -3,10 +3,8 @@
...
@@ -3,10 +3,8 @@
# Prevent StateMachine warnings from outputting during a cron task
# Prevent StateMachine warnings from outputting during a cron task
StateMachines
::
Machine
.
ignore_method_conflicts
=
true
if
ENV
[
'CRON'
]
StateMachines
::
Machine
.
ignore_method_conflicts
=
true
if
ENV
[
'CRON'
]
task
gitlab_environment: :environment
do
task
:gitlab_environment
do
extend
SystemCheck
::
Helpers
Rake
::
Task
[
:environment
].
invoke
unless
ENV
[
'SKIP_RAILS_ENV_IN_RAKE'
]
end
task
:with_gitlab_helpers
do
extend
SystemCheck
::
Helpers
extend
SystemCheck
::
Helpers
end
end
scripts/setup-test-env
View file @
7a85e798
...
@@ -11,6 +11,8 @@ require 'active_support/dependencies/autoload'
...
@@ -11,6 +11,8 @@ require 'active_support/dependencies/autoload'
require
'active_support/core_ext/numeric'
require
'active_support/core_ext/numeric'
require
'active_support/string_inquirer'
require
'active_support/string_inquirer'
ENV
[
'SKIP_RAILS_ENV_IN_RAKE'
]
=
'true'
module
Rails
module
Rails
extend
self
extend
self
...
...
spec/support/helpers/test_env.rb
View file @
7a85e798
...
@@ -521,8 +521,14 @@ module TestEnv
...
@@ -521,8 +521,14 @@ module TestEnv
# Cleanup the component entirely to ensure we start fresh
# Cleanup the component entirely to ensure we start fresh
FileUtils
.
rm_rf
(
install_dir
)
FileUtils
.
rm_rf
(
install_dir
)
unless
Rake
::
Task
[
task
].
invoke
(
*
task_args
)
if
ENV
[
'SKIP_RAILS_ENV_IN_RAKE'
]
raise
ComponentFailedToInstallError
# When we run `scripts/setup-test-env`, we take care of loading the necessary dependencies
# so we can run the rake task programmatically.
Rake
::
Task
[
task
].
invoke
(
*
task_args
)
else
# In other cases, we run the task via `rake` so that the environment
# and dependencies are automatically loaded.
raise
ComponentFailedToInstallError
unless
system
(
'rake'
,
"
#{
task
}
[
#{
task_args
.
join
(
','
)
}
]"
)
end
end
yield
if
block_given?
yield
if
block_given?
...
...
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