更新詹金斯从战争文件(Update Jenkins from a war file)

2019-06-25 12:43发布

我有一台机器与Ubuntu 12.04和已安装版本詹金斯。 使用1.424.6易于得到基于本指南 ,但有一个新的版本:

New version of Jenkins (1.447.2) is available for download (changelog).

如果我按下载,我得到一个jenkins.war文件......但我要如何使用该升级我目前的安装吗? 或者是不可能的Apt库得到更新之前?

Answer 1:

您可以覆盖现有jenkins.war用新的文件,然后重新启动詹金斯。

此文件通常位于/usr/share/jenkins

如果这不是你的系统的情况下, Manage Jenkins -> System Information ,就会显示路径.war下文件executable-war



Answer 2:

如果您已经安装了通过詹金斯apt-get的,你也应该通过更新詹金斯apt-get的,以避免将来出现问题。 更新应通过“apt-get的更新”,然后“apt-get的升级”工作。

有关详情请访问以下网址:

https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu



Answer 3:

#on ubuntu, in /usr/share/jenkins:

sudo service jenkins stop
sudo mv jenkins.war jenkins.war.old
sudo wget https://updates.jenkins-ci.org/latest/jenkins.war
sudo service jenkins start


Answer 4:

apt-get update
apt-get upgrade 

目前在Linux上升级最简单的方式,就像一个魅力每次。



Answer 5:

虽然我不认为这是一个有效的答案OP的问题,我仍然强调,最好的方式来部署詹金斯(可能最如果不是所有的库/包/软件)在Ubuntu是利用资质(或APT-获得)管理系统。

这是记录在这里: https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu (请注意,如果你想使用LTS打造,打在这个回购的http:// PKG。 jenkins-ci.org/debian-stable/ )

所以,如果你确实没有使用这种方法任何机会,你会简单地做一个apt-get upgrade jenkins



Answer 6:

我们从运行使用下面的命令.war文件詹金斯。

java -Xmx2500M -jar jenkins.war --httpPort=3333 --prefix=/jenkins

你甚至可以在〜/下载目录中运行命令



Answer 7:

我用这个Groovy脚本下载新的战争文件

import java.util.concurrent.atomic.AtomicInteger

class ThreadHelper{
    static done = false;
    static starttime = System.currentTimeMillis()
    static synchronized printx (message) {    printf ("%5s seconds: %20s",(System.currentTimeMillis()-starttime)/1000.0 , message); println("") }
    def download(address)
    {
    def filename = new File(System.getenv()['CI_HOME'] + '/' + address.tokenize("/")[-1])
    println(filename.getCanonicalPath())
    def file = new FileOutputStream(filename)
    def out = new BufferedOutputStream(file)
    out << new URL(address).openStream()
    out.close()
    done=true;
    }

}

println("executing from ... "+ new File(".").getCanonicalPath())

def counter = new AtomicInteger();
    th = Thread.start {
    while(!ThreadHelper.done) {
    sleep 1000
    counter.incrementAndGet()
    print '.'
    }
}

th2 = Thread.start { new ThreadHelper().download("http://mirrors.jenkins-ci.org/war/latest/jenkins.war") }
th.join()
th2.join()

ThreadHelper.printx('done')

而另一个脚本shutsdown的tomcat - 副本战争,并重新启动它

我们举办它在2008年的窗户和tomcat,我使用SC查询,sc配置,SC停止,SC开始管理窗口服务

    set warname=jenkins

if '%name%' == 'trak' set warname=trak

pushd .
if '%name%'=='' goto badname
if '%warname%'=='' goto badname

if '%ci_home%'=='' goto badcihome

REM =====================================================
REM stop windows service
sc stop %name%

REM sleep for 5 seconds see http:\\stackoverflow.com\questions\1672338\how-to-sleep-for-5-seconds-in-windowss-command-prompt-or-dos
ping 1.1.1.1 -n 1 -w 3000 > nul

rem replace forward slash with backward slash
set tomcat_dir=%ci_home:/=\%\instances\tomcat7-%name%

REM Create sub directory called bak-yymmdd-hhmmss
REM where yymmdd-hhmmss is a date-time stamp like 120601-142907

set hh=%time:~0,2%

REM Since there is no leading zero for times before 10 am, have to put in
REM a zero when this is run before 10 am.

if "%time:~0,1%"==" " set hh=0%hh:~1,1%

set yymmdd_hhmmss=%date:~12,2%%date:~4,2%%date:~7,2%-%hh%%time:~3,2%%time:~6,2%

set backupdir=bak-%yymmdd_hhmmss%

REM =====================================================
md %tomcat_dir%\logs\%backupdir%

cd %tomcat_dir%\logs

dir bak*
echo "nothing-to-log" >> force.log

REM move command will fail if there is nothing to move hence the force log statement above

call move *.* %backupdir%

REM =====================================================
rmdir %tomcat_dir%\webapps\%name% /q/s

echo f|xcopy %ci_home%\%warname%.war %tomcat_dir%\webapps\%name%.war /y

REM TODO===== something about jenkins plugins

REM =====================================================
cd "%tomcat_dir%\bin"
call catalina version

echo =====================================================
echo ====== removing %name%
call service remove %name%

echo =====================================================
echo ====== installing %name%
call service install %name%

echo on

REM setting service to start automatically, note that space before the word auto IS REQUIRED
sc config %name% start= auto

REM =====================================================
sc start %name%

popd

exit 0

goto done

:badname
echo 'name required - this will be used as windows service name as well'
pause
exit 1

:badcihome
echo 'CI home env var required - ci_home'
pause
exit 1

:done


Answer 8:

https://wiki.jenkins.io/display/JENKINS/Installing+Jenkins+on+Ubuntu

Once installed like this, you can update to the later version of Jenkins (when it comes out) by running the following commands:
-------
sudo apt-get update
sudo apt-get install jenkins
-------
(aptitude or apt-get doesn't make any difference.)
What does this package do?
Jenkins will be launched as a daemon up on start. See /etc/init.d/jenkins for more details.
The 'jenkins' user is created to run this service.
Log file will be placed in /var/log/jenkins/jenkins.log. Check this file if you are troubleshooting Jenkins.
/etc/default/jenkins will capture configuration parameters for the launch like e.g JENKINS_HOME
By default, Jenkins listen on port 8080. Access this port with your browser to start configuration.


Answer 9:

我的是在/ usr /共享/詹金斯我认为这是通过安装安装了apt-get的所以可能想看看那里。

Ubuntu的12.04.1



Answer 10:

我不想安装进来捆绑X11-通用等组成的apt-get安装的办法,所以我刚刚下载的.war文件并运行弗朗索瓦提到的命令。 这工作很好,但你必须用这种方法编写自己的脚本守护进程。 这里的全部细节: http://strem.in/stream/9488/Using-the-war-file-for-jenkins-ci



文章来源: Update Jenkins from a war file