Skip to content

Commit

Permalink
Update baptizer to receive the repositories hashes by parameter
Browse files Browse the repository at this point in the history
Update build GHA to send hashes by parameters to the baptizer script
  • Loading branch information
QU3B1M committed Oct 29, 2024
1 parent d3f33de commit c76d778
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ jobs:
-a ${{ matrix.architecture }} \
-d ${{ matrix.distribution }} \
-r ${{ inputs.revision }} \
-l ${{ needs.build-wazuh-plugins.outputs.hash }} \
-e ${{ needs.build-reporting-plugin.outputs.hash }} \
${{ inputs.is_stage && '-x' || '' }} \
)
echo "name=$name" >> $GITHUB_OUTPUT
Expand All @@ -253,12 +255,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 }} \
-l ${{ needs.build-wazuh-plugins.outputs.hash }} \
-e ${{ 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 @@ -10,6 +10,8 @@ function usage() {
echo -e "-a ARCHITECTURE\t[Optional] Build architecture, default is 'uname -m'."
echo -e "-d DISTRIBUTION\t[Optional] Distribution, default is 'tar'."
echo -e "-r REVISION\t[Optional] Package revision, default is '0'."
echo -e "-l PLUGINS_HASH\t[Optional] Commit hash from the wazuh-indexer-plugins repository"
echo -e "-e REPORTING_HASH\t[Optional] Commit hash from the wazuh-indexer-reporting repository"
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 "-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:l:e:mx" arg; do
case $arg in
h)
usage
Expand All @@ -38,6 +40,12 @@ function parse_args() {
r)
REVISION=$OPTARG
;;
l)
PLUGINS_HASH=$OPTARG
;;
e)
REPORTING_HASH=$OPTARG
;;
m)
IS_MIN=true
;;
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 c76d778

Please sign in to comment.