Skip to content

Commit

Permalink
Save plugins and reporting repo hashes on workflow variable and updat…
Browse files Browse the repository at this point in the history
…e baptizer script to use it on package naming
  • Loading branch information
QU3B1M committed Oct 29, 2024
1 parent 3ab51a8 commit 8b12a41
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ jobs:
- run: ls -lR build/distributions
working-directory: ./plugins/${{ matrix.plugins }}

- name: Save commit hash
run: echo "plugins_hash=$(git rev-parse --short HEAD) >> "$GITHUB_OUTPUT"

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -186,6 +189,9 @@ jobs:

- run: ls -lR build/distributions

- name: Save commit hash
run: echo "reporting_hash=$(git rev-parse --short HEAD) >> "$GITHUB_OUTPUT"

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -240,6 +246,8 @@ jobs:

- name: Run `baptizer.sh`
run: |
PLUGINS_HASH=${{ steps.build-wazuh-plugins.outputs.plugins_hash }} \
REPORTING_HASH=${{ steps.build-reporting-plugin.outputs.reporting_hash }} \
name=$(bash build-scripts/baptizer.sh \
-a ${{ matrix.architecture }} \
-d ${{ matrix.distribution }} \
Expand Down
12 changes: 9 additions & 3 deletions build-scripts/baptizer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,17 @@ function get_release_name() {
# Naming convention for pre-release packages
# ====
function get_devel_name() {
PREFIX=wazuh-indexer
COMMIT_HASH=$GIT_COMMIT
# Add -min to the prefix if corresponds
if "$IS_MIN"; then
PACKAGE_NAME=wazuh-indexer-min_"$VERSION"-"$REVISION"_"$SUFFIX"_"$GIT_COMMIT"."$EXT"
else
PACKAGE_NAME=wazuh-indexer_"$VERSION"-"$REVISION"_"$SUFFIX"_"$GIT_COMMIT"."$EXT"
PREFIX="$PREFIX"-min
fi
# Generate composed commit hash
if "$PLUGINS_HASH" && "$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 8b12a41

Please sign in to comment.