Skip to content

Conversation

@quaresmajose
Copy link
Member

Because we run the script with set -e
Any return value other than 0 causes the process to abort.

Using the operator && causes the script to abort because when the command fails there is no path to follow.
If we use the if clause operator we solve the problem.

@quaresmajose quaresmajose marked this pull request as ready for review November 15, 2024 16:28
@quaresmajose quaresmajose requested review from a team November 15, 2024 16:28
_repo_extra_args=""
for i in $(seq 4); do
run repo init $_repo_extra_args --repo-rev=v2.35 --no-clone-bundle -u $* ${REPO_INIT_OVERRIDES} && break
if run repo init $_repo_extra_args --repo-rev=v2.35 --no-clone-bundle -u $* ${REPO_INIT_OVERRIDES}; then
Copy link
Contributor

@MrCry0 MrCry0 Nov 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is another way to always return true in such commands:
run repo init $_repo_extra_args --repo-rev=v2.35 --no-clone-bundle -u $* ${REPO_INIT_OVERRIDES} && break || true

@quaresmajose What do you think about this way?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using if for this looks better to me and is more clean

Because we run the script with set -e
Any return value other than 0 causes the process to abort.

Using the operator && causes the script to abort because when
the command fails there is no path to follow.
If we use the if clause operator we solve the problem.

Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
@doanac doanac merged commit 89af5c9 into foundriesio:master Nov 19, 2024
1 check passed
@quaresmajose quaresmajose deleted the repo branch November 19, 2024 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants