Skip to content

Commit

Permalink
Merge pull request #1698 from wazuh/CustomOutputPath-to4.3
Browse files Browse the repository at this point in the history
Add custom path for indexer packages to 4.3
  • Loading branch information
okynos authored Jun 28, 2022
2 parents e489427 + 72af640 commit cd33804
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
9 changes: 9 additions & 0 deletions stack/indexer/base/generate_base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ help() {
echo
echo "Usage: $0 [OPTIONS]"
echo
echo " -s, --store <path> [Optional] Set the destination path of package. By default, an output folder will be created."
echo " --version <version> [Optional] OpenSearch version, by default ${opensearch_version}"
echo " --reference <ref> [Optional] wazuh-packages branch or tag"
echo " --future [Optional] Build test future package 99.99.0 Used for development purposes."
Expand All @@ -85,6 +86,14 @@ main() {
"-h"|"--help")
help 0
;;
"-s"|"--store")
if [ -n "${2}" ]; then
outdir="${2}"
shift 2
else
help 1
fi
;;
"--version")
if [ -n "${2}" ]; then
opensearch_version="${2}"
Expand Down
12 changes: 11 additions & 1 deletion stack/indexer/deb/build_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ deb_amd64_builder="deb_indexer_builder_amd64"
deb_builder_dockerfile="${current_path}/docker"
future="no"
base="s3"
base_path="${current_path}/../base/output"

trap ctrl_c INT

Expand Down Expand Up @@ -54,7 +55,7 @@ build_deb() {
${future} ${base} ${reference} || return 1
else
if [ "${base}" = "local" ];then
volumes="${volumes} -v ${current_path}/../base/output:/root/output:Z"
volumes="${volumes} -v ${base_path}:/root/output:Z"
fi
docker run -t --rm ${volumes} \
-v ${current_path}/../../..:/root:Z \
Expand Down Expand Up @@ -94,6 +95,7 @@ help() {
echo " --dont-build-docker [Optional] Locally built docker image will be used instead of generating a new one."
echo " --future [Optional] Build test future package 99.99.0 Used for development purposes."
echo " --base <s3/local> [Optional] Base file location, use local or s3, default: s3"
echo " --base-path [Optional] If base is local, you can indicate the full path where the base is located, default: stack/indexer/base/output"
echo " -h, --help Show this help."
echo
exit $1
Expand Down Expand Up @@ -147,6 +149,14 @@ main() {
help 1
fi
;;
"--base-path")
if [ -n "${2}" ]; then
base_path="${2}"
shift 2
else
help 1
fi
;;
"-s"|"--store")
if [ -n "${2}" ]; then
outdir="${2}"
Expand Down
12 changes: 11 additions & 1 deletion stack/indexer/rpm/build_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ rpm_x86_builder="rpm_indexer_builder_x86"
rpm_builder_dockerfile="${current_path}/docker"
future="no"
base="s3"
base_path="${current_path}/../base/output"

trap ctrl_c INT

Expand Down Expand Up @@ -55,7 +56,7 @@ build_rpm() {
${future} ${base} ${reference} || return 1
else
if [ "${base}" = "local" ];then
volumes="${volumes} -v ${current_path}/../base/output:/root/output:Z"
volumes="${volumes} -v ${base_path}:/root/output:Z"
fi
docker run -t --rm ${volumes} \
-v ${current_path}/../../..:/root:Z \
Expand Down Expand Up @@ -95,6 +96,7 @@ help() {
echo " --dont-build-docker [Optional] Locally built docker image will be used instead of generating a new one."
echo " --future [Optional] Build test future package 99.99.0 Used for development purposes."
echo " --base <s3/local> [Optional] Base file location, use local or s3, default: s3"
echo " --base-path [Optional] If base is local, you can indicate the full path where the base is located, default: stack/indexer/base/output"
echo " -h, --help Show this help."
echo
exit $1
Expand Down Expand Up @@ -148,6 +150,14 @@ main() {
help 1
fi
;;
"--base-path")
if [ -n "${2}" ]; then
base_path="${2}"
shift 2
else
help 1
fi
;;
"-s"|"--store")
if [ -n "$2" ]; then
outdir="$2"
Expand Down

0 comments on commit cd33804

Please sign in to comment.