Skip to content

Commit

Permalink
devonfw#1164: fixed jenkins-cli installation
Browse files Browse the repository at this point in the history
added new param target_filename to doInstall
added extra condition to doInstall to provide a filename for doDownload
replaced doDownload in jenkins tool command with doInstall
adjusted extraction of jenkins-cli.jar in doSetup of jenkins (jenkins-cli.jar was removed from WEB_INF folder in later jenkins versions)
  • Loading branch information
jan-vcapgemini committed Jul 25, 2023
1 parent 2a55be0 commit 5a542a3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 17 deletions.
17 changes: 11 additions & 6 deletions scripts/src/main/resources/scripts/command/jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,19 @@ function doSetup() {
echo "Jenkins is already installed at ${JENKINS_HOME}"
fi
else
local version=${JENKINS_VERSION:-latest}
doDownload "-" "" "jenkins" "${version}" "-" "" "" "" "jenkins.war"
mkdir -p "${JENKINS_HOME}"
doRunCommand "mv '${DEVON_DOWNLOAD_DIR}/jenkins.war' '${JENKINS_HOME}/jenkins.war'"
# http://localhost:9999/jnlpJars/jenkins-cli.jar
# shellcheck disable=SC2034
TOOL_VERSION_COMMAND="-"
doInstall "jenkins" "${JENKINS_VERSION}" "" "" "" "" "noUnpack" "" "" "jenkins.war"
local cwd="${PWD}"
cd "${JENKINS_HOME}" || exit 255
doRunCommand "jar xf jenkins.war WEB-INF/jenkins-cli.jar"
local version=${JENKINS_VERSION}
if [ -z "${JENKINS_VERSION}" ]
then
version="$(doGetLatestSoftwareVersion "jenkins")"
fi
doRunCommand "jar xf jenkins.war WEB-INF/lib/cli-${version}.jar"
doRunCommand "mv 'WEB-INF/lib/cli-${version}.jar' 'jenkins-cli.jar'"
doRunCommand "rm -rf WEB-INF/"
cd "${cwd}" || exit 255
fi
if [ "${1}" != "silent" ] && ! doIsQuiet
Expand Down
30 changes: 19 additions & 11 deletions scripts/src/main/resources/scripts/functions
Original file line number Diff line number Diff line change
Expand Up @@ -1264,15 +1264,16 @@ function doResolveDownloadUrl() {
echo "${1}"
}

# $1: name of software
# $2: version of software
# $3: optional silent flag ('silent' to suppress output if already up-to-date or empty for version output)
# $4: optional edition (e.g. "enterprise" or "community")
# $5: optional absolute target path where to install
# $6: optional OS indicator ('-' if OS independent)
# $7: optional to ignore extracting downloaded files (use 'noUnpack' or leave empty to extract)
# $8: optional software repository
# $9: optional download URL
# $1: name of software
# $2: version of software
# $3: optional silent flag ('silent' to suppress output if already up-to-date or empty for version output)
# $4: optional edition (e.g. "enterprise" or "community")
# $5: optional absolute target path where to install
# $6: optional OS indicator ('-' if OS independent)
# $7: optional to ignore extracting downloaded files (use 'noUnpack' or leave empty to extract)
# $8: optional software repository
# $9: optional download URL
# $10: optional target filename
function doInstall() {
doDebug "doInstall ${*}"
local software="${1}"
Expand All @@ -1284,6 +1285,7 @@ function doInstall() {
local noUnpack="${7}"
local repository="${8}"
local url="${9}"
local target_filename="${10}"
if [ -z "${target_path}" ]
then
target_path="${DEVON_IDE_HOME}/software/${software}"
Expand Down Expand Up @@ -1389,8 +1391,14 @@ function doInstall() {
fi
if [ ! -d "${install_path}" ] || [ "${install_path}" == "${target_path}" ]
then
doDownload "${url}" "${download_dir}" "${software}" "${version}" "${edition}" "${os}" "${arch}" "${ext}"
doDebug "Received download file ${DOWNLOAD_FILENAME}"
if [ -z "${target_filename}" ]
then
doDownload "${url}" "${download_dir}" "${software}" "${version}" "${edition}" "${os}" "${arch}" "${ext}"
doDebug "Received download file ${DOWNLOAD_FILENAME}"
else
doDownload "${url}" "${download_dir}" "${software}" "${version}" "${edition}" "${os}" "${arch}" "${ext}" "${target_filename}"
doDebug "Received download file ${DOWNLOAD_FILENAME} with file name ${target_filename}"
fi
if [ -n "${noUnpack}" ]
then
doDebug "Download shall not be extracted, hence copying ${DOWNLOAD_FILENAME} to ${install_path}"
Expand Down

0 comments on commit 5a542a3

Please sign in to comment.