Skip to content

Commit

Permalink
Add commit hashes as parameters to the baptizer scriot
Browse files Browse the repository at this point in the history
Update build workflow to call baptizer passing the new parameters
  • Loading branch information
QU3B1M committed Oct 29, 2024
1 parent d3f33de commit d2f1785
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,12 @@ jobs:
- name: Run `baptizer.sh`
# As parameters
run: |
PLUGINS_HASH=${{ needs.build-wazuh-plugins.outputs.hash }} \
REPORTING_HASH=${{ needs.build-reporting-plugin.outputs.hash }} \
name=$(bash build-scripts/baptizer.sh \
-a ${{ matrix.architecture }} \
-d ${{ matrix.distribution }} \
-r ${{ inputs.revision }} \
-ph ${{ needs.build-wazuh-plugins.outputs.hash }} \
-rh ${{ needs.build-reporting-plugin.outputs.hash }} \
${{ inputs.is_stage && '-x' || '' }} \
)
echo "name=$name" >> $GITHUB_OUTPUT
Expand Down
12 changes: 10 additions & 2 deletions build-scripts/baptizer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ function usage() {
echo -e "-r REVISION\t[Optional] Package revision, default is '0'."
echo -e "-m MIN\t[Optional] Use naming convention for minimal packages, default is 'false'."
echo -e "-x RELEASE\t[Optional] Use release naming convention, default is 'false'."
echo -e "-ph PLUGINS_HASH\t[Optional] Commit hash from the wazuh-indexer-plugins repository"
echo -e "-rh REPORTING_HASH\t[Optional] Commit hash from the wazuh-indexer-reporting repository"
echo -e "-h help"
}

Expand All @@ -20,7 +22,7 @@ function usage() {
# ====
function parse_args() {

while getopts ":h:p:a:d:r:mx" arg; do
while getopts ":h:p:a:d:r:m:x:ph:rh" arg; do
case $arg in
h)
usage
Expand All @@ -44,6 +46,12 @@ function parse_args() {
x)
IS_RELEASE=true
;;
ph)
PLUGINS_HASH=$OPTARF
;;
rh)
REPORTING_HASH=$OPTARF
;;
:)
echo "Error: -${OPTARG} requires an argument"
usage
Expand Down Expand Up @@ -129,7 +137,7 @@ function get_devel_name() {
PREFIX="$PREFIX"-min
fi
# Generate composed commit hash
if "$PLUGINS_HASH" && "$REPORTING_HASH"; then
if [ -n "$PLUGINS_HASH" ] && [ -n "$REPORTING_HASH" ]; then
COMMIT_HASH="$GIT_COMMIT"-"$PLUGINS_HASH"-"$REPORTING_HASH"
fi
PACKAGE_NAME="$PREFIX"_"$VERSION"-"$REVISION"_"$SUFFIX"_"$COMMIT_HASH"."$EXT"
Expand Down

0 comments on commit d2f1785

Please sign in to comment.