Commit Graph
7 Commits
Author SHA1 Message Date
volker.raschekandCopilot 9f7064724e fix(scripts): resolve the shellcheck findings of config_environment.sh
The script masked the exit codes of every command substitution it ran. `local` and `export` are commands
themselves, so their own return value overwrites the one of the substitution and `set -e` never sees a failure.
This was not only cosmetic: when `gitea generate secret` failed, the init container happily continued and exported
an empty `INTERNAL_TOKEN`, `SECRET_KEY`, `JWT_SECRET` and `LFS_JWT_SECRET`. Declaration and assignment are now
separated, which lets `set -e` abort instead of writing an app.ini with empty secrets. (SC2155)

`env2ini::log` passed its argument as the format string of `printf`. Settings names and section names are read from
user supplied configuration and are logged verbatim, so a value containing a `%` directive made `printf` consume
non-existing arguments. The message is passed as data now. `%b` instead of `%s` keeps the `\n` escapes of the
existing call sites working. (SC2059)

The remaining changes quote the file name variables and add `-r` to the `read` of the `find -print0` loop, where an
unquoted path or a backslash in a mount point would have been mangled. (SC2086, SC2162)

Co-authored-by: Copilot <copilot@github.com>
2026-10-03 20:31:02 +02:00
volker.raschekandCopilot 49a221008a chore: remove the leftovers of the act runner deployment
changelog / changelog (push) Successful in 16s
Bash / bash-unittest (push) Successful in 27s
Helm / helm-unittest (push) Successful in 1m12s
Helm / helm-lint (push) Successful in 10s
Markdown linter / markdown-link-checker (push) Failing after 37s
Markdown linter / markdown-lint (push) Successful in 15s
`scripts/act_runner/token.sh` bootstrapped the registration token of an act runner by patching a Kubernetes Secret
with kubectl. The deployment it belonged to is long gone, and no glob picked the file up either: the chart only ships
`scripts/init-containers/config/*.sh` and `scripts/init-containers/init/*.sh`, so the script was not even part of the
packaged chart.

The label helpers `gitea.labels.actRunner` and `gitea.selectorLabels.actRunner` were orphaned the same way. The former
is referenced by no template at all and the latter only by the former, which left them as a closed loop without an
entry point.

Co-authored-by: Copilot <copilot@github.com>
2026-10-03 19:59:53 +02:00
Lunny Xiao 1baf2d0656 chore(deps): upgrade to 1.26 and replace environment_to_ini_call with gitea config edit-ini (#1070)
Need more time to know how to handle `expect_environment_to_ini_call`

Fix #1068

Reviewed-on: https://gitea.com/gitea/helm-gitea/pulls/1070
Reviewed-by: Zettat123 <39446+zettat123@noreply.gitea.com>
2026-05-11 16:50:15 +00:00
justusbunsi 8c4e8e8f30 Introduce bash scripting unittests (#724)
### Description of the change

This adds an environment for unit testing our bash scripts, using [BATS](https://github.com/bats-core/bats-core).
It implements first tests for `config_environment.sh`.

### Benefits

Writing unit tests for bash scripts documents the expected behavior and allows it being a quality gate in our CI.

### Possible drawbacks

Not everyone is familiar with this approach and unit testing framework. Me neither, it took me some hours to get into it.

### Applicable issues

- Related to #691 where an issue in `config_environment.sh` was detected. It doesn't fixes it yet. This will be a dedicated Pull Request.

### Additional information

I've verified that the changes for Renovate are indeed working.

You may wonder why there is only one `run $PROJECT_ROOT/scripts/init-containers/config/config_environment.sh` and many `run execute_test_script` calls.
Usually, testing a script itself would be executing `run $PROJECT_ROOT/scripts/init-containers/config/config_environment.sh`. You then can assert the exit code and other things. Since the `config_environment.sh` exports environment variables and we are not able to access them from outside a `run` execution, the function `execute_test_script` wraps our script execution between environment comparison. Doing so allows us capture environment variables that were added/removed during script execution.

Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/724
Reviewed-by: pat-s <pat-s@noreply.gitea.com>
Co-authored-by: justusbunsi <sk.bunsenbrenner@gmail.com>
Co-committed-by: justusbunsi <sk.bunsenbrenner@gmail.com>
2024-12-20 09:45:01 +00:00
justusbunsi a79fd31f7e Increase testability of shell scripts (#752)
This is a preparation for #724 (bash script testing) which would be too complex to review if done there.

Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/752
Co-authored-by: justusbunsi <sk.bunsenbrenner@gmail.com>
Co-committed-by: justusbunsi <sk.bunsenbrenner@gmail.com>
2024-12-19 12:04:00 +00:00
justusbunsi 726b36c6d8 Extract raw shell/bash scripts as actual shell script files (#751)
### Description of the change

This is a preparation for #724 (bash script testing) which would be too complex to review if done there. I haven't changed the script contents.

### Benefits

Better IDE support, possibility for shell checks, tests.

### Possible drawbacks

-

### Additional information

I only extracted files that are native bash scripts. There are others, being a mix of Helm templating and shell scripts. Those scripts must be cleared first before extracting them as well.

Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/751
Co-authored-by: justusbunsi <sk.bunsenbrenner@gmail.com>
Co-committed-by: justusbunsi <sk.bunsenbrenner@gmail.com>
2024-12-19 10:56:12 +00:00
f7c66c0336 Add Gitea Actions act runner (#666)
Co-authored-by: dementhorr <dementhorr@proton.me>
Co-authored-by: Vince Montalbano <vince.montalbano@gmail.com>

Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/666
Reviewed-by: justusbunsi <justusbunsi@noreply.gitea.com>
Co-authored-by: vjm <vjm@noreply.gitea.com>
Co-committed-by: vjm <vjm@noreply.gitea.com>
2024-11-10 13:35:56 +00:00