如何在詹金斯中为本地服务设置JBOSS_HOME

时间:2018-11-21 11:51:37

标签: jenkins jenkins-pipeline

我正在尝试将詹金斯集成到我的本地服务器。我已经生成了Gradle构建文件。现在我需要让詹金斯部署 我的本地服务器中的.war文件(jboss 7.x eap)。在配置系统中,在jboss管理生成器下,它询问服务器详细信息,例如本地服务器,服务器名称,jboss_name,jndi端口等。我试图将本地路径地址指定为jboss_ name,但其说法是“它看起来不像正确的jboss主页目录'。如何为本地服务器设置jboss_home并通过jenkins触发自动部署?

1 个答案:

答案 0 :(得分:0)

在下面查看此示例设置:

scripts/config-sample
#!/bin/bash

# The INSTALLERS_DIR must be relative to this directory
# It have to contains binaries like jboss-eap-6.4.0.zip, jboss-eap-6.4.*.patch.zip
INSTALLERS_DIR=../installers

# The CONFIGURATIONS_DIR must be relative to this directory
# It have to contains patch and additional files that will be added to JBOSS_DIR
CONFIGURATIONS_DIR=../configurations

# Scripts will show warnings?
VERBOSE=false

# JDK Installer is a RPM binary file
JDK_INSTALLER=jdk-8u144-linux-x64.rpm

# Binay file to extract JBoss (PATH is relative to INSTALLERS_DIR)
# These files are the original downloaded from https://access.redhat.com
JBOSS_INSTALLER_ZIP=jboss-eap-6.4.0.zip
JBOSS_PATCHES=(
  jboss-eap-6.4.9-patch.zip
  jboss-eap-6.4.16-patch.zip
)

# JBoss directory when extracted
JBOSS_DIR=jboss-eap-6.4

# User (operational system) that runs JBoss
JBOSS_USER=jboss
JBOSS_USER_PASSWORD='jb@3!2_'
# Group (operational system) that runs JBoss
JBOSS_GROUP=jboss

# Directory that will contains $JBOSS_DIR
JBOSS_INSTALL_DIR=/opt

# Link (bellow JBOSS_INSTALL_DIR) that will points to $JBOSS_DIR
JBOSS_LINK=jboss

# Full path to JBoss
JBOSS_HOME=$JBOSS_INSTALL_DIR/$JBOSS_LINK

# JBoss console log file
JBOSS_CONSOLE_LOG=/var/log/jboss-as/console.log

# Hostname of the machine that runs JBoss
JBOSS_HOST=`hostname -s`

# JBoss bind address (ip or hostname)
case "$OSTYPE" in
  # In this case (linux), it is configured with IP address of the second interface
  linux*) JBOSS_BIND_ADDRESS=`hostname -I | cut -d ' ' -f 2`;;
  # We put a macOS alternative just to permit a jboss-copy-patches script execution
  darwin*) JBOSS_BIND_ADDRESS=localhost;;
esac

# JBoss bind address management (ip or hostname)
JBOSS_BIND_ADDRESS_MANAGEMENT=$JBOSS_BIND_ADDRESS

# JBoss domain (master) address (ip or hostname)
JBOSS_DOMAIN_MASTER_ADDRESS=dc1

# JBoss admin username (to access console)
JBOSS_ADMIN_USER=admin
# JBoss admin password
JBOSS_ADMIN_PASSWORD='jbAdmin@123!'

# Default JBoss type
JBOSS_TYPE=slave

# Variable configurations depending on $JBOSS_HOST
case $JBOSS_HOST in

  # If host is master, JBOSS_TYPE is master
  $JBOSS_DOMAIN_MASTER_ADDRESS)
    JBOSS_TYPE=master
    ;;

esac

# Host config file is JBOSS_TYPE dependant
JBOSS_HOST_CONFIG=host-${JBOSS_TYPE}.xml

因此,安装文件夹是$JBOSS_HOME文件夹

# Full path to JBoss
JBOSS_HOME=$JBOSS_INSTALL_DIR/$JBOSS_LINK

要通过gradle进行部署,请查看此link