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

Fix conditional block in build-image.sh script #917

Closed
2 tasks done
davidcr01 opened this issue Aug 2, 2023 · 2 comments · Fixed by #919
Closed
2 tasks done

Fix conditional block in build-image.sh script #917

davidcr01 opened this issue Aug 2, 2023 · 2 comments · Fixed by #919
Assignees
Labels

Comments

@davidcr01
Copy link
Contributor

davidcr01 commented Aug 2, 2023

Description

In the following file https://github.com/wazuh/wazuh-docker/blob/stable/build-docker-images/build-images.sh, there is a conditional block that apparently does nothing.

if [ "$WAZUH_VERSION" -le "$WAZUH_CURRENT_VERSION" ]; then
  IMAGE_VERSION=${WAZUH_IMAGE_VERSION}
else
  IMAGE_VERSION=${WAZUH_IMAGE_VERSION}
fi

It seems that the aim of this conditional is to use the correct image version depending on the Wazuh version. To fix this, two solutions are proposed:

  1. Delete the conditional block if this logic is unnecessary.
  2. Implement the mentioned logic.
    Is necessary to discuss which option is the best.

Tasks

If the first option is chosen, the tasks are the following:

  • Check if the images have the correct version if the Wazuh version is lower than the current version
  • Check if the images have the correct version if the Wazuh version is higher than the current version
@vcerenu
Copy link
Member

vcerenu commented Aug 2, 2023

This conditional block was created to carry out a series of actions that were cancelled. I had implemented that part of the code but after canceling the order it stayed in that place.

It would be necessary to delete all the condition black since it has no use

@wazuhci wazuhci moved this to Triage in Release 4.5.2 Aug 2, 2023
@davidcr01 davidcr01 moved this from Triage to In progress in Release 4.5.2 Aug 3, 2023
@davidcr01 davidcr01 linked a pull request Aug 3, 2023 that will close this issue
@wazuhci wazuhci moved this from In progress to In review in Release 4.5.2 Aug 3, 2023
@davidcr01
Copy link
Contributor Author

Update Report

To check if the images build is done correctly, some tests have been implemented:

✔️ Building Docker images with a version of Wazuh lower than the current version (4.4.3 - 4.4.5, current)

Step 34/37 : WORKDIR $INSTALL_DIR
 ---> Running in d17572a6261b
Removing intermediate container d17572a6261b
 ---> 4917059c11bb
Step 35/37 : USER wazuh-dashboard
 ---> Running in 868b585c559b
Removing intermediate container 868b585c559b
 ---> cd3a43e1b1c4
Step 36/37 : EXPOSE 443
 ---> Running in 30789e7c7235
Removing intermediate container 30789e7c7235
 ---> c54de904db4a
Step 37/37 : ENTRYPOINT [ "/entrypoint.sh" ]
 ---> Running in 14eac40c1f5f
Removing intermediate container 14eac40c1f5f
 ---> 1744c669cd55
Successfully built 1744c669cd55
Successfully tagged wazuh/wazuh-dashboard:4.4.3

✔️ Building Docker images with a version of Wazuh higher than the current version (4.5.0 - 4.4.5, current)

Step 34/37 : WORKDIR $INSTALL_DIR
 ---> Running in c1acb1ac783c
Removing intermediate container c1acb1ac783c
 ---> fe92590e465e
Step 35/37 : USER wazuh-dashboard
 ---> Running in a0dab7eee988
Removing intermediate container a0dab7eee988
 ---> 9e96d6c8de2e
Step 36/37 : EXPOSE 443
 ---> Running in 21e3cef68796
Removing intermediate container 21e3cef68796
 ---> 92ba3d0e1bdd
Step 37/37 : ENTRYPOINT [ "/entrypoint.sh" ]
 ---> Running in c26e0f80f838
Removing intermediate container c26e0f80f838
 ---> 6235925445e1
Successfully built 6235925445e1
Successfully tagged wazuh/wazuh-dashboard:4.5.0

@wazuhci wazuhci moved this from In review to Done in Release 4.5.2 Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
3 participants