From da638943ad7b4cc9eca8c2f14cedb45802b7c642 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Ruiz?= Date: Mon, 4 Mar 2024 13:26:32 +0100 Subject: [PATCH 01/10] Update gradle/gradle-build-action to gradle/actions/setup-gradle@v3 --- .github/workflows/r_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/r_build.yml b/.github/workflows/r_build.yml index 299eb8155f735..4c430ce113ad6 100644 --- a/.github/workflows/r_build.yml +++ b/.github/workflows/r_build.yml @@ -40,7 +40,7 @@ jobs: java-version: 11 - name: Setup Gradle - uses: gradle/gradle-build-action@v2.9.0 + uses: gradle/actions/setup-gradle@v3 - name: Run `build.sh` run: | From a85dc7dbd29d044c8e5b2f971c06db949fc0b81a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Ruiz?= Date: Mon, 4 Mar 2024 15:45:17 +0100 Subject: [PATCH 02/10] Add test workflow --- .github/workflows/build.yml | 17 ++++++++++++- .github/workflows/r_test.yml | 46 ++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/r_test.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2c05d48c4a507..04a317bb625b3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -58,9 +58,24 @@ jobs: # skip arm64 until we have arm runners - architecture: arm64 - distribution: tar - uses: ./.github/workflows/r_assemble.yml with: architecture: ${{ matrix.architecture }} distribution: ${{ matrix.distribution }} min: wazuh-indexer-min_${{ needs.version.outputs.version }}-${{ github.event_name == 'push' && '1' || inputs.revision }}-${{ matrix.architecture }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.distribution }} + + test: + needs: [version, commit_sha, assemble] + strategy: + matrix: + distribution: [tar, rpm, deb] + architecture: [x64, arm64] + exclude: + # skip arm64 until we have arm runners + - architecture: arm64 + - distribution: [tar, rpm] + uses: ./.github/workflows/r_assemble.yml + with: + architecture: ${{ matrix.architecture }} + distribution: ${{ matrix.distribution }} + package: wazuh-indexer-${{ needs.version.outputs.version }}-${{ github.event_name == 'push' && '1' || inputs.revision }}-${{ matrix.architecture }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.distribution }} diff --git a/.github/workflows/r_test.yml b/.github/workflows/r_test.yml new file mode 100644 index 0000000000000..a0b1de0797839 --- /dev/null +++ b/.github/workflows/r_test.yml @@ -0,0 +1,46 @@ +name: Test (reusable) + +# This workflow runs when any of the following occur: +# - Run from another workflow +on: + workflow_call: + inputs: + distribution: + description: "One of [ 'tar', 'rpm', 'deb' ]" + default: "rpm" + required: true + type: string + architecture: + description: "One of [ 'x64', 'arm64' ]" + default: "x64" + required: true + type: string + package: + description: "The name of the package to download." + required: true + type: string + +jobs: + r_test: + runs-on: ubuntu-latest + # Permissions to upload the package + permissions: + packages: read + contents: read + steps: + - uses: actions/checkout@v4 + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.package }} + path: artifacts/dist + + - name: Run `test.sh` + if: ${{ inputs.distribution == 'deb' }} + run: | + # bash scripts/test.sh -p artifacts/dist/${{ inputs.package }} + dpkg -i "artifacts/dist/${{ inputs.package }}"; + systemctl daemon-reload; + systemctl enable wazuh-indexer.service; + systemctl start wazuh-indexer; + systemctl status wazuh-indexer From 9e115b35b0a6c7927a8f4ab10aab157eb75cd583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Ruiz?= Date: Mon, 4 Mar 2024 15:51:25 +0100 Subject: [PATCH 03/10] Fix test step --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 04a317bb625b3..bc93ade71e57c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -74,7 +74,7 @@ jobs: # skip arm64 until we have arm runners - architecture: arm64 - distribution: [tar, rpm] - uses: ./.github/workflows/r_assemble.yml + uses: ./.github/workflows/r_test.yml with: architecture: ${{ matrix.architecture }} distribution: ${{ matrix.distribution }} From be846a7d02a526a210f9ea550e7d6cd7d641619c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Ruiz?= Date: Mon, 4 Mar 2024 15:57:44 +0100 Subject: [PATCH 04/10] Update build.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix indentation Signed-off-by: Álex Ruiz --- .github/workflows/build.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bc93ade71e57c..ce16d90e8ecf2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -71,11 +71,12 @@ jobs: distribution: [tar, rpm, deb] architecture: [x64, arm64] exclude: - # skip arm64 until we have arm runners + # Only DEB packages can be tested on GitHub runners (ubuntu) - architecture: arm64 - - distribution: [tar, rpm] - uses: ./.github/workflows/r_test.yml - with: - architecture: ${{ matrix.architecture }} - distribution: ${{ matrix.distribution }} - package: wazuh-indexer-${{ needs.version.outputs.version }}-${{ github.event_name == 'push' && '1' || inputs.revision }}-${{ matrix.architecture }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.distribution }} + - distribution: tar + - distribution: rpm + uses: ./.github/workflows/r_test.yml + with: + architecture: ${{ matrix.architecture }} + distribution: ${{ matrix.distribution }} + package: wazuh-indexer-${{ needs.version.outputs.version }}-${{ github.event_name == 'push' && '1' || inputs.revision }}-${{ matrix.architecture }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.distribution }} From bfbaff359c840d3b53853d731380311e4374b7dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Ruiz?= Date: Mon, 4 Mar 2024 15:58:23 +0100 Subject: [PATCH 05/10] Remove unused code --- .github/workflows/r_test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/r_test.yml b/.github/workflows/r_test.yml index a0b1de0797839..9a47b0475ceee 100644 --- a/.github/workflows/r_test.yml +++ b/.github/workflows/r_test.yml @@ -36,9 +36,7 @@ jobs: path: artifacts/dist - name: Run `test.sh` - if: ${{ inputs.distribution == 'deb' }} run: | - # bash scripts/test.sh -p artifacts/dist/${{ inputs.package }} dpkg -i "artifacts/dist/${{ inputs.package }}"; systemctl daemon-reload; systemctl enable wazuh-indexer.service; From f6ba7e9115caa5ab082dc77d58e848978946348f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Ruiz?= Date: Tue, 5 Mar 2024 19:37:09 +0100 Subject: [PATCH 06/10] Add -D (dry) option to the packaging scripts to return the generate package name --- .github/workflows/r_test.yml | 8 +- VERSION | 2 +- scripts/assemble.sh | 25 ++++-- scripts/build.sh | 116 ++++++++++++++---------- scripts/test-ci.sh | 72 +++++++++++++++ scripts/test.sh | 169 +++++++++++++++++++++++++++++++++++ 6 files changed, 336 insertions(+), 56 deletions(-) create mode 100644 scripts/test-ci.sh create mode 100755 scripts/test.sh diff --git a/.github/workflows/r_test.yml b/.github/workflows/r_test.yml index 9a47b0475ceee..198af8ab6704d 100644 --- a/.github/workflows/r_test.yml +++ b/.github/workflows/r_test.yml @@ -29,10 +29,16 @@ jobs: contents: read steps: - uses: actions/checkout@v4 + + - name: Run `assemble.sh` to get the package name + id: get_package_name + run: | + echo "name=$(bash scripts/assemble.sh -v ${{ vars.OPENSEARCH_VERSION }} -p linux -a ${{ inputs.architecture }} -d ${{ inputs.distribution }} -D)" >> $GITHUB_OUTPUT + - name: Download artifact uses: actions/download-artifact@v4 with: - name: ${{ inputs.package }} + name: ${{ steps.get_package_name.outputs.name }} path: artifacts/dist - name: Run `test.sh` diff --git a/VERSION b/VERSION index b617d997d7701..3393a2221ebe5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.9.0 \ No newline at end of file +4.9.0-1 \ No newline at end of file diff --git a/scripts/assemble.sh b/scripts/assemble.sh index 64e82ccd52046..6fc4d1b19025a 100755 --- a/scripts/assemble.sh +++ b/scripts/assemble.sh @@ -7,7 +7,7 @@ # this file be licensed under the Apache-2.0 license or a # compatible open source license. -set -ex +# set -ex ### The $TEST variable determines whether we include a minimalistic ### or the full set of OpenSearch plugins @@ -54,6 +54,7 @@ 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 "-o OUTPUT\t[Optional] Output path, default is 'artifacts'." + echo -e "-D DRY\t[Optional] Output artifact name. Autogenerated." echo -e "-h help" } @@ -62,7 +63,7 @@ function usage() { # ==== function parse_args() { - while getopts ":h:v:o:p:a:d:" arg; do + while getopts ":hv:o:p:a:d:D" arg; do case $arg in h) usage @@ -83,6 +84,12 @@ function parse_args() { d) DISTRIBUTION=$OPTARG ;; + D) + # Return the name of the package to be generated when no folder is provided with -o + # This is useful in GH Actions to get the package name to download / upload in each + # of the CI steps. + DRY=true + ;; :) echo "Error: -${OPTARG} requires an argument" usage @@ -377,12 +384,20 @@ function assemble_deb() { function main() { parse_args "${@}" - echo "Assembling wazuh-indexer for $PLATFORM-$DISTRIBUTION-$ARCHITECTURE" - ARTIFACT_BUILD_NAME=$(ls "${OUTPUT}/dist/" | grep "wazuh-indexer-min_.*$SUFFIX.*\.$EXT") + # ARTIFACT_PACKAGE_NAME=${ARTIFACT_BUILD_NAME/min_/} - ARTIFACT_PACKAGE_NAME=${ARTIFACT_BUILD_NAME/min_/} + GIT_COMMIT=$(git rev-parse --short HEAD) + WI_VERSION=$("$OUTPUT/artifact_min_name.txt" diff --git a/scripts/test-ci.sh b/scripts/test-ci.sh new file mode 100644 index 0000000000000..d4a458114974d --- /dev/null +++ b/scripts/test-ci.sh @@ -0,0 +1,72 @@ +#!/bin/bash + + +# CI tests + +GIT_COMMIT=$(git rev-parse --short HEAD) +WI_VERSION=$( Date: Tue, 5 Mar 2024 19:39:18 +0100 Subject: [PATCH 07/10] Remove revision parameter --- .github/workflows/r_build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/r_build.yml b/.github/workflows/r_build.yml index 4c430ce113ad6..1a5f4c6de83db 100644 --- a/.github/workflows/r_build.yml +++ b/.github/workflows/r_build.yml @@ -15,7 +15,7 @@ on: default: "x64" required: true type: string - revision: + revision: # TODO remove if it works description: "Any string or number used to extend the package's identifier." type: string required: true @@ -44,7 +44,7 @@ jobs: - name: Run `build.sh` run: | - bash scripts/build.sh -v ${{ vars.OPENSEARCH_VERSION }} -s false -p linux -a ${{ inputs.architecture }} -d ${{ inputs.distribution }} -r ${{ inputs.revision }} + bash scripts/build.sh -v ${{ vars.OPENSEARCH_VERSION }} -s false -p linux -a ${{ inputs.architecture }} -d ${{ inputs.distribution }} # The package's name is stored in artifacts/artifact_min_name.txt. - name: Set package name From 85639b99f7487e14fb66f012c8aca1c6208222f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Ruiz?= Date: Wed, 6 Mar 2024 12:50:56 +0100 Subject: [PATCH 08/10] Add revision number as file --- .github/workflows/r_version.yml | 7 ++++- REVISION | 1 + VERSION | 2 +- .../packages/src/deb/debmake_install.sh | 1 + .../packages/src/rpm/wazuh-indexer.rpm.spec | 2 ++ docker/ci/ci.sh | 4 ++- docker/ci/ci.yml | 8 ++--- docker/dev/dev.sh | 4 ++- docker/dev/dev.yml | 4 +-- scripts/README.md | 6 ++-- scripts/assemble.sh | 31 ++++++++++--------- scripts/build.sh | 11 ++++--- scripts/test-ci.sh | 9 +++--- 13 files changed, 53 insertions(+), 37 deletions(-) create mode 100644 REVISION diff --git a/.github/workflows/r_version.yml b/.github/workflows/r_version.yml index d3c01135a6c35..723a84611ed61 100644 --- a/.github/workflows/r_version.yml +++ b/.github/workflows/r_version.yml @@ -8,15 +8,20 @@ on: version: description: "Returns the version of Wazuh" value: ${{ jobs.r_version.outputs.version }} + revision: + description: "Returns the revision of Wazuh" + value: ${{ jobs.r_version.outputs.revision }} jobs: r_version: runs-on: ubuntu-latest outputs: version: ${{ steps.get_version.outputs.version }} + revision: ${{ steps.get_version.outputs.revision }} steps: - uses: actions/checkout@v4 - name: Read 'VERSION' id: get_version run: | - echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT + echo "version=$(> $GITHUB_OUTPUT + echo "revision=$(> $GITHUB_OUTPUT diff --git a/REVISION b/REVISION new file mode 100644 index 0000000000000..56a6051ca2b02 --- /dev/null +++ b/REVISION @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/VERSION b/VERSION index 3393a2221ebe5..b617d997d7701 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.9.0-1 \ No newline at end of file +4.9.0 \ No newline at end of file diff --git a/distribution/packages/src/deb/debmake_install.sh b/distribution/packages/src/deb/debmake_install.sh index 74064f87620e6..602eebc256810 100644 --- a/distribution/packages/src/deb/debmake_install.sh +++ b/distribution/packages/src/deb/debmake_install.sh @@ -75,6 +75,7 @@ fi # Files that need other permissions chmod -c 440 "${buildroot}${product_dir}/VERSION" +chmod -c 440 "${buildroot}${product_dir}/REVISION" if [ -d "${buildroot}${product_dir}/plugins/opensearch-security" ]; then chmod -c 0740 "${buildroot}${product_dir}"/plugins/opensearch-security/tools/*.sh fi diff --git a/distribution/packages/src/rpm/wazuh-indexer.rpm.spec b/distribution/packages/src/rpm/wazuh-indexer.rpm.spec index b81d6a91ecb97..8de47603bd3be 100644 --- a/distribution/packages/src/rpm/wazuh-indexer.rpm.spec +++ b/distribution/packages/src/rpm/wazuh-indexer.rpm.spec @@ -117,6 +117,7 @@ set -- "$@" "%{config_dir}/jvm.options" set -- "$@" "%{config_dir}/opensearch.yml" set -- "$@" "%{config_dir}/wazuh-template.json" set -- "$@" "%{product_dir}/VERSION" +set -- "$@" "%{product_dir}/REVISION" set -- "$@" "%{product_dir}/plugins/opensearch-security/tools/.*\.sh" set -- "$@" "%{product_dir}/bin/.*" set -- "$@" "%{product_dir}/jdk/bin/.*" @@ -254,6 +255,7 @@ exit 0 # Files that need other permissions %attr(440, %{name}, %{name}) %{product_dir}/VERSION +%attr(440, %{name}, %{name}) %{product_dir}/REVISION %attr(740, %{name}, %{name}) %{product_dir}/plugins/opensearch-security/tools/*.sh %attr(750, %{name}, %{name}) %{product_dir}/bin/* %attr(750, %{name}, %{name}) %{product_dir}/jdk/bin/* diff --git a/docker/ci/ci.sh b/docker/ci/ci.sh index 13e84c0881b3f..5a2c5e9c6b51e 100755 --- a/docker/ci/ci.sh +++ b/docker/ci/ci.sh @@ -36,9 +36,11 @@ function main() { compose_file="docker/${current}/ci.yml" compose_cmd="docker compose -f $compose_file" REPO_PATH=$(pwd) - VERSION=$(cat VERSION) + VERSION=$("${OUTPUT}/artifact_name.txt" + echo "${ARTIFACT_NAME}" >"${OUTPUT}/artifact_name.txt" } # ==== @@ -250,8 +250,8 @@ function assemble_tar() { PATH_PLUGINS="./plugins" # Extract - echo "Extract ${ARTIFACT_BUILD_NAME} archive" - tar -zvxf "${ARTIFACT_BUILD_NAME}" + echo "Extract ${BUILD_ARTIFACT_NAME} archive" + tar -zvxf "${BUILD_ARTIFACT_NAME}" cd "$(ls -d wazuh-indexer-*/)" local version @@ -269,7 +269,7 @@ function assemble_tar() { cd .. tar -cvf "${archive_name}-${SUFFIX}.${EXT}" "${archive_name}" cd ../../.. - cp "${TMP_DIR}/${archive_name}-${SUFFIX}.${EXT}" "${OUTPUT}/dist/$ARTIFACT_PACKAGE_NAME" + cp "${TMP_DIR}/${archive_name}-${SUFFIX}.${EXT}" "${OUTPUT}/dist/$ARTIFACT_NAME" clean } @@ -290,8 +290,8 @@ function assemble_rpm() { PATH_PLUGINS="${src_path}/plugins" # Extract min-package. Creates usr/, etc/ and var/ in the current directory - echo "Extract ${ARTIFACT_BUILD_NAME} archive" - rpm2cpio "${ARTIFACT_BUILD_NAME}" | cpio -imdv + echo "Extract ${BUILD_ARTIFACT_NAME} archive" + rpm2cpio "${BUILD_ARTIFACT_NAME}" | cpio -imdv local version version=$(cat ./usr/share/wazuh-indexer/VERSION) @@ -317,7 +317,7 @@ function assemble_rpm() { # Move to the root folder, copy the package and clean. cd ../../.. package_name="wazuh-indexer-${version}-1.${SUFFIX}.${EXT}" - cp "${TMP_DIR}/RPMS/${SUFFIX}/${package_name}" "${OUTPUT}/dist/$ARTIFACT_PACKAGE_NAME" + cp "${TMP_DIR}/RPMS/${SUFFIX}/${package_name}" "${OUTPUT}/dist/$ARTIFACT_NAME" clean } @@ -341,8 +341,8 @@ function assemble_deb() { PATH_PLUGINS="${src_path}/plugins" # Extract min-package. Creates usr/, etc/ and var/ in the current directory - echo "Extract ${ARTIFACT_BUILD_NAME} archive" - ar xf "${ARTIFACT_BUILD_NAME}" data.tar.gz + echo "Extract ${BUILD_ARTIFACT_NAME} archive" + ar xf "${BUILD_ARTIFACT_NAME}" data.tar.gz tar zvxf data.tar.gz local version @@ -373,7 +373,7 @@ function assemble_deb() { cd ../../.. package_name="wazuh-indexer_${version}_${SUFFIX}.${EXT}" # debmake creates the package one level above - cp "${TMP_DIR}/../${package_name}" "${OUTPUT}/dist/$ARTIFACT_PACKAGE_NAME" + cp "${TMP_DIR}/../${package_name}" "${OUTPUT}/dist/$ARTIFACT_NAME" clean } @@ -384,16 +384,17 @@ function assemble_deb() { function main() { parse_args "${@}" - ARTIFACT_BUILD_NAME=$(ls "${OUTPUT}/dist/" | grep "wazuh-indexer-min_.*$SUFFIX.*\.$EXT") - # ARTIFACT_PACKAGE_NAME=${ARTIFACT_BUILD_NAME/min_/} + BUILD_ARTIFACT_NAME=$(ls "${OUTPUT}/dist/" | grep "wazuh-indexer-min_.*$SUFFIX.*\.$EXT") + # ARTIFACT_NAME=${BUILD_ARTIFACT_NAME/min_/} GIT_COMMIT=$(git rev-parse --short HEAD) WI_VERSION=$("$OUTPUT/artifact_min_name.txt" +echo "$ARTIFACT_NAME" >"$OUTPUT/artifact_min_name.txt" mkdir -p "${OUTPUT}/dist" -cp "distribution/$TYPE/$TARGET/build/distributions/$ARTIFACT_BUILD_NAME" "${OUTPUT}/dist/$ARTIFACT_PACKAGE_NAME" +cp "distribution/$TYPE/$TARGET/build/distributions/$BUILD_ARTIFACT_NAME" "${OUTPUT}/dist/$ARTIFACT_NAME" diff --git a/scripts/test-ci.sh b/scripts/test-ci.sh index d4a458114974d..86222ac355185 100644 --- a/scripts/test-ci.sh +++ b/scripts/test-ci.sh @@ -5,6 +5,7 @@ GIT_COMMIT=$(git rev-parse --short HEAD) WI_VERSION=$( Date: Wed, 6 Mar 2024 13:14:28 +0100 Subject: [PATCH 09/10] Add revision as file to min packages --- distribution/archives/build.gradle | 4 ++++ distribution/build.gradle | 7 +++++++ distribution/packages/build.gradle | 5 +++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/distribution/archives/build.gradle b/distribution/archives/build.gradle index a4c95e64b7b2c..bb09e6648426c 100644 --- a/distribution/archives/build.gradle +++ b/distribution/archives/build.gradle @@ -34,6 +34,7 @@ apply plugin: 'opensearch.internal-distribution-archive-setup' CopySpec archiveFiles(CopySpec modulesFiles, String distributionType, String platform, String architecture, JavaPackageType java) { version = rootProject.file('VERSION').getText() + revision = rootProject.file('REVISION').getText() return copySpec { into("wazuh-indexer-${version}") { into('lib') { @@ -75,6 +76,9 @@ CopySpec archiveFiles(CopySpec modulesFiles, String distributionType, String pla into('') { with versionFile() } + into('') { + with revisionFile() + } from(rootProject.projectDir) { include 'README.md' } diff --git a/distribution/build.gradle b/distribution/build.gradle index 8a2bd5b2a56a3..2a4ed5c8d2a76 100644 --- a/distribution/build.gradle +++ b/distribution/build.gradle @@ -364,6 +364,13 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) { } } + revisionFile = { + copySpec { + from(rootProject.file('REVISION')) + fileMode 0644 + } + } + modulesFiles = { platform -> copySpec { eachFile { diff --git a/distribution/packages/build.gradle b/distribution/packages/build.gradle index b99eebea6c660..49dd3c2058eb3 100644 --- a/distribution/packages/build.gradle +++ b/distribution/packages/build.gradle @@ -107,6 +107,7 @@ addProcessFilesTask('rpm', false) // is the same Closure commonPackageConfig(String type, boolean jdk, String architecture) { project.version = rootProject.file('VERSION').getText() + project.revision = rootProject.file('REVISION').getText() return { onlyIf { OS.current().equals(OS.WINDOWS) == false @@ -137,9 +138,9 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) { // SystemPackagingTask overrides default archive task convention mappings, but doesn't provide a setter so we have to override the convention mapping itself // Deb convention uses a '_' for final separator before architecture, rpm uses a '.' if (type == 'deb') { - archiveFileName.value(project.provider({ "${destinationDirectory.get()}/${packageName}-min_${project.version}${jdkString}_${archString}.${type}" })) + archiveFileName.value(project.provider({ "${destinationDirectory.get()}/${packageName}-min_${project.version}-${project.revision}${jdkString}_${archString}.${type}" })) } else { - archiveFileName.value(project.provider({ "${destinationDirectory.get()}/${packageName}-min-${project.version}${jdkString}.${archString}.${type}" })) + archiveFileName.value(project.provider({ "${destinationDirectory.get()}/${packageName}-min-${project.version}-${project.revision}${jdkString}.${archString}.${type}" })) } String packagingFiles = "build/packaging/${jdk ? '' : 'no-jdk-'}${type}" From cf7125c68e267b8aaefa973bac5af4759c62c070 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Ruiz?= Date: Wed, 6 Mar 2024 13:26:09 +0100 Subject: [PATCH 10/10] Add revision as Gradle project property --- distribution/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/distribution/build.gradle b/distribution/build.gradle index 2a4ed5c8d2a76..3c33d123e68c1 100644 --- a/distribution/build.gradle +++ b/distribution/build.gradle @@ -570,6 +570,7 @@ subprojects { Map expansions = [ 'project.name': project.name, 'project.version': version, + 'project.revision': revision, 'path.conf': [ 'deb': '/etc/wazuh-indexer',