Skip to content

Commit

Permalink
Add script to get the version of OpenSearch
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexRuiz7 committed Mar 20, 2024
1 parent 0958ec3 commit 2905dbe
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 11 deletions.
40 changes: 40 additions & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,43 @@ Pre-requisites:
```console
docker exec -it wi-assemble_$(<VERSION) bash scripts/assemble.sh -v 2.11.1 -p linux -a x64 -d rpm
```

### Bash scripts reference

The packages' generation process is guided through bash scripts. This section list and describes
them, as well as their inputs and outputs.


```yml

packages:
- file: build.sh
description: run the appropiate Gradle task depending on the parameters.
params:
- distribution: [tar, deb, rpm]
- revision: revision number. 0 by default.
# - architecture: currently we only build x86_64
outputs:
- package: minimal wazuh-indexer package for the required distribution.
- file: assemble.sh
description: assembles a minimal wazuh-indexer package with plugins, settings and demo certificates (not yet).
params:
- package: the minimal package to assemble.
- distribution: [tar, deb, rpm]
- revision: revision number. 0 by default.
# - opensearch_version: can be obtained from the source code
# - architecture: currently we only build x86_64
outputs:
- package: wazuh-indexer package.
- file: provision.sh
description: Provision script for assembly of DEB packages.
- file: baptizer.sh
description: generate the wazuh-indexer package name depending on the parameters.
params:
- distribution: [tar, deb, rpm]
- revision: revision number. 0 by default.
- is_release: set to 1 to generate the name of a release package. 0 by default.
- is_min: set to 1 to generate the name of a minimal package. Incompatible with is_realease. 0 by default.
outputs:
- package: the name of the wazuh-indexer package.
```
12 changes: 1 addition & 11 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ function usage() {
echo "Usage: $0 [args]"
echo ""
echo "Arguments:"
echo -e "-v VERSION\t[Required] OpenSearch version."
echo -e "-q QUALIFIER\t[Optional] Version qualifier."
echo -e "-s SNAPSHOT\t[Optional] Build a snapshot, default is 'false'."
echo -e "-p PLATFORM\t[Optional] Platform, default is 'uname -s'."
Expand All @@ -24,15 +23,12 @@ function usage() {
echo -e "-h help"
}

while getopts ":h:v:q:s:o:p:a:d:r:b:" arg; do
while getopts ":h:q:s:o:p:a:d:r:b:" arg; do
case $arg in
h)
usage
exit 1
;;
v)
VERSION=$OPTARG
;;
q)
QUALIFIER=$OPTARG
;;
Expand Down Expand Up @@ -69,12 +65,6 @@ while getopts ":h:v:q:s:o:p:a:d:r:b:" arg; do
esac
done

if [ -z "$VERSION" ]; then
echo "Error: You must specify the OpenSearch version"
usage
exit 1
fi

[ -z "$OUTPUT" ] && OUTPUT=artifacts

echo "Creating output directory $OUTPUT/maven/org/opensearch if it doesn't already exist"
Expand Down
6 changes: 6 additions & 0 deletions scripts/upstream_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash


set -e

< buildSrc/version.properties grep opensearch | grep -Eo '[0-9]{1,}.[0-9]{1,}.[0-9]{1,}'

0 comments on commit 2905dbe

Please sign in to comment.