[英]Accessing jenkins JAR upon startup
我正在Chef中創建食譜,以在Jenkins中創建自動化服務。 我在CentOS上安裝了最新的Jenkins LTS,但一直被拒絕訪問jarfile。 有誰有解決此問題的解決方案?
這是我的輸出:
* remote_file[/var/lib/jenkins/plugins/jenkins-cli.jar] action create[2016-07-31T16:35:43+00:00] ERROR: Connection refused connecting to http://localhost:8080/jnlpJars/jenkins-cli.jar, retry 1/5
[2016-07-31T16:35:48+00:00] ERROR: Connection refused connecting to http://localhost:8080/jnlpJars/jenkins-cli.jar, retry 2/5
[2016-07-31T16:35:53+00:00] ERROR: Connection refused connecting to http://localhost:8080/jnlpJars/jenkins-cli.jar, retry 3/5
[2016-07-31T16:35:58+00:00] ERROR: Connection refused connecting to http://localhost:8080/jnlpJars/jenkins-cli.jar, retry 4/5
[2016-07-31T16:36:03+00:00] ERROR: Connection refused connecting to http://localhost:8080/jnlpJars/jenkins-cli.jar, retry 5/5
[2016-07-31T16:36:08+00:00] WARN: remote_file[/var/lib/jenkins/plugins/jenkins-cli.jar] cannot be downloaded from http://localhost:8080/jnlpJars/jenkins-cli.jar: Connection refused - Connection refused connecting to http://localhost:8080/jnlpJars/jenkins-cli.jar, giving up
================================================================================
Error executing action `create` on resource 'remote_file[/var/lib/jenkins/plugins/jenkins-cli.jar]'
================================================================================
Errno::ECONNREFUSED
-------------------
Connection refused - Connection refused connecting to http://localhost:8080/jnlpJars/jenkins-cli.jar, giving up
Cookbook Trace:
---------------
/tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:41:in `run_action'
Resource Declaration:
---------------------
# In /tmp/kitchen/cache/cookbooks/fanatics_pipeline/recipes/jenkins_plugins.rb
44: remote_file "#{node['plugins_dir']}/jenkins-cli.jar" do
45: source node['cli_jar']
46: action :create
47: mode '0755'
48: notifies :restart, "service[#{node['repo']['name']}]", :delayed
49: end
50: end
Compiled Resource:
------------------
# Declared in /tmp/kitchen/cache/cookbooks/fanatics_pipeline/recipes/jenkins_plugins.rb:44:in `block in from_file'
remote_file("/var/lib/jenkins/plugins/jenkins-cli.jar") do
provider Chef::Provider::RemoteFile
action [:create]
retries 0
retry_delay 2
default_guard_interpreter :default
source ["http://localhost:8080/jnlpJars/jenkins-cli.jar"]
use_etag true
use_last_modified true
declared_type :remote_file
cookbook_name "fanatics_pipeline"
recipe_name "jenkins_plugins"
mode "0755"
atomic_update true
path "/var/lib/jenkins/plugins/jenkins-cli.jar"
end
Platform:
---------
x86_64-linux
Recipe: fanatics_pipeline::jenkins_install
* service[jenkins] action restart
- restart service service[jenkins]
* service[jenkins] action reload
- reload service service[jenkins]
Running handlers:
[2016-07-31T16:36:15+00:00] ERROR: Running exception handlers
Running handlers complete
[2016-07-31T16:36:15+00:00] ERROR: Exception handlers complete
Chef Client failed. 24 resources updated in 04 minutes 10 seconds
[2016-07-31T16:36:15+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
[2016-07-31T16:36:15+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-07-31T16:36:15+00:00] ERROR: remote_file[/var/lib/jenkins/plugins/jenkins-cli.jar] (fanatics_pipeline::jenkins_plugins line 44) had an error: Errno::ECONNREFUSED: Connection refused - Connection refused connecting to http://localhost:8080/jnlpJars/jenkins-cli.jar, giving up
[2016-07-31T16:36:17+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
假設Jenkins的啟動時間稍長一些,您可以增加Chef嘗試檢索文件的retries
:
remote_file "#{node['plugins_dir']}/jenkins-cli.jar" do
source node['cli_jar']
retries 60
action :create
mode '0755'
notifies :restart, "service[#{node['repo']['name']}]", :delayed
end
這將嘗試60次。
在嘗試下載JAR之前,您需要確保Jenkins已啟動。 另外,請確保沒有防火牆或其他阻止端口的設備。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.