upgrade.sh exits with error if Gitea is already the latest version #14877

Closed
opened 2025-11-02 11:24:57 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @eric-j-ason on GitHub (Aug 19, 2025).

Description

If everything goes fine, and upgrade.sh concludes that the running version of Gitea already is the latest, it exits with status 1, as if there was an error. It would be as if apt upgrade exited with status 1 whenever all packages were already up to date.

57b8441745/contrib/upgrade.sh (L88)

I suggest exiting with status 0 in this situation.

Gitea Version

57b8441745

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Downloading and running https://github.com/go-gitea/gitea/blob/main/contrib/upgrade.sh.

Database

None

Originally created by @eric-j-ason on GitHub (Aug 19, 2025). ### Description If everything goes fine, and `upgrade.sh` concludes that the running version of Gitea already is the latest, it exits with status 1, as if there was an error. It would be as if `apt upgrade` exited with status 1 whenever all packages were already up to date. https://github.com/go-gitea/gitea/blob/57b84417450fc9c2c87d3cac174ef10766881da3/contrib/upgrade.sh#L88 I suggest exiting with status 0 in this situation. ### Gitea Version 57b84417450fc9c2c87d3cac174ef10766881da3 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? Downloading and running <https://github.com/go-gitea/gitea/blob/main/contrib/upgrade.sh>. ### Database None
GiteaMirror added the type/bug label 2025-11-02 11:24:57 -06:00
Author
Owner

@silverwind commented on GitHub (Aug 19, 2025):

I agree, no upgrade available is not a failure.

@silverwind commented on GitHub (Aug 19, 2025): I agree, no upgrade available is not a failure.
Author
Owner

@eric-j-ason commented on GitHub (Aug 19, 2025):

I'll just go ahead and make a pull request, that whoever is in charge can accept or reject.

By the way, I notice that the introduction of strict mode (set -euo pipefail) sits halfway through the file. It used to be at the top, which is probably its right place.

463016b317/contrib/upgrade.sh (L61)

@eric-j-ason commented on GitHub (Aug 19, 2025): I'll just go ahead and make a pull request, that whoever is in charge can accept or reject. By the way, I notice that the introduction of strict mode (`set -euo pipefail`) sits halfway through the file. It used to be at the top, which is probably its right place. https://github.com/go-gitea/gitea/blob/463016b31774cacf83df44d0bb580621d2af4020/contrib/upgrade.sh#L61
Author
Owner

@silverwind commented on GitHub (Aug 19, 2025):

Maybe its because some commands before can fail and we don't want the script to exit because of set -e. If there are failing commands, wrap them in a set +e and set -e to temporarily allow command failures.

@silverwind commented on GitHub (Aug 19, 2025): Maybe its because some commands before can fail and we don't want the script to exit because of `set -e`. If there are failing commands, wrap them in a `set +e` and `set -e` to temporarily allow command failures.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#14877