refactored clean-nightly
diff --git a/hudson-scripts/clean-nightly.sh b/hudson-scripts/clean-nightly.sh
index 9abc841..d79c879 100755
--- a/hudson-scripts/clean-nightly.sh
+++ b/hudson-scripts/clean-nightly.sh
@@ -26,49 +26,6 @@
source "$(dirname "${0}")/init.sh"
-currentPwd=$(pwd)
-
-LSDEBUG "unqualifiedVersion is '${unqualifiedVersion}'"
-minorVersion="$(echo ${unqualifiedVersion} | sed-regex 's/^([0-9]+\.[0-9]+)\.[0-9]+$/\1/')"
-LSDEBUG "Minor stream name is '${minorVersion}.x'"
-majorVersion="$(echo ${unqualifiedVersion} | sed-regex 's/^([0-9]+)\.[0-9]+\.[0-9]+$/\1/')"
-LSDEBUG "Major stream name is '${majorVersion}.x'"
-
LSINFO "== Clean up '${unqualifiedVersion}' nightly builds (will keep the ${nbBuildToKeep} most recent) =="
-cd "${UPDATE_NIGHTLY_HOME}"
-foldersWithUnqualifiedVersionPrefix=( "${unqualifiedVersion}"* )
-cd "${currentPwd}"
-
-if [ ${#foldersWithUnqualifiedVersionPrefix[@]} -eq 0 ]; then
- LSINFO "No build '${unqualifiedVersion}' found in '${UPDATE_NIGHTLY_HOME}, nothing to clean'"
- exit 0
-fi
-
-if [ ${nbBuildToKeep} -gt 0 ]; then
- updateSiteToKeep=( $(echo ${foldersWithUnqualifiedVersionPrefix[@]} | tr ' ' '\n' | sort -r | head -n ${nbBuildToKeep}) )
- UNION=( ${updateSiteToKeep[@]} ${foldersWithUnqualifiedVersionPrefix[@]} )
- updateSitesToClean=( $(echo ${UNION[@]} | tr ' ' '\n' | sort | uniq -u) )
-else
- updateSitesToClean=( $(echo ${foldersWithUnqualifiedVersionPrefix[@]} | tr ' ' '\n' | sort) )
-fi
-
-if [ ${#updateSitesToClean[@]} -eq 0 ]; then
- LSINFO "There are ${#foldersWithUnqualifiedVersionPrefix[@]} '${unqualifiedVersion}' builds, nothing to clean as we are keeping the ${nbBuildToKeep} most recent builds."
-else
- for updateSiteToClean in ${updateSitesToClean[@]}; do
- cleanNightly ${updateSiteToClean} "${UPDATE_NIGHTLY_HOME}/streams/${unqualifiedVersion}.x" "${UPDATE_NIGHTLY_HOME}/streams/${unqualifiedVersion}.x/latest"
- cleanNightly ${updateSiteToClean} "${UPDATE_NIGHTLY_HOME}/streams/${minorVersion}.x" "${UPDATE_NIGHTLY_HOME}/streams/${minorVersion}.x/latest"
- cleanNightly ${updateSiteToClean} "${UPDATE_NIGHTLY_HOME}/streams/${majorVersion}.x" "${UPDATE_NIGHTLY_HOME}/streams/${majorVersion}.x/latest"
- cleanNightly ${updateSiteToClean} "${UPDATE_NIGHTLY_HOME}" "${UPDATE_NIGHTLY_HOME}/latest"
-
- LSINFO "Removing folder '${UPDATE_NIGHTLY_HOME}/${updateSiteToClean}'"
- rm -rf "${UPDATE_NIGHTLY_HOME}/${updateSiteToClean}"
- done
-
- updateLatest "${UPDATE_NIGHTLY_HOME}/streams/${unqualifiedVersion}.x/latest" "${UPDATE_NIGHTLY_HOME}" "${unqualifiedVersion}" "${PROJECT_NAME} ${unqualifiedVersion}.x latest nightly build"
- updateLatest "${UPDATE_NIGHTLY_HOME}/streams/${minorVersion}.x/latest" "${UPDATE_NIGHTLY_HOME}" "${minorVersion}" "${PROJECT_NAME} ${minorVersion}.x latest nightly build"
- updateLatest "${UPDATE_NIGHTLY_HOME}/streams/${majorVersion}.x/latest" "${UPDATE_NIGHTLY_HOME}" "${majorVersion}" "${PROJECT_NAME} ${majorVersion}.x latest nightly build"
- updateLatest "${UPDATE_NIGHTLY_HOME}/latest" "${UPDATE_NIGHTLY_HOME}" "" "${PROJECT_NAME} latest nightly build"
-
-fi
+cleanUpdateSites "${UPDATE_NIGHTLY_HOME}" "${PROJECT_NAME}" "${NIGHTLY_FOLDER}" "${unqualifiedVersion}" "${nbBuildToKeep}"
\ No newline at end of file
diff --git a/hudson-scripts/init/0_constants.sh b/hudson-scripts/init/0_constants.sh
index 6bc67c3..ce8d1b5 100644
--- a/hudson-scripts/init/0_constants.sh
+++ b/hudson-scripts/init/0_constants.sh
@@ -13,21 +13,25 @@
# Project specific
export PROJECT_NAME="${PROJECT_NAME:-EMF Compare}"
export DOWNLOAD_PATH="${DOWNLOAD_PATH:-download.eclipse.org/modeling/emf/compare}"
-export ECLIPSE_DOCUMENT_ROOT="${ECLIPSE_DOCUMENT_ROOT:-/home/data/httpd}"
+export DOCUMENT_ROOT="${DOCUMENT_ROOT:-/home/data/httpd}"
-# Private constants
+# default value constants
export UPDATE_FOLDER="${UPDATE_FOLDER:-updates}"
+
export STREAMS_FOLDER="${STREAMS_FOLDER:-streams}"
+export STREAM_NAME_SUFFIX="${STREAM_NAME_SUFFIX:-.x}"
export LATEST_FOLDER="${LATEST_FOLDER:-latest}"
+
export NIGHTLY_FOLDER="${NIGHTLY_FOLDER:-nightly}"
export INTEGRATION_FOLDER="${INTEGRATION_FOLDER:-integration}"
export RELEASES_FOLDER="${RELEASES_FOLDER:-releases}"
+
export SIMREL_FOLDER="${SIMREL_FOLDER:-simrel}"
export STAGING_FOLDER="${STAGING_FOLDER:-${SIMREL_FOLDER}/staging}"
export MAINTENANCE_FOLDER="${MAINTENANCE_FOLDER:-${SIMREL_FOLDER}/maintenance}"
export MILESTONES_FOLDER="${MILESTONES_FOLDER:-${SIMREL_FOLDER}/milestones}"
-export DOWNLOAD_HOME="${DOWNLOAD_HOME:-${ECLIPSE_DOCUMENT_ROOT}/${DOWNLOAD_PATH}}"
+export DOWNLOAD_HOME="${DOWNLOAD_HOME:-${DOCUMENT_ROOT}/${DOWNLOAD_PATH}}"
export DOWNLOAD_URL="${DOWNLOAD_URL:-http://${DOWNLOAD_PATH}}"
# Computed from above
diff --git a/hudson-scripts/init/3_git-publish.sh b/hudson-scripts/init/1_git-publish.sh
similarity index 100%
rename from hudson-scripts/init/3_git-publish.sh
rename to hudson-scripts/init/1_git-publish.sh
diff --git a/hudson-scripts/init/1_version.sh b/hudson-scripts/init/1_version.sh
new file mode 100644
index 0000000..91d4aed
--- /dev/null
+++ b/hudson-scripts/init/1_version.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+# ====================================================================
+# Copyright (c) 2014 Obeo
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Obeo - initial API and implementation
+# ====================================================================
+
+_QUALIFIED_VERSION_PATTERN="^([0-9]+)(\.([0-9]+)(\.([0-9]+)(\.(.+))?)?)?$"
+
+unqualifiedVersion() {
+ local qualifiedVersion="${1}"
+ local v=$(echo ${qualifiedVersion} | sed-regex "s/${_QUALIFIED_VERSION_PATTERN}/\1.\3.\5/")
+ echo "${v}"
+}
+
+minorVersion() {
+ local qualifiedVersion="${1}"
+ local v=$(echo ${qualifiedVersion} | sed-regex "s/${_QUALIFIED_VERSION_PATTERN}/\1.\3/")
+ echo "${v}"
+}
+
+majorVersion() {
+ local qualifiedVersion="${1}"
+ local v=$(echo ${qualifiedVersion} | sed-regex "s/${_QUALIFIED_VERSION_PATTERN}/\1/")
+ echo "${v}"
+}
diff --git a/hudson-scripts/init/3_filesystem.sh b/hudson-scripts/init/2_filesystem.sh
similarity index 100%
rename from hudson-scripts/init/3_filesystem.sh
rename to hudson-scripts/init/2_filesystem.sh
diff --git a/hudson-scripts/init/2_functions.sh b/hudson-scripts/init/2_functions.sh
deleted file mode 100644
index a330412..0000000
--- a/hudson-scripts/init/2_functions.sh
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/bin/sh
-# ====================================================================
-# Copyright (c) 2014 Obeo
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# Obeo - initial API and implementation
-# ====================================================================
-
-updateLatest() {
- local absolutePathToLatest="${1}"
- local updateHome="${2}"
- local prefix="${3}"
- local latestRepoName="${4}"
-
- local currentPwd=$(pwd)
- cd "${updateHome}"
- local allFilesWithPrefix=( $(echo "${prefix}"* | tr ' ' '\n' | grep -E '[0-9]+\.[0-9]+\.[0-9]+.*' || true) )
- cd "${currentPwd}"
-
- if [ ${#allFilesWithPrefix[@]} -gt 0 ]; then
- local latestUpdatePath=$( echo ${allFilesWithPrefix[@]} | tr ' ' '\n' | sort | tail -n 1 )
- local relpath=$( relativize ${absolutePathToLatest} ${updateHome}/${latestUpdatePath} )
- LSINFO "Creating redirection from '${absolutePathToLatest}' to '${latestUpdatePath}'"
- createRedirect "${absolutePathToLatest}" "${relpath}" "${latestRepoName}"
- else
- LSDEBUG "There is no folder that seem to be an update site in '${updateHome}'. No one have a name that start with '${prefix}' and that match the regex '[0-9]+\.[0-9]+\.[0-9]+.*'"
- fi
-}
-
-cleanNightly() {
- local updateSiteToClean=$1
- local streamPath=$2
- local latestInStreamPath=$3
-
- local updateSiteURLToClean="${UPDATE_NIGHTLY_URL}/${updateSiteToClean}"
- local relpath=$( relativize ${streamPath} ${UPDATE_NIGHTLY_HOME}/${updateSiteToClean} )
-
- LSINFO "Removing '${relpath}' from '${streamPath}'"
- compositeRepository -location "${streamPath}" -remove "${relpath}"
-
- ##check the number of children in streamPath, if 0 remove folder (no need to check latest)
- local streamPathChild=( $(compositeRepository -location "${streamPath}" -list) )
- if [ ${#streamPathChild[@]} -eq 0 ]; then
- LSINFO "Removing folder '${streamPath}' as it has no children anymore"
- if [ "${streamPath}" = "${UPDATE_NIGHTLY_HOME}" ]; then
- rm -rf "${streamPath}/"*
- else
- rm -rf "${streamPath}"
- fi
- else
- local latestUpdateSiteInStream=( $(compositeRepository -location "${latestInStreamPath}" -list) )
- LSDEBUG "Current latest update site in stream '${streamPath}' is '${latestUpdateSiteInStream[@]}'"
- if [ ${#latestUpdateSiteInStream[@]} -gt 0 ]; then
- if [ ${#latestUpdateSiteInStream[@]} -gt 1 ]; then
- LSCRITICAL "There are more than a single update site referenced in the repository ${latestInStreamPath}"
- exit 1
- elif [ "${updateSiteURLToClean}" = "${latestUpdateSiteInStream[0]}" ]; then
- relpath=$( relativize ${latestInStreamPath} ${UPDATE_NIGHTLY_HOME}/${updateSiteToClean} )
- LSINFO "Removing '${relpath}' from '${latestInStreamPath}'"
- compositeRepository -location "${latestInStreamPath}" -remove "${relpath}"
- fi
- fi
- fi
-}
diff --git a/hudson-scripts/init/3_update-site-publish.sh b/hudson-scripts/init/3_update-site-publish.sh
index 1b7e6a3..619b5d6 100644
--- a/hudson-scripts/init/3_update-site-publish.sh
+++ b/hudson-scripts/init/3_update-site-publish.sh
@@ -23,16 +23,37 @@
unzip -qq "${localArtifact}" -d "${unzipTo}"
}
+_updateLatestUpdateSite() {
+ local updateHome="${1}"
+ local absolutePathToLatest="${2}"
+ local prefix="${3}"
+ local latestRepoLabel="${4}"
+
+ local currentPwd=$(pwd)
+ cd "${updateHome}"
+ local allFilesWithPrefix=( $(echo "${prefix}"* | tr ' ' '\n' | grep -E '[0-9]+\.[0-9]+\.[0-9]+.*' || true) )
+ cd "${currentPwd}"
+
+ if [ ${#allFilesWithPrefix[@]} -gt 0 ]; then
+ local latestUpdatePath=$( echo ${allFilesWithPrefix[@]} | tr ' ' '\n' | sort | tail -n 1 )
+ local relpath=$( relativize ${absolutePathToLatest} ${updateHome}/${latestUpdatePath} )
+ LSINFO "Creating redirection from '${absolutePathToLatest}' to '${latestUpdatePath}'"
+ createRedirect "${absolutePathToLatest}" "${relpath}" "${latestRepoLabel}"
+ else
+ LSDEBUG "No folder in '${updateHome}' have a name that start with '${prefix}' and that match the regex '[0-9]+\.[0-9]+\.[0-9]+.*'."
+ fi
+}
+
_publishUpdateSiteInStream() {
- local projectName="${1}"
- local category="${2}"
- local updateHome="${3}"
+ local updateHome="${1}"
+ local projectName="${2}"
+ local category="${3}"
local qualifiedVersion="${4}"
local stream="${5}"
- local repoLabelPrefix="${projectName}${stream:+ ${stream}.x}"
+ local repoLabelPrefix="${projectName}${stream:+ ${stream}${STREAM_NAME_SUFFIX}}"
- local streamPath="${updateHome}${stream:+/${STREAMS_FOLDER}/${stream}.x}"
+ local streamPath="${updateHome}${stream:+/${STREAMS_FOLDER}/${stream}${STREAM_NAME_SUFFIX}}"
local relPathToUpdateSite=$( relativize "${streamPath}" "${updateHome}/${qualifiedVersion}" )
LSDEBUG "Adding '${relPathToUpdateSite}' to composite repository '${streamPath}'"
@@ -43,8 +64,8 @@
-compressed
createP2Index "${streamPath}"
- LSDEBUG "Updating latest of stream '${stream}' @ '${streamPath}'"
- updateLatest "${streamPath}${streamPath:+/}${LATEST_FOLDER}" "${updateHome}" "${stream}" "${repoLabelPrefix} latest ${category} build"
+ LSDEBUG "Updating latest of stream '${stream}${STREAM_NAME_SUFFIX}' @ '${streamPath}'"
+ _updateLatestUpdateSite "${updateHome}" "${streamPath}${streamPath:+/}${LATEST_FOLDER}" "${stream}" "${repoLabelPrefix} latest ${category} build"
}
publishUpdateSite() {
@@ -55,13 +76,6 @@
local qualifiedVersion="${5}"
local updateHome="${6}"
- unqualifiedVersion="$(echo ${qualifiedVersion} | sed-regex 's/^([0-9]+\.[0-9]+\.[0-9]+)\..+$/\1/')"
- LSDEBUG "unqualifiedVersion is '${unqualifiedVersion}'"
- minorVersion="$(echo ${qualifiedVersion} | sed-regex 's/^([0-9]+\.[0-9]+)\.[0-9]+\..+$/\1/')"
- LSDEBUG "Minor stream name is '${minorVersion}.x'"
- majorVersion="$(echo ${qualifiedVersion} | sed-regex 's/^([0-9]+)\.[0-9]+\.[0-9]+\..+$/\1/')"
- LSDEBUG "Major stream name is '${majorVersion}.x'"
-
# the update site
LSINFO "Downloading '${artifactURL}'"
local targetUpdateSiteName="update-site-${qualifiedVersion}"
@@ -76,8 +90,8 @@
cp -Rf "${wd}/${targetUpdateSiteName}/"* "${updateHome}/${qualifiedVersion}"
## streams update
- _publishUpdateSiteInStream "${projectName}" "${category}" "${updateHome}" "${qualifiedVersion}" "${unqualifiedVersion}"
- _publishUpdateSiteInStream "${projectName}" "${category}" "${updateHome}" "${qualifiedVersion}" "${minorVersion}"
- _publishUpdateSiteInStream "${projectName}" "${category}" "${updateHome}" "${qualifiedVersion}" "${majorVersion}"
- _publishUpdateSiteInStream "${projectName}" "${category}" "${updateHome}" "${qualifiedVersion}" ""
+ _publishUpdateSiteInStream "${updateHome}" "${projectName}" "${category}" "${qualifiedVersion}" "$(unqualifiedVersion ${qualifiedVersion})"
+ _publishUpdateSiteInStream "${updateHome}" "${projectName}" "${category}" "${qualifiedVersion}" "$(minorVersion ${qualifiedVersion})"
+ _publishUpdateSiteInStream "${updateHome}" "${projectName}" "${category}" "${qualifiedVersion}" "$(majorVersion ${qualifiedVersion})"
+ _publishUpdateSiteInStream "${updateHome}" "${projectName}" "${category}" "${qualifiedVersion}" ""
}
diff --git a/hudson-scripts/init/4_update-site-clean.sh b/hudson-scripts/init/4_update-site-clean.sh
new file mode 100644
index 0000000..db371f8
--- /dev/null
+++ b/hudson-scripts/init/4_update-site-clean.sh
@@ -0,0 +1,98 @@
+#!/bin/sh
+# ====================================================================
+# Copyright (c) 2014 Obeo
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Obeo - initial API and implementation
+# ====================================================================
+
+_cleanNightly() {
+ local updateHome="${1}"
+ local streamPath="${2}"
+ local updateSiteToClean="${3}"
+
+ local latestInStreamPath="${streamPath}/${LATEST_FOLDER}"
+ local updateSiteURLToClean="${UPDATE_NIGHTLY_URL}/${updateSiteToClean}"
+ local relpath=$( relativize ${streamPath} ${updateHome}/${updateSiteToClean} )
+
+ LSINFO "Removing '${relpath}' from '${streamPath}'"
+ compositeRepository -location "${streamPath}" -remove "${relpath}"
+
+ ##check the number of children in streamPath, if 0 remove folder (no need to check latest)
+ local streamPathChild=( $(compositeRepository -location "${streamPath}" -list) )
+ if [ ${#streamPathChild[@]} -eq 0 ]; then
+ LSINFO "Removing folder '${streamPath}' as it has no children anymore"
+ if [ "${streamPath}" = "${updateHome}" ]; then
+ # do not remove home
+ rm -rf "${streamPath}/"*
+ else
+ rm -rf "${streamPath}"
+ fi
+ else
+ local latestUpdateSiteInStream=( $(compositeRepository -location "${latestInStreamPath}" -list) )
+ LSDEBUG "Current latest update site in stream '${streamPath}' is '${latestUpdateSiteInStream[@]}'"
+ if [ ${#latestUpdateSiteInStream[@]} -gt 0 ]; then
+ if [ ${#latestUpdateSiteInStream[@]} -gt 1 ]; then
+ LSDEBUG "There are more than a single update site referenced in the repository ${latestInStreamPath}"
+ compositeRepository -location "${latestInStreamPath}" -removeAll
+ compositeRepository -location "${latestInStreamPath}" -add "${relpath}"
+ elif [ "${updateSiteURLToClean}" = "${latestUpdateSiteInStream[0]}" ]; then
+ relpath=$( relativize ${latestInStreamPath} ${updateHome}/${updateSiteToClean} )
+ LSINFO "Removing '${relpath}' from '${latestInStreamPath}'"
+ compositeRepository -location "${latestInStreamPath}" -remove "${relpath}"
+ fi
+ fi
+ fi
+}
+
+cleanUpdateSites() {
+ local updateHome="${1}"
+ local projectName="${2}"
+ local category="${3}"
+ local unqualifiedVersion="${4}"
+ local nbBuildToKeep="${5:-5}"
+
+ local currentPwd=$(pwd)
+ cd "${updateHome}"
+ local foldersWithUnqualifiedVersionPrefix=( "${unqualifiedVersion}"* )
+ cd "${currentPwd}"
+
+ if [ ${#foldersWithUnqualifiedVersionPrefix[@]} -eq 0 ]; then
+ LSINFO "No build '${unqualifiedVersion}' found in '${updateHome}, nothing to clean'"
+ exit 0
+ fi
+
+ if [ ${nbBuildToKeep} -gt 0 ]; then
+ updateSiteToKeep=( $(echo ${foldersWithUnqualifiedVersionPrefix[@]} | tr ' ' '\n' | sort -r | head -n ${nbBuildToKeep}) )
+ UNION=( ${updateSiteToKeep[@]} ${foldersWithUnqualifiedVersionPrefix[@]} )
+ updateSitesToClean=( $(echo ${UNION[@]} | tr ' ' '\n' | sort | uniq -u) )
+ else
+ updateSitesToClean=( $(echo ${foldersWithUnqualifiedVersionPrefix[@]} | tr ' ' '\n' | sort) )
+ fi
+
+ if [ ${#updateSitesToClean[@]} -eq 0 ]; then
+ LSINFO "There are ${#foldersWithUnqualifiedVersionPrefix[@]} '${unqualifiedVersion}' builds, nothing to clean as we are keeping the ${nbBuildToKeep} most recent builds."
+ else
+ _minorVersion="$(minorVersion ${unqualifiedVersion})"
+ _majorVersion="$(majorVersion ${unqualifiedVersion})"
+
+ for updateSiteToClean in ${updateSitesToClean[@]}; do
+ _cleanNightly "${updateHome}" "${updateHome}/${STREAMS_FOLDER}/${unqualifiedVersion}${STREAM_NAME_SUFFIX}" "${updateSiteToClean}"
+ _cleanNightly "${updateHome}" "${updateHome}/${STREAMS_FOLDER}/${_minorVersion}${STREAM_NAME_SUFFIX}" "${updateSiteToClean}"
+ _cleanNightly "${updateHome}" "${updateHome}/${STREAMS_FOLDER}/${_majorVersion}${STREAM_NAME_SUFFIX}" "${updateSiteToClean}"
+ _cleanNightly "${updateHome}" "${updateHome}" "${updateSiteToClean}"
+
+ LSINFO "Removing folder '${updateHome}/${updateSiteToClean}'"
+ rm -rf "${updateHome}/${updateSiteToClean}"
+ done
+
+ _updateLatestUpdateSite "${updateHome}" "${updateHome}/${STREAMS_FOLDER}/${unqualifiedVersion}${STREAM_NAME_SUFFIX}/${LATEST_FOLDER}" "${unqualifiedVersion}" "${projectName} ${unqualifiedVersion}${STREAM_NAME_SUFFIX} latest ${category} build"
+ _updateLatestUpdateSite "${updateHome}" "${updateHome}/${STREAMS_FOLDER}/${_minorVersion}${STREAM_NAME_SUFFIX}/${LATEST_FOLDER}" "${_minorVersion}" "${projectName} ${_minorVersion}${STREAM_NAME_SUFFIX} latest ${category} build"
+ _updateLatestUpdateSite "${updateHome}" "${updateHome}/${STREAMS_FOLDER}/${_majorVersion}${STREAM_NAME_SUFFIX}/${LATEST_FOLDER}" "${_majorVersion}" "${projectName} ${_majorVersion}${STREAM_NAME_SUFFIX} latest ${category} build"
+ _updateLatestUpdateSite "${updateHome}" "${updateHome}/${LATEST_FOLDER}" "" "${projectName} latest ${category} build"
+ fi
+}
diff --git a/hudson-scripts/publish-nightly.sh b/hudson-scripts/publish-nightly.sh
index 38c1204..f8e96dc 100755
--- a/hudson-scripts/publish-nightly.sh
+++ b/hudson-scripts/publish-nightly.sh
@@ -27,6 +27,6 @@
LSINFO "== Publishing nightly build '${PROJECT_NAME} ${qualifiedVersion}' == "
-publishUpdateSite "${WORKING_DIRECTORY}" "${PROJECT_NAME}" "nightly" "${artifactURL}" "${qualifiedVersion}" "${UPDATE_NIGHTLY_HOME}"
+publishUpdateSite "${WORKING_DIRECTORY}" "${PROJECT_NAME}" "${NIGHTLY_FOLDER}" "${artifactURL}" "${qualifiedVersion}" "${UPDATE_NIGHTLY_HOME}"
LSINFO "== '${PROJECT_NAME} ${qualifiedVersion}' has been published @ '${UPDATE_NIGHTLY_URL}/${qualifiedVersion}' == "
diff --git a/hudson-scripts/tests/test-clean-nightly.sh b/hudson-scripts/tests/test-clean-nightly.sh
index f709732..376410a 100755
--- a/hudson-scripts/tests/test-clean-nightly.sh
+++ b/hudson-scripts/tests/test-clean-nightly.sh
@@ -11,12 +11,12 @@
# ====================================================================
# Test specific constants
-export WORKING_DIRECTORY="$(pwd)/target"
+export WORKING_DIRECTORY="$(pwd)/target/tests/cleaner"
export PROJECT_NAME="Test Project"
-export DOWNLOAD_PATH="cleaner"
-export ECLIPSE_DOCUMENT_ROOT="${WORKING_DIRECTORY}/tests/documentRoot"
-export DOWNLOAD_URL="file:${ECLIPSE_DOCUMENT_ROOT}/${DOWNLOAD_PATH}"
+export DOWNLOAD_PATH="download.path"
+export DOCUMENT_ROOT="${WORKING_DIRECTORY}/documentRoot"
+export DOWNLOAD_URL="file:${DOCUMENT_ROOT}/${DOWNLOAD_PATH}"
export SCRIPT_PATH="$(dirname "${0}")"
export INIT_PATH="${SCRIPT_PATH}/../init"
@@ -24,30 +24,16 @@
source "${SCRIPT_PATH}/../init.sh"
source "${SCRIPT_PATH}/test-utils.sh"
-reports="${WORKING_DIRECTORY}/tests/results-clean-nightly.txt"
+reports="$(pwd)/target/tests/results-clean-nightly.txt"
sitesToClean="$(pwd)/${SCRIPT_PATH}/data/sites-to-clean.tar.gz"
-# #zippedUpdateSiteURL="file:$(pwd)/${SCRIPT_PATH}/data/dummy-site.zip"
-# for M in "1" "2" "3"; do
-# for m in "0" "1" "2"; do
-# for u in "0" "1" "2"; do
-# for q in "A" "B" "C"; do
-# printf '"file:${UPDATE_NIGHTLY_HOME}/'"$M.$m.$u.$q"'" '
-# # ${SCRIPT_PATH}/../publish-nightly.sh "${zippedUpdateSiteURL}" "$M.$m.$u.$q"
-# done
-# printf '\\\n'
-# done
-# done
-# done
-# exit 0
-
beforeClass_this() {
# cleaning test folder
- if [ -d "${ECLIPSE_DOCUMENT_ROOT}" ]; then
- LSTEST "Removing test folder '${ECLIPSE_DOCUMENT_ROOT}'"
- rm -rf "${ECLIPSE_DOCUMENT_ROOT}"
+ if [ -d "${DOCUMENT_ROOT}" ]; then
+ LSTEST "Removing test folder '${DOCUMENT_ROOT}'"
+ rm -rf "${DOCUMENT_ROOT}"
fi
- mkdir -p "${ECLIPSE_DOCUMENT_ROOT}"
+ mkdir -p "${DOCUMENT_ROOT}"
if [ ! -d "${UPDATE_NIGHTLY_HOME}" ]; then
mkdir -p "${UPDATE_NIGHTLY_HOME}"
diff --git a/hudson-scripts/tests/test-constants.sh b/hudson-scripts/tests/test-constants.sh
new file mode 100644
index 0000000..16d631a
--- /dev/null
+++ b/hudson-scripts/tests/test-constants.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+# ====================================================================
+# Copyright (c) 2014 Obeo
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Obeo - initial API and implementation
+# ====================================================================
+
+TEST_NAME="${TEST_NAME:-missingTestName}"
+
+# Test specific constants
+export WORKING_DIRECTORY="$(pwd)/target/tests/${TEST_NAME}"
+
+export PROJECT_NAME="Test Project"
+export DOWNLOAD_PATH="download.path"
+export ECLIPSE_DOCUMENT_ROOT="${WORKING_DIRECTORY}/documentRoot"
+export DOWNLOAD_URL="file:${ECLIPSE_DOCUMENT_ROOT}/${DOWNLOAD_PATH}"
+
+export SCRIPT_PATH="$(dirname "${0}")"
+export INIT_PATH="${SCRIPT_PATH}/../init"
\ No newline at end of file
diff --git a/hudson-scripts/tests/test-git-publish.sh b/hudson-scripts/tests/test-git-publish.sh
index 25d5341..e2efa8a 100755
--- a/hudson-scripts/tests/test-git-publish.sh
+++ b/hudson-scripts/tests/test-git-publish.sh
@@ -11,7 +11,7 @@
# ====================================================================
# Test specific constants
-export WORKING_DIRECTORY="$(pwd)/target"
+export WORKING_DIRECTORY="$(pwd)/target/tests/git-publish"
export SCRIPT_PATH="$(dirname "${0}")"
export INIT_PATH="${SCRIPT_PATH}/../init"
@@ -21,9 +21,9 @@
dummyGitRepo="${SCRIPT_PATH}/data/dummy-git-repo.tar.gz"
-remotes="${WORKING_DIRECTORY}/tests/remotes"
-locals="${WORKING_DIRECTORY}/tests/locals"
-reports="${WORKING_DIRECTORY}/tests/results-git-publish.txt"
+remotes="${WORKING_DIRECTORY}/remotes"
+locals="${WORKING_DIRECTORY}/locals"
+reports="$(pwd)/target/tests/results-git-publish.txt"
beforeClass_this() {
rm -rf "${remotes}"
diff --git a/hudson-scripts/tests/test-publish-nightly.sh b/hudson-scripts/tests/test-publish-nightly.sh
index 92bd77d..dc4aada 100755
--- a/hudson-scripts/tests/test-publish-nightly.sh
+++ b/hudson-scripts/tests/test-publish-nightly.sh
@@ -11,12 +11,12 @@
# ====================================================================
# Test specific constants
-export WORKING_DIRECTORY="$(pwd)/target"
+export WORKING_DIRECTORY="$(pwd)/target/tests/publisher"
export PROJECT_NAME="Test Project"
-export DOWNLOAD_PATH="publisher"
-export ECLIPSE_DOCUMENT_ROOT="${WORKING_DIRECTORY}/tests/documentRoot"
-export DOWNLOAD_URL="file:${ECLIPSE_DOCUMENT_ROOT}/${DOWNLOAD_PATH}"
+export DOWNLOAD_PATH="download.path"
+export DOCUMENT_ROOT="${WORKING_DIRECTORY}/documentRoot"
+export DOWNLOAD_URL="file:${DOCUMENT_ROOT}/${DOWNLOAD_PATH}"
export SCRIPT_PATH="$(dirname "${0}")"
export INIT_PATH="${SCRIPT_PATH}/../init"
@@ -24,16 +24,16 @@
source "${SCRIPT_PATH}/../init.sh"
source "${SCRIPT_PATH}/test-utils.sh"
-reports="${WORKING_DIRECTORY}/tests/results-publish-nightly.txt"
+reports="$(pwd)/target/tests/results-publish-nightly.txt"
dummySite="file:$(pwd)/${SCRIPT_PATH}/data/dummy-site.zip"
beforeClass_this() {
# cleaning test folder
- if [ -d "${ECLIPSE_DOCUMENT_ROOT}" ]; then
- LSTEST "Removing test folder '${ECLIPSE_DOCUMENT_ROOT}'"
- rm -rf "${ECLIPSE_DOCUMENT_ROOT}"
+ if [ -d "${DOCUMENT_ROOT}" ]; then
+ LSTEST "Removing test folder '${DOCUMENT_ROOT}'"
+ rm -rf "${DOCUMENT_ROOT}"
fi
- mkdir -p "${ECLIPSE_DOCUMENT_ROOT}"
+ mkdir -p "${DOCUMENT_ROOT}"
if [ ! -d "${UPDATE_NIGHTLY_HOME}" ]; then
mkdir -p "${UPDATE_NIGHTLY_HOME}"