0

Jenkins でscpプラグインを使用して、新しくビルドしたプロジェクトの WAR をリモート ホストに伝えています。

手動で、その WAR をそのホストのユーザーにコピーし、自分でそこに移動してルート (sudo) を取得し、WAR を/var/lib/tomcat6/webappsにコピーして、Tomcat が即座に展開します。

ただし、ユーザーtomcat6には検出可能なパスワードがないため、 scpのユーザーとしてtomcat6を使用する方法が見つからないため、Jenkins にキーボード操作なしでこれを行う方法を伝えるのに途方に暮れています。Jenkins を使用して継続的にレンダリングする配備は役に立たない。

Precise サーバーで Jenkins を実行しており、WAR をデプロイするリモート サーバーでも Precise を実行しています。

この質問を読んでくれた人に感謝し、これを達成するための賢い方法について私をまっすぐに設定できる人に感謝します。

Jenkins からの関連する出力 (失敗) は次のとおりです。

BUILD SUCCESSFUL
Total time: 29 seconds
[SCP] Connecting to app-1.site
[SCP] uploading file: '/var/lib/tomcat6/webapps/myapp.war'
ERROR: Failed to upload files
3: Permission denied
    at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2289)
    at com.jcraft.jsch.ChannelSftp._put(ChannelSftp.java:485)
    at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:439)
    at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:406)
    at be.certipost.hudson.plugin.SCPSite.upload(SCPSite.java:239)
    at be.certipost.hudson.plugin.SCPRepositoryPublisher.perform(SCPRepositoryPublisher.java:211)
    at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:776)
    at hudson.model.Build$BuildExecution.post2(Build.java:183)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:726)
    at hudson.model.Run.execute(Run.java:1600)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:241)
Build step 'Publish artifacts to SCP Repository' changed build result to UNSTABLE
Finished: UNSTABLE

試すべき解決策は 2 つありますが、どちらも良いとは思いません。私の意見では、本当の方法は、最初から tomcat6 を正真正銘のユーザーとして使用できるようにすることです。そのためには、制御可能なパスワードが必要です。

試す解決策

1) tomcat6にパスワードを付与します。a) これができるのか、b) 試してもうまくいくのか、c) Tomcat のインストールが壊れてしまうのか、今はしたくありません。研究が必要です。

2)/var/lib/tomcat6/webappsの権限をジャックして、自分のユーザーまたはジョブ用に特別に作成した別のユーザーがそのパスにコピーでき、Tomcat がそこにコピーされたものを喜んでデプロイできるようにします。ビルド中に ANT から WAR ファイルのアクセス許可を変更する必要がある場合があります。

4

1 に答える 1