将.war从Jenkins移至野蝇

时间:2018-10-28 01:00:03

标签: docker jenkins docker-compose wildfly

我无法将Jenkins配备的.war移到Widfly,两者都在我的Docker中。

[INFO] Building war: /var/jenkins_home/workspace/argentum-web/target/argentum-web.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.717 s
[INFO] Finished at: 2018-10-28T00:55:49Z
[INFO] ------------------------------------------------------------------------
[argentum-web] $ /bin/sh -xe /tmp/jenkins541409688598903433.sh
+ cd /opt/jboss/wildfly
/tmp/jenkins541409688598903433.sh: 2: cd: can't cd to /opt/jboss/wildfly
Build step 'Execute shell' marked build as failure
Finished: FAILURE

构建->执行Shell

cp /var/jenkins_home/workspace/argentum-web/target/argentum-web.war /opt/jboss/wildfly/standalone/deployments/argentum-web.war

docker-compose:

版本:“ 2”

services:
  jenkins:
    image: jenkins/jenkins:lts
    volumes:
    - /home/rafaelvicio/Dev/jenkins_example/jenkins:/var/jenkins_home/workspace/
    ports:
    - 8080:8080
    - 50000:50000
  wildfly:
    image: jboss/wildfly
    volumes:
    - /home/rafaelvicio/Dev/jenkins_example/wildfly/:/opt/jboss/wildfly/standalone/deployments/
    ports:
    - 8180:8080
    - 9990:9990

1 个答案:

答案 0 :(得分:0)

您的复制声明不正确。请记住,您的詹金斯工作在自己的容器中运行。和您的Jboss容器不同。

如果您在Jenkins容器中运行以下命令

cp /var/jenkins_home/workspace/argentum-web/target/argentum-web.war /opt/jboss/wildfly/standalone/deployments/argentum-web.war

它(詹金斯)不知道/opt/jboss/wildfly在哪里。由于该路径在Jenkins容器中不存在。

复制命令应该改为

cp /home/rafaelvicio/Dev/jenkins_example/jenkins/<path-to-war-file> /home/rafaelvicio/Dev/jenkins_example/wildfly/<path-to-deployment-folder>