Skip to content
代码片段 群组 项目
未验证 提交 4cf57e59 编辑于 作者: Manoj M J's avatar Manoj M J 提交者: GitLab
浏览文件

Housekeeper: Validate configuration on start

上级 d28ab815
No related branches found
No related tags found
无相关合并请求
...@@ -3,6 +3,18 @@ ...@@ -3,6 +3,18 @@
require "optparse" require "optparse"
require 'gitlab/housekeeper' require 'gitlab/housekeeper'
REQUIRED_CONFIG_KEYS = [
'HOUSEKEEPER_GITLAB_API_TOKEN',
'HOUSEKEEPER_TARGET_PROJECT_ID'
].freeze
def validate_configuration!
REQUIRED_CONFIG_KEYS.each do |required_key|
# fetch will fail with an error if the key isn't found.
ENV.fetch(required_key)
end
end
options = {} options = {}
OptionParser.new do |opts| OptionParser.new do |opts|
...@@ -33,4 +45,7 @@ OptionParser.new do |opts| ...@@ -33,4 +45,7 @@ OptionParser.new do |opts|
end end
end.parse! end.parse!
# We do not want to validate configuration on dry runs
validate_configuration! unless options[:dry_run]
Gitlab::Housekeeper::Runner.new(**options).run Gitlab::Housekeeper::Runner.new(**options).run
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册