Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong condition when generating the RPM Wazuh indexer package with an existent base file #2522

Closed
2 tasks done
rauldpm opened this issue Oct 11, 2023 · 2 comments · Fixed by #2523
Closed
2 tasks done
Assignees
Labels
level/task Subtask issue type/bug Bug issue

Comments

@rauldpm
Copy link
Member

rauldpm commented Oct 11, 2023

Description

During the development of the issue #2402 it has been found that when creating the RPM package without wanting to create the base file, the Wazuh version is not being correctly obtained

╰─➤  bash build_package.sh -b no       
+ build
+ build_name=
+ file_path=
+ '[' x86_64 = x86_64 ']'
+ architecture=x86_64
+ build_name=rpm_indexer_builder_x86
+ file_path=/wazuh-packages/tags/stack/indexer/rpm/docker/x86_64
+ build_rpm rpm_indexer_builder_x86 /wazuh-packages/tags/stack/indexer/rpm/docker/x86_64
+ container_name=rpm_indexer_builder_x86
+ dockerfile_path=/wazuh-packages/tags/stack/indexer/rpm/docker/x86_64
+ cp /wazuh-packages/tags/stack/indexer/rpm/builder.sh /wazuh-packages/tags/stack/indexer/rpm/docker/x86_64
+ '[' no == yes ']'
+ '[' '' ']'
++ curl -sL https://raw.githubusercontent.com/wazuh/wazuh-packages//VERSION
++ cat
+ version='400: Invalid request'
+ basefile='/wazuh-packages/tags/stack/indexer/rpm/output/wazuh-indexer-base-400: Invalid request-1-linux-x64.tar.xz'
+ test -f '/wazuh-packages/tags/stack/indexer/rpm/output/wazuh-indexer-base-400: Invalid request-1-linux-x64.tar.xz'
+ echo 'Did not find expected Wazuh indexer base file: /wazuh-packages/tags/stack/indexer/rpm/output/wazuh-indexer-base-400: Invalid request-1-linux-x64.tar.xz in output path. Exiting...'
Did not find expected Wazuh indexer base file: /wazuh-packages/tags/stack/indexer/rpm/output/wazuh-indexer-base-400: Invalid request-1-linux-x64.tar.xz in output path. Exiting...
+ exit 1

This is due to an erroneous negation in the following condition

if ! [ "${reference}" ];then

Tasks

  • Remove the negation from the condition

Validation

  • The base file is found by using the -b no parameter
@rauldpm rauldpm added the type/bug Bug issue label Oct 11, 2023
@rauldpm rauldpm self-assigned this Oct 11, 2023
@rauldpm
Copy link
Member Author

rauldpm commented Oct 11, 2023

Update report

  • Removing the negation the base is looked for using the correct version
╰─➤  bash build_package.sh -b no          
+ build
+ build_name=
+ file_path=
+ '[' x86_64 = x86_64 ']'
+ architecture=x86_64
+ build_name=rpm_indexer_builder_x86
+ file_path=/wazuh-packages/tags/stack/indexer/rpm/docker/x86_64
+ build_rpm rpm_indexer_builder_x86 /wazuh-packages/tags/stack/indexer/rpm/docker/x86_64
+ container_name=rpm_indexer_builder_x86
+ dockerfile_path=/wazuh-packages/tags/stack/indexer/rpm/docker/x86_64
+ cp /wazuh-packages/tags/stack/indexer/rpm/builder.sh /wazuh-packages/tags/stack/indexer/rpm/docker/x86_64
+ '[' no == yes ']'
+ '[' '' ']'
++ cat /wazuh-packages/tags/stack/indexer/rpm/../../../VERSION
+ version=4.7.0
+ basefile=/wazuh-packages/tags/stack/indexer/rpm/output/wazuh-indexer-base-4.7.0-1-linux-x64.tar.xz
+ test -f /wazuh-packages/tags/stack/indexer/rpm/output/wazuh-indexer-base-4.7.0-1-linux-x64.tar.xz
+ echo 'Did not find expected Wazuh indexer base file: /wazuh-packages/tags/stack/indexer/rpm/output/wazuh-indexer-base-4.7.0-1-linux-x64.tar.xz in output path. Exiting...'
Did not find expected Wazuh indexer base file: /wazuh-packages/tags/stack/indexer/rpm/output/wazuh-indexer-base-4.7.0-1-linux-x64.tar.xz in output path. Exiting...
+ exit 1

@rauldpm rauldpm linked a pull request Oct 11, 2023 that will close this issue
@wazuhci wazuhci moved this to In review in Release 4.7.0 Oct 11, 2023
@wazuhci wazuhci moved this from In review to Pending final review in Release 4.7.0 Oct 11, 2023
@davidjiglesias davidjiglesias added the level/task Subtask issue label Oct 13, 2023
@davidjiglesias
Copy link
Member

LGTM!

@wazuhci wazuhci moved this from Pending final review to Done in Release 4.7.0 Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
level/task Subtask issue type/bug Bug issue
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants