From dc77f764a510298ccfa525cfb7afec8d8ddfce04 Mon Sep 17 00:00:00 2001 From: Benoit Garcia Date: Mon, 8 May 2023 07:26:17 +0200 Subject: [PATCH 01/20] feat(actions): Set default values for gitea actions related variables. --- defaults/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index 37e8bd8..c38e904 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -227,6 +227,10 @@ gitea_lfs_serve_direct: false gitea_lfs_content_path: "{{ gitea_home }}/data/lfs" gitea_lfs_extra: '' +# Actions (actions) +# -> https://docs.gitea.io/en-us/config-cheat-sheet/#actions-actions +gitea_actions_enabled: false +gitea_actions_default_actions_url: "https://gitea.com" # Other (other) # -> https://docs.gitea.io/en-us/config-cheat-sheet/#other-other gitea_other_show_footer_branding: false From 8f06e948fb108ade04dc12beb84ab84d32f87eb9 Mon Sep 17 00:00:00 2001 From: Benoit Garcia Date: Mon, 8 May 2023 07:27:56 +0200 Subject: [PATCH 02/20] feat(actions): Add actions related elements to the configuration template. --- templates/gitea.ini.j2 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/templates/gitea.ini.j2 b/templates/gitea.ini.j2 index eed51a1..a105a41 100644 --- a/templates/gitea.ini.j2 +++ b/templates/gitea.ini.j2 @@ -271,6 +271,14 @@ PATH = {{ gitea_lfs_content_path }} {% endif %} ; ; +{% if gitea_actions_enabled | bool %} +; -> https://docs.gitea.io/en-us/config-cheat-sheet/#actions-actions +[actons] +ENABLED = {{ gitea_actions_enabled }} +DEFAULT_ACTIONS_URL = {{ gitea_actions_default_actions_url }} +{% endif %} +; +; ; Other (other) ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#other-other [other] From 0ea40a223f9312d362b52687f754f1f0857738d9 Mon Sep 17 00:00:00 2001 From: Benoit Garcia Date: Mon, 8 May 2023 07:28:37 +0200 Subject: [PATCH 03/20] feat(actions): Add documentation related to actions in the README file. --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 2048806..a71a53d 100644 --- a/README.md +++ b/README.md @@ -295,6 +295,12 @@ Either you define exactly which release you install. Or you use the option ``lat | `gitea_lfs_content_path` | `{{ gitea_home }}/data/lfs` | Where to store LFS files | | `gitea_lfs_extra` ||you can use this variable to pass additional config parameters in the `[lfs]` section of the config. | +### Actions ([actions](https://docs.gitea.io/en-us/config-cheat-sheet/#actions-actions)) +| variable name | default value | description | +| ------------- | ------------- | ----------- | +| `gitea_actions_enabled` | `false` | Enable/Disable actions capabilities globaly. You may want to add `repo.actions` to `gitea_default_repo_units` to enable actions on all new repositories | +| `gitea_actions_default_actions_url` | `https://gitea.com/` | Default address to get action plugins, e.g. the default value means downloading from `https://gitea.com/actions/checkout` for `uses: actions/checkout@v3` | + ### Other ([other](https://docs.gitea.io/en-us/config-cheat-sheet/#other-other)) | variable name | default value | description | | ------------- | ------------- | ----------- | From 3f4f8f52acb737457661bd799142a8b4fc75e07c Mon Sep 17 00:00:00 2001 From: L3D Date: Tue, 9 May 2023 01:43:05 +0200 Subject: [PATCH 04/20] adding gitea_actions_extra variable + Added the variable ``gitea_actions_extra`` + Increased the Number for the simplified versions check --- README.md | 3 ++- defaults/main.yml | 2 ++ templates/gitea.ini.j2 | 1 + vars/main.yml | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a71a53d..4fac809 100644 --- a/README.md +++ b/README.md @@ -293,13 +293,14 @@ Either you define exactly which release you install. Or you use the option ``lat | `gitea_lfs_storage_type` | `local` | Storage type for lfs | | `gitea_lfs_serve_direct` | `false` | Allows the storage driver to redirect to authenticated URLs to serve files directly. *(only Minio/S3)* | | `gitea_lfs_content_path` | `{{ gitea_home }}/data/lfs` | Where to store LFS files | -| `gitea_lfs_extra` ||you can use this variable to pass additional config parameters in the `[lfs]` section of the config. | +| `gitea_lfs_extra` | | you can use this variable to pass additional config parameters in the `[lfs]` section of the config. | ### Actions ([actions](https://docs.gitea.io/en-us/config-cheat-sheet/#actions-actions)) | variable name | default value | description | | ------------- | ------------- | ----------- | | `gitea_actions_enabled` | `false` | Enable/Disable actions capabilities globaly. You may want to add `repo.actions` to `gitea_default_repo_units` to enable actions on all new repositories | | `gitea_actions_default_actions_url` | `https://gitea.com/` | Default address to get action plugins, e.g. the default value means downloading from `https://gitea.com/actions/checkout` for `uses: actions/checkout@v3` | +| `gitea_actions_extra` | | you can use this variable to pass additional config parameters in the `[actions]` section of the config. | ### Other ([other](https://docs.gitea.io/en-us/config-cheat-sheet/#other-other)) | variable name | default value | description | diff --git a/defaults/main.yml b/defaults/main.yml index c38e904..98ffff5 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -231,6 +231,8 @@ gitea_lfs_extra: '' # -> https://docs.gitea.io/en-us/config-cheat-sheet/#actions-actions gitea_actions_enabled: false gitea_actions_default_actions_url: "https://gitea.com" +gitea_actions_extra: '' + # Other (other) # -> https://docs.gitea.io/en-us/config-cheat-sheet/#other-other gitea_other_show_footer_branding: false diff --git a/templates/gitea.ini.j2 b/templates/gitea.ini.j2 index a105a41..8b10b22 100644 --- a/templates/gitea.ini.j2 +++ b/templates/gitea.ini.j2 @@ -276,6 +276,7 @@ PATH = {{ gitea_lfs_content_path }} [actons] ENABLED = {{ gitea_actions_enabled }} DEFAULT_ACTIONS_URL = {{ gitea_actions_default_actions_url }} +{{ gitea_actions_extra }} {% endif %} ; ; diff --git a/vars/main.yml b/vars/main.yml index a73b653..f14adbd 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -62,5 +62,5 @@ transfer_custom_footer: - 'files/gitea_footer/extra_links_footer.tmpl' - 'files/extra_links_footer.tmpl' -playbook_version_number: 44 # should be int +playbook_version_number: 45 # should be int playbook_version_path: 'do1jlr.gitea.version' From 83cfd8d82e064ec293687f5d5cbfa94e7b7c008c Mon Sep 17 00:00:00 2001 From: Benoit Garcia Date: Tue, 9 May 2023 14:44:13 +0200 Subject: [PATCH 05/20] fix(config): Fix name of the `actions`section in the configuration file. --- templates/gitea.ini.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/gitea.ini.j2 b/templates/gitea.ini.j2 index 8b10b22..ff03cce 100644 --- a/templates/gitea.ini.j2 +++ b/templates/gitea.ini.j2 @@ -273,7 +273,7 @@ PATH = {{ gitea_lfs_content_path }} ; {% if gitea_actions_enabled | bool %} ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#actions-actions -[actons] +[actions] ENABLED = {{ gitea_actions_enabled }} DEFAULT_ACTIONS_URL = {{ gitea_actions_default_actions_url }} {{ gitea_actions_extra }} From c9c2f66c5c025b978fbc139f94b5d68574a41a74 Mon Sep 17 00:00:00 2001 From: Benoit Garcia Date: Tue, 9 May 2023 14:45:07 +0200 Subject: [PATCH 06/20] chore(syntax): Reformat the configuration file. --- templates/gitea.ini.j2 | 58 +++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/templates/gitea.ini.j2 b/templates/gitea.ini.j2 index ff03cce..2ecf1d9 100644 --- a/templates/gitea.ini.j2 +++ b/templates/gitea.ini.j2 @@ -13,17 +13,17 @@ RUN_MODE = {{ gitea_run_mode }} ; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#repository-repository [repository] -DEFAULT_BRANCH = {{ gitea_default_branch }} -DEFAULT_PRIVATE = {{ gitea_default_private }} -DEFAULT_REPO_UNITS = {{ gitea_default_repo_units }} -DISABLED_REPO_UNITS = {{ gitea_disabled_repo_units }} -DISABLE_HTTP_GIT = {{ gitea_disable_http_git | ternary('true', 'false') }} -DISABLE_STARS = {{ gitea_disable_stars | ternary('true', 'false') }} -ENABLE_PUSH_CREATE_ORG = {{ gitea_enable_push_create_org | ternary('true', 'false') }} -ENABLE_PUSH_CREATE_USER = {{ gitea_enable_push_create_user | ternary('true', 'false') }} -FORCE_PRIVATE = {{ gitea_force_private | ternary('true', 'false') }} -MAX_CREATION_LIMIT = {{ gitea_user_repo_limit }} ROOT = {{ gitea_repository_root }} +FORCE_PRIVATE = {{ gitea_force_private | ternary('true', 'false') }} +DEFAULT_PRIVATE = {{ gitea_default_private }} +MAX_CREATION_LIMIT = {{ gitea_user_repo_limit }} +DISABLE_HTTP_GIT = {{ gitea_disable_http_git | ternary('true', 'false') }} +ENABLE_PUSH_CREATE_USER = {{ gitea_enable_push_create_user | ternary('true', 'false') }} +ENABLE_PUSH_CREATE_ORG = {{ gitea_enable_push_create_org | ternary('true', 'false') }} +DISABLED_REPO_UNITS = {{ gitea_disabled_repo_units }} +DEFAULT_REPO_UNITS = {{ gitea_default_repo_units }} +DISABLE_STARS = {{ gitea_disable_stars | ternary('true', 'false') }} +DEFAULT_BRANCH = {{ gitea_default_branch }} {{ gitea_repository_extra_config }} ; ; @@ -51,9 +51,9 @@ MERGES = {{ gitea_repo_merges }} ; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#cors-cors [cors] -ENABLED = {{ gitea_enable_cors | ternary('true', 'false') }} -SCHEME = {{ gitea_cors_scheme }} -ALLOW_DOMAIN = {{ gitea_cors_allow_domain }} +ENABLED = {{ gitea_enable_cors | ternary('true', 'false') }} +SCHEME = {{ gitea_cors_scheme }} +ALLOW_DOMAIN = {{ gitea_cors_allow_domain }} ALLOW_SUBDOMAIN = {{ gitea_cors_allow_subdomain | ternary('true', 'false') }} METHODS = {{ gitea_cors_methods }} MAX_AGE = {{ gitea_cors_max_age }} @@ -66,9 +66,9 @@ X_FRAME_OPTIONS = {{ gitea_cors_x_frame_options }} ; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#ui-ui [ui] -SHOW_USER_EMAIL = {{ gitea_show_user_email | ternary('true', 'false') }} -DEFAULT_THEME = {{ gitea_theme_default }} THEMES = {{ gitea_themes }} +DEFAULT_THEME = {{ gitea_theme_default }} +SHOW_USER_EMAIL = {{ gitea_show_user_email | ternary('true', 'false') }} {{ gitea_ui_extra_config }} ; ; @@ -82,6 +82,7 @@ KEYWORDS = {{ gitea_ui_keywords }} ; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#server-server [server] +APP_DATA_PATH = {{ gitea_home }}/data PROTOCOL = {{ gitea_protocol }} DOMAIN = {{ gitea_http_domain }} ROOT_URL = {{ gitea_root_url }} @@ -92,7 +93,10 @@ SSH_DOMAIN = {{ gitea_ssh_domain }} SSH_PORT = {{ gitea_ssh_port }} SSH_LISTEN_HOST = {{ gitea_ssh_listen }} OFFLINE_MODE = {{ gitea_offline_mode | ternary('true', 'false') }} -APP_DATA_PATH = {{ gitea_home }}/data +{% if gitea_enable_tls_certs | bool %} +CERT_FILE = {{ gitea_tls_cert_file }} +KEY_FILE = {{ gitea_tls_key_file }} +{% endif %} LANDING_PAGE = {{ gitea_landing_page }} {% if gitea_lfs_server_enabled | bool -%} LFS_START_SERVER = true @@ -100,10 +104,6 @@ LFS_JWT_SECRET = {{ gitea_lfs_jwt_secret }} {% endif %} REDIRECT_OTHER_PORT = {{ gitea_redirect_other_port | ternary('true', 'false') }} PORT_TO_REDIRECT = {{ gitea_port_to_redirect }} -{% if gitea_enable_tls_certs | bool %} -CERT_FILE = {{ gitea_tls_cert_file }} -KEY_FILE = {{ gitea_tls_key_file }} -{% endif %} ENABLE_ACME = {{ gitea_enable_acme | ternary('true', 'false') }} {% if gitea_enable_acme | bool %} {% if gitea_acme_url != '' %} @@ -162,15 +162,15 @@ PASSWORD_CHECK_PWN = {{ gitea_password_check_pwn | ternary('true', 'false') }} ; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#service-service [service] -DISABLE_REGISTRATION = {{ gitea_disable_registration | ternary('true', 'false') }} REGISTER_EMAIL_CONFIRM = {{ gitea_register_email_confirm | ternary('true', 'false') }} +DISABLE_REGISTRATION = {{ gitea_disable_registration | ternary('true', 'false') }} REQUIRE_SIGNIN_VIEW = {{ gitea_require_signin | ternary('true', 'false') }} -DEFAULT_KEEP_EMAIL_PRIVATE = {{ gitea_default_keep_mail_private | ternary('true', 'false') }} -ENABLE_CAPTCHA = {{ gitea_enable_captcha | ternary('true', 'false') }} -SHOW_REGISTRATION_BUTTON = {{ gitea_show_registration_button | ternary('true', 'false') }} -ALLOW_ONLY_EXTERNAL_REGISTRATION = {{ gitea_only_allow_external_registration | ternary('true', 'false') }} ENABLE_NOTIFY_MAIL = {{ gitea_enable_notify_mail | ternary('true', 'false') }} +ENABLE_CAPTCHA = {{ gitea_enable_captcha | ternary('true', 'false') }} +DEFAULT_KEEP_EMAIL_PRIVATE = {{ gitea_default_keep_mail_private | ternary('true', 'false') }} +SHOW_REGISTRATION_BUTTON = {{ gitea_show_registration_button | ternary('true', 'false') }} AUTO_WATCH_NEW_REPOS = {{ gitea_auto_watch_new_repos | ternary('true', 'false') }} +ALLOW_ONLY_EXTERNAL_REGISTRATION = {{ gitea_only_allow_external_registration | ternary('true', 'false') }} {{ gitea_service_extra_config }} ; ; @@ -222,11 +222,11 @@ PATH = {{ gitea_home }}/data/attachments [log] ROOT_PATH = {{ gitea_home }}/log {% if gitea_log_systemd %} -MODE = console +MODE = console {% else %} -MODE = file +MODE = file {% endif %} -LEVEL = {{ gitea_log_level }} +LEVEL = {{ gitea_log_level }} {{ gitea_log_extra_config }} ; ; @@ -274,7 +274,7 @@ PATH = {{ gitea_lfs_content_path }} {% if gitea_actions_enabled | bool %} ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#actions-actions [actions] -ENABLED = {{ gitea_actions_enabled }} +ENABLED = {{ gitea_actions_enabled }} DEFAULT_ACTIONS_URL = {{ gitea_actions_default_actions_url }} {{ gitea_actions_extra }} {% endif %} From 0b153a7a2837d5ac076c0a3420db8cdbd0ab00bc Mon Sep 17 00:00:00 2001 From: Benoit Garcia Date: Tue, 9 May 2023 14:46:26 +0200 Subject: [PATCH 07/20] chore(syntax): Always use parameters long form. --- templates/gitea.service.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/gitea.service.j2 b/templates/gitea.service.j2 index 1db7f85..76a12a1 100644 --- a/templates/gitea.service.j2 +++ b/templates/gitea.service.j2 @@ -5,7 +5,7 @@ After=network.target [Service] User={{ gitea_user }} Group={{ gitea_group }} -ExecStart={{ gitea_full_executable_path }} web -c {{ gitea_configuraion_path }}/gitea.ini --custom-path {{ gitea_custom }}/ +ExecStart={{ gitea_full_executable_path }} web --config {{ gitea_configuraion_path }}/gitea.ini --custom-path {{ gitea_custom }}/ Restart=on-failure WorkingDirectory={{ gitea_home }} {% if gitea_systemd_cap_net_bind_service %} From 04f7c12352c67d0cbf11f9d10dfcf69fdc50a4df Mon Sep 17 00:00:00 2001 From: Benoit Garcia Date: Tue, 9 May 2023 15:22:18 +0200 Subject: [PATCH 08/20] chore(repo): Setup dependabot to watch for new releases of Github Actions. --- .github/dependabot.yml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..dde6f4a --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,9 @@ +--- +# See https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates +version: 2 +updates: + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" From 8e6923908fe1c63b45590108d0ef57f8ed931888 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 May 2023 21:23:58 +0000 Subject: [PATCH 09/20] Bump robertdebock/galaxy-action from 1.2.0 to 1.2.1 Bumps [robertdebock/galaxy-action](https://github.com/robertdebock/galaxy-action) from 1.2.0 to 1.2.1. - [Release notes](https://github.com/robertdebock/galaxy-action/releases) - [Commits](https://github.com/robertdebock/galaxy-action/compare/1.2.0...1.2.1) --- updated-dependencies: - dependency-name: robertdebock/galaxy-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/galaxy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/galaxy.yml b/.github/workflows/galaxy.yml index adcecbd..39fa2be 100644 --- a/.github/workflows/galaxy.yml +++ b/.github/workflows/galaxy.yml @@ -16,7 +16,7 @@ jobs: uses: actions/checkout@v3 - name: 'release on galaxy' - uses: robertdebock/galaxy-action@1.2.0 + uses: robertdebock/galaxy-action@1.2.1 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} git_branch: 'main' From f1e859d19301271d4f639544748d40f6a12aa10e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 May 2023 21:24:02 +0000 Subject: [PATCH 10/20] Bump karancode/yamllint-github-action from 2.0.0 to 2.1.1 Bumps [karancode/yamllint-github-action](https://github.com/karancode/yamllint-github-action) from 2.0.0 to 2.1.1. - [Release notes](https://github.com/karancode/yamllint-github-action/releases) - [Commits](https://github.com/karancode/yamllint-github-action/compare/v2.0.0...v2.1.1) --- updated-dependencies: - dependency-name: karancode/yamllint-github-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/yamllint.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/yamllint.yaml b/.github/workflows/yamllint.yaml index d744e9c..361b111 100644 --- a/.github/workflows/yamllint.yaml +++ b/.github/workflows/yamllint.yaml @@ -17,7 +17,7 @@ jobs: uses: actions/checkout@v3 - name: 'Yamllint' - uses: karancode/yamllint-github-action@v2.0.0 + uses: karancode/yamllint-github-action@v2.1.1 with: yamllint_file_or_dir: '.' yamllint_config_filepath: './.yamllint' From 446d20c23d6d90a1f36e9169b118759e36fc5d71 Mon Sep 17 00:00:00 2001 From: L3D Date: Wed, 10 May 2023 00:08:43 +0200 Subject: [PATCH 11/20] Create better error message for forgejo releases + Incremented simple version check + Added better error messages for chosing the wrong forgejo version SOLVE https://github.com/roles-ansible/ansible_role_gitea/issues/106 --- tasks/set_forgejo_version.yml | 20 +++++++++++++------- vars/main.yml | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/tasks/set_forgejo_version.yml b/tasks/set_forgejo_version.yml index f44218f..7b3d195 100644 --- a/tasks/set_forgejo_version.yml +++ b/tasks/set_forgejo_version.yml @@ -35,18 +35,24 @@ gitea_version_target: "{{ gitea_remote_version }}" when: not ansible_check_mode -- name: "Set gitea version target {{ gitea_version }}" +- name: "Set forgejo version target {{ gitea_version }}" ansible.builtin.set_fact: gitea_version_target: "{{ gitea_version }}" when: gitea_version != "latest" -- name: "Get specific forgejo release metadata" - ansible.builtin.uri: - url: 'https://codeberg.org/api/v1/repos/forgejo/forgejo/releases/tags/v{{ gitea_version_target }}' - return_content: true - register: gitea_forgejo_remote_tags_metadata - become: false +- name: "Download forgejo version {{ gitea_version_target }}" when: not ansible_check_mode + block: + - name: "Get specific forgejo release metadata" + ansible.builtin.uri: + url: 'https://codeberg.org/api/v1/repos/forgejo/forgejo/releases/tags/v{{ gitea_version_target }}' + return_content: true + register: gitea_forgejo_remote_tags_metadata + become: false + rescue: + - name: "Error Downloading https://codeberg.org/api/v1/repos/forgejo/forgejo/releases/tags/v{{ gitea_version_target }}" + ansible.builtin.fail: + msg: "We did not find the forgejo version you specified. Are you sure that '{{ gitea_version_target }}' is a valid forgejo version?" - name: "Generate forgejo download url" ansible.builtin.set_fact: diff --git a/vars/main.yml b/vars/main.yml index f14adbd..b9a43e6 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -62,5 +62,5 @@ transfer_custom_footer: - 'files/gitea_footer/extra_links_footer.tmpl' - 'files/extra_links_footer.tmpl' -playbook_version_number: 45 # should be int +playbook_version_number: 46 # should be int playbook_version_path: 'do1jlr.gitea.version' From 6f07f2c5c63de695616c8ba408d4278250e2c092 Mon Sep 17 00:00:00 2001 From: L3D Date: Fri, 12 May 2023 20:19:43 +0200 Subject: [PATCH 12/20] Repository Upload Adding variables to configure repository upload more easily --- README.md | 6 ++++++ defaults/main.yml | 5 +++++ templates/gitea.ini.j2 | 3 +++ vars/main.yml | 2 +- 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4fac809..3324210 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,12 @@ Either you define exactly which release you install. Or you use the option ``lat | `gitea_user_repo_limit` | `-1` | Limit how many repos a user can have *(`-1` for unlimited)* | | `gitea_repository_root` | `{{ gitea_home }}/repos` | Root path for storing all repository data. It must be an absolute path. | | `gitea_repository_extra_config` | | you can use this variable to pass additional config parameters in the `[repository]` section of the config. | + +### Repository - Upload ([repository.upload](https://docs.gitea.io/en-us/administration/config-cheat-sheet/#repository---upload-repositoryupload)) +| variable name | default value | description | +| ------------- | ------------- | ----------- | +| `gitea_repository_upload_enabled` | `true` | Whether repository file uploads are enabled | +| `gitea_repository_upload_max_size` | `4` | Max size of each file in megabytes. | | `gitea_repository_upload_extra_config` | | you can use this variable to pass additional config parameters in the `[repository.upload]` section of the config. | ### Repository - Signing ([repository.signing](https://docs.gitea.io/en-us/config-cheat-sheet/#repository---signing-repositorysigning)) diff --git a/defaults/main.yml b/defaults/main.yml index 98ffff5..ea46403 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -45,6 +45,11 @@ gitea_force_private: false gitea_user_repo_limit: '-1' gitea_repository_root: "{{ gitea_home }}/repos" gitea_repository_extra_config: '' + +# Repository - Upload (repository.upload) +# -> https://docs.gitea.io/en-us/administration/config-cheat-sheet/#repository---upload-repositoryupload +gitea_repository_upload_enabled: true +gitea_repository_upload_max_size: 4 gitea_repository_upload_extra_config: '' # Repository - Signing (repository.signing) diff --git a/templates/gitea.ini.j2 b/templates/gitea.ini.j2 index 2ecf1d9..128b736 100644 --- a/templates/gitea.ini.j2 +++ b/templates/gitea.ini.j2 @@ -27,8 +27,11 @@ DEFAULT_BRANCH = {{ gitea_default_branch }} {{ gitea_repository_extra_config }} ; ; +; -> https://docs.gitea.io/en-us/administration/config-cheat-sheet/#repository---upload-repositoryupload [repository.upload] +ENABLED = {{ gitea_repository_upload_enabled | ternary('true', 'false') }} TEMP_PATH = {{ gitea_home }}/data/tmp/uploads +FILE_MAX_SIZE = {{ gitea_repository_upload_max_size }} {{ gitea_repository_upload_extra_config }} ; ; diff --git a/vars/main.yml b/vars/main.yml index b9a43e6..6a1b1f1 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -62,5 +62,5 @@ transfer_custom_footer: - 'files/gitea_footer/extra_links_footer.tmpl' - 'files/extra_links_footer.tmpl' -playbook_version_number: 46 # should be int +playbook_version_number: 47 # should be int playbook_version_path: 'do1jlr.gitea.version' From f3af1cdb7929b95d624266cac80fec267e809ea7 Mon Sep 17 00:00:00 2001 From: L3D Date: Fri, 12 May 2023 20:32:28 +0200 Subject: [PATCH 13/20] Change gitea attachmet config options --- README.md | 2 ++ defaults/main.yml | 4 +++- templates/gitea.ini.j2 | 6 ++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3324210..d3e35e0 100644 --- a/README.md +++ b/README.md @@ -257,6 +257,8 @@ Either you define exactly which release you install. Or you use the option ``lat | variable name | default value | description | | ------------- | ------------- | ----------- | | `attachment_enabled` | `true` | Whether issue and pull request attachments are enabled. | +| `gitea_attachment_types` | see Docs | Comma-separated list of allowed file extensions (`.zip,.txt`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types. | +| `gitea_attachment_max_size` | `4` | Maximum size (MB). | | `gitea_attachment_extra_config` | | you can use this variable to pass additional config parameters in the `[attachment]` section of the config. | ### Log ([log](https://docs.gitea.io/en-us/config-cheat-sheet/#log-log)) diff --git a/defaults/main.yml b/defaults/main.yml index ea46403..9e2a8be 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -46,7 +46,7 @@ gitea_user_repo_limit: '-1' gitea_repository_root: "{{ gitea_home }}/repos" gitea_repository_extra_config: '' -# Repository - Upload (repository.upload) +# Repository - Upload (repository.upload) # -> https://docs.gitea.io/en-us/administration/config-cheat-sheet/#repository---upload-repositoryupload gitea_repository_upload_enabled: true gitea_repository_upload_max_size: 4 @@ -194,6 +194,8 @@ gitea_picture_extra_config: '' # Issue and pull request attachments (attachment) # -> https://docs.gitea.io/en-us/config-cheat-sheet/#issue-and-pull-request-attachments-attachment gitea_attachment_enabled: true +gitea_attachment_types: '.csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.patch,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip' +gitea_attachment_max_size: 4 gitea_attachment_extra_config: '' # Log (log) diff --git a/templates/gitea.ini.j2 b/templates/gitea.ini.j2 index 128b736..4834259 100644 --- a/templates/gitea.ini.j2 +++ b/templates/gitea.ini.j2 @@ -216,8 +216,10 @@ AVATAR_UPLOAD_PATH = {{ gitea_home }}/data/avatars ; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#issue-and-pull-request-attachments-attachment [attachment] -ENABLED = {{ gitea_attachment_enabled | ternary('true', 'false') }} -PATH = {{ gitea_home }}/data/attachments +ENABLED = {{ gitea_attachment_enabled | ternary('true', 'false') }} +ALLOWED_TYPES = {{ gitea_attachment_types }} +MAX_SIZE = {{ gitea_attachment_max_size }} +PATH = {{ gitea_home }}/data/attachments {{ gitea_attachment_extra_config }} ; ; From 7aec3c13816f709bc87b50b385b97f62f26205c5 Mon Sep 17 00:00:00 2001 From: L3D Date: Fri, 12 May 2023 21:00:33 +0200 Subject: [PATCH 14/20] filelength --- .yamllint | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.yamllint b/.yamllint index e9713ae..2e52fdc 100644 --- a/.yamllint +++ b/.yamllint @@ -2,7 +2,7 @@ extends: default rules: - # 170 chars should be enough, but don't fail if a line is longer + # 190 chars should be enough, but don't fail if a line is longer line-length: - max: 170 + max: 190 level: warning From b27d258f508533f4b38e525ade19bc49c29e188d Mon Sep 17 00:00:00 2001 From: firesoft-de <34716031+firesoft-de@users.noreply.github.com> Date: Sun, 14 May 2023 21:37:10 +0200 Subject: [PATCH 15/20] Don't become for gpg verify (also for gitea) #102 --- tasks/install_gitea.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tasks/install_gitea.yml b/tasks/install_gitea.yml index bf166e8..86823e4 100644 --- a/tasks/install_gitea.yml +++ b/tasks/install_gitea.yml @@ -68,6 +68,7 @@ - name: Check archive signature ansible.builtin.command: "gpg --verify /tmp/{{ gitea_filename }}.xz.asc /tmp/{{ gitea_filename }}.xz" changed_when: false + become: false - name: Unpack gitea binary ansible.builtin.command: From dbcb113d21c9e1782fd9630f75d9be11d30e17a3 Mon Sep 17 00:00:00 2001 From: L3D Date: Mon, 15 May 2023 15:53:48 +0200 Subject: [PATCH 16/20] Improve gpg permissions for forgejo --- tasks/install_forgejo.yml | 1 + vars/main.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tasks/install_forgejo.yml b/tasks/install_forgejo.yml index e3f3112..31a4801 100644 --- a/tasks/install_forgejo.yml +++ b/tasks/install_forgejo.yml @@ -51,6 +51,7 @@ ansible.builtin.command: "gpg --list-keys 0x{{ gitea_forgejo_gpg_key }}" register: _gitea_gpg_key_status changed_when: false + become: false failed_when: _gitea_gpg_key_status.rc not in (0, 2) - name: Print gpg key staus on verbosity diff --git a/vars/main.yml b/vars/main.yml index 6a1b1f1..ce1d681 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -62,5 +62,5 @@ transfer_custom_footer: - 'files/gitea_footer/extra_links_footer.tmpl' - 'files/extra_links_footer.tmpl' -playbook_version_number: 47 # should be int +playbook_version_number: 48 # should be int playbook_version_path: 'do1jlr.gitea.version' From 9d6614e7d1e0f8040e80b2e06bb85a32cacd703d Mon Sep 17 00:00:00 2001 From: L3D Date: Wed, 19 Jul 2023 10:49:22 +0200 Subject: [PATCH 17/20] Refactor setting.Other Refactor setting.Other and remove unused SHOW_FOOTER_BRANDING as announced in https://github.com/go-gitea/gitea/releases/tag/v1.20.0 --- README.md | 1 - defaults/main.yml | 1 - templates/gitea.ini.j2 | 1 - vars/main.yml | 2 +- 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index d3e35e0..31793d4 100644 --- a/README.md +++ b/README.md @@ -313,7 +313,6 @@ Either you define exactly which release you install. Or you use the option ``lat ### Other ([other](https://docs.gitea.io/en-us/config-cheat-sheet/#other-other)) | variable name | default value | description | | ------------- | ------------- | ----------- | -| `gitea_other_show_footer_branding` | `false` | Show Gitea branding in the footer. | | `gitea_other_show_footer_version` | `true` | Show Gitea and Go version information in the footer. | | `gitea_other_show_footer_template_load_time` | `true` | Show time of template execution in the footer. | | `gitea_other_enable_sitemap` | `true` | Generate sitemap. | diff --git a/defaults/main.yml b/defaults/main.yml index 9e2a8be..7c41c1c 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -242,7 +242,6 @@ gitea_actions_extra: '' # Other (other) # -> https://docs.gitea.io/en-us/config-cheat-sheet/#other-other -gitea_other_show_footer_branding: false gitea_other_show_footer_version: true gitea_other_show_footer_template_load_time: true gitea_other_enable_sitemap: true diff --git a/templates/gitea.ini.j2 b/templates/gitea.ini.j2 index 4834259..cbe7cb2 100644 --- a/templates/gitea.ini.j2 +++ b/templates/gitea.ini.j2 @@ -288,7 +288,6 @@ DEFAULT_ACTIONS_URL = {{ gitea_actions_default_actions_url }} ; Other (other) ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#other-other [other] -SHOW_FOOTER_BRANDING = {{ gitea_other_show_footer_branding | ternary('true', 'false') }} SHOW_FOOTER_VERSION = {{ gitea_other_show_footer_version | ternary('true', 'false') }} SHOW_FOOTER_TEMPLATE_LOAD_TIME = {{ gitea_other_show_footer_template_load_time | ternary('true', 'false') }} ENABLE_SITEMAP = {{ gitea_other_enable_sitemap | ternary('true', 'false') }} diff --git a/vars/main.yml b/vars/main.yml index ce1d681..70d6b20 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -62,5 +62,5 @@ transfer_custom_footer: - 'files/gitea_footer/extra_links_footer.tmpl' - 'files/extra_links_footer.tmpl' -playbook_version_number: 48 # should be int +playbook_version_number: 49 # should be int playbook_version_path: 'do1jlr.gitea.version' From 12bbd174bb8c56f2c8df0197ed5d0bdd0077d30b Mon Sep 17 00:00:00 2001 From: L3D Date: Wed, 19 Jul 2023 10:58:23 +0200 Subject: [PATCH 18/20] update ansible linting --- .github/workflows/ansible-linting-check.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ansible-linting-check.yml b/.github/workflows/ansible-linting-check.yml index 150e908..5c55ca6 100644 --- a/.github/workflows/ansible-linting-check.yml +++ b/.github/workflows/ansible-linting-check.yml @@ -2,22 +2,22 @@ name: Ansible Lint check # yamllint disable-line rule:truthy -on: - push: - branches: '*' - pull_request: - branches: '*' +on: [push, pull_request] jobs: build: - + name: Ansible Lint runs-on: ubuntu-latest steps: - name: 'checkout git repo' uses: actions/checkout@v3 + with: + lfs: true + submodules: false + fetch-depth: 0 - name: 'Lint Ansible Playbook' uses: ansible/ansible-lint-action@v6 with: - targets: "." + path: "." From fb4293b3e67e8e8c9e0b5436bfd6b33d6e3c8220 Mon Sep 17 00:00:00 2001 From: Michael Grote Date: Wed, 19 Jul 2023 19:38:47 +0200 Subject: [PATCH 19/20] fix typo --- README.md | 2 +- defaults/main.yml | 2 +- tasks/backup.yml | 2 +- tasks/configure.yml | 2 +- tasks/directory.yml | 2 +- tasks/gitea_secrets.yml | 12 ++++++------ tasks/jwt_secrets.yml | 12 ++++++------ templates/gitea.service.j2 | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 31793d4..1bfd033 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ Either you define exactly which release you install. Or you use the option ``lat | `gitea_user_home` | `{{ gitea_home }}` | home of gitea user | | `gitea_executable_path` | `/usr/local/bin/gitea` | Path for gitea executable | | `gitea_forgejo_executable_path` | `/usr/local/bin/forgejo` | Path for forgejo executable | -| `gitea_configuraion_path` | `/etc/gitea` | Where to put the gitea.ini config | +| `gitea_configuration_path` | `/etc/gitea` | Where to put the gitea.ini config | | `gitea_shell` | `/bin/false` | UNIX shell used by gitea. Set it to `/bin/bash` if you don't use the gitea built-in ssh server. | | `gitea_systemd_cap_net_bind_service` | `false` | Adds `AmbientCapabilities=CAP_NET_BIND_SERVICE` to systemd service file | diff --git a/defaults/main.yml b/defaults/main.yml index 7c41c1c..ae4fee3 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -20,7 +20,7 @@ gitea_home: '/var/lib/gitea' gitea_user_home: '{{ gitea_home }}' gitea_executable_path: '/usr/local/bin/gitea' gitea_forgejo_executable_path: '/usr/local/bin/forgejo' -gitea_configuraion_path: '/etc/gitea' +gitea_configuration_path: '/etc/gitea' gitea_shell: '/bin/false' gitea_systemd_cap_net_bind_service: false diff --git a/tasks/backup.yml b/tasks/backup.yml index 9699fca..3dc9074 100644 --- a/tasks/backup.yml +++ b/tasks/backup.yml @@ -29,7 +29,7 @@ - name: Backing up gitea before upgrade become: true ansible.builtin.command: - cmd: "sudo -u {{ gitea_user }} {{ gitea_full_executable_path }} dump -c {{ gitea_configuraion_path }}/gitea.ini" + cmd: "sudo -u {{ gitea_user }} {{ gitea_full_executable_path }} dump -c {{ gitea_configuration_path }}/gitea.ini" chdir: "{{ gitea_backup_location }}" changed_when: true rescue: diff --git a/tasks/configure.yml b/tasks/configure.yml index cf57dcf..3f1be1f 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -3,7 +3,7 @@ become: true ansible.builtin.template: src: gitea.ini.j2 - dest: "{{ gitea_configuraion_path }}/gitea.ini" + dest: "{{ gitea_configuration_path }}/gitea.ini" owner: "{{ gitea_user }}" group: "{{ gitea_group }}" mode: 0600 diff --git a/tasks/directory.yml b/tasks/directory.yml index f89f70d..2a9e2aa 100644 --- a/tasks/directory.yml +++ b/tasks/directory.yml @@ -8,7 +8,7 @@ group: "{{ gitea_group }}" mode: 'u=rwX,g=rX,o=' with_items: - - "{{ gitea_configuraion_path }}" + - "{{ gitea_configuration_path }}" - "{{ gitea_user_home }}" - "{{ gitea_home }}" - "{{ gitea_home }}/data" diff --git a/tasks/gitea_secrets.yml b/tasks/gitea_secrets.yml index c5b1e20..8f61d3f 100644 --- a/tasks/gitea_secrets.yml +++ b/tasks/gitea_secrets.yml @@ -1,15 +1,15 @@ --- - name: Generate gitea SECRET_KEY if not provided become: true - ansible.builtin.shell: 'umask 077; {{ gitea_full_executable_path }} generate secret SECRET_KEY > {{ gitea_configuraion_path }}/gitea_secret_key' + ansible.builtin.shell: 'umask 077; {{ gitea_full_executable_path }} generate secret SECRET_KEY > {{ gitea_configuration_path }}/gitea_secret_key' args: - creates: '{{ gitea_configuraion_path }}/gitea_secret_key' + creates: '{{ gitea_configuration_path }}/gitea_secret_key' when: gitea_secret_key | string | length == 0 - name: Read gitea SECRET_KEY from file become: true ansible.builtin.slurp: - src: '{{ gitea_configuraion_path }}/gitea_secret_key' + src: '{{ gitea_configuration_path }}/gitea_secret_key' register: remote_secret_key when: gitea_secret_key | string | length == 0 @@ -20,15 +20,15 @@ - name: Generate gitea INTERNAL_TOKEN if not provided become: true - ansible.builtin.shell: 'umask 077; {{ gitea_full_executable_path }} generate secret INTERNAL_TOKEN > {{ gitea_configuraion_path }}/gitea_internal_token' + ansible.builtin.shell: 'umask 077; {{ gitea_full_executable_path }} generate secret INTERNAL_TOKEN > {{ gitea_configuration_path }}/gitea_internal_token' args: - creates: '{{ gitea_configuraion_path }}/gitea_internal_token' + creates: '{{ gitea_configuration_path }}/gitea_internal_token' when: gitea_internal_token | string | length == 0 - name: Read gitea INTERNAL_TOKEN from file become: true ansible.builtin.slurp: - src: '{{ gitea_configuraion_path }}/gitea_internal_token' + src: '{{ gitea_configuration_path }}/gitea_internal_token' register: remote_internal_token when: gitea_internal_token | string | length == 0 diff --git a/tasks/jwt_secrets.yml b/tasks/jwt_secrets.yml index f56abf0..5700a3b 100644 --- a/tasks/jwt_secrets.yml +++ b/tasks/jwt_secrets.yml @@ -1,15 +1,15 @@ --- - name: Generate OAuth2 JWT_SECRET if not provided become: true - ansible.builtin.shell: 'umask 077; {{ gitea_full_executable_path }} generate secret JWT_SECRET > {{ gitea_configuraion_path }}/gitea_oauth_jwt_secret' + ansible.builtin.shell: 'umask 077; {{ gitea_full_executable_path }} generate secret JWT_SECRET > {{ gitea_configuration_path }}/gitea_oauth_jwt_secret' args: - creates: '{{ gitea_configuraion_path }}/gitea_oauth_jwt_secret' + creates: '{{ gitea_configuration_path }}/gitea_oauth_jwt_secret' when: gitea_oauth2_jwt_secret | length == 0 - name: Read OAuth2 JWT_SECRET from file become: true ansible.builtin.slurp: - src: '{{ gitea_configuraion_path }}/gitea_oauth_jwt_secret' + src: '{{ gitea_configuration_path }}/gitea_oauth_jwt_secret' register: oauth_jwt_secret when: gitea_oauth2_jwt_secret | length == 0 @@ -20,15 +20,15 @@ - name: Generate LFS JWT_SECRET if not provided become: true - ansible.builtin.shell: 'umask 077; {{ gitea_full_executable_path }} generate secret JWT_SECRET > {{ gitea_configuraion_path }}/gitea_lfs_jwt_secret' + ansible.builtin.shell: 'umask 077; {{ gitea_full_executable_path }} generate secret JWT_SECRET > {{ gitea_configuration_path }}/gitea_lfs_jwt_secret' args: - creates: '{{ gitea_configuraion_path }}/gitea_lfs_jwt_secret' + creates: '{{ gitea_configuration_path }}/gitea_lfs_jwt_secret' when: gitea_lfs_jwt_secret | length == 0 - name: Read LFS JWT_SECRET from file become: true ansible.builtin.slurp: - src: '{{ gitea_configuraion_path }}/gitea_lfs_jwt_secret' + src: '{{ gitea_configuration_path }}/gitea_lfs_jwt_secret' register: lfs_jwt_secret when: gitea_lfs_jwt_secret | length == 0 diff --git a/templates/gitea.service.j2 b/templates/gitea.service.j2 index 76a12a1..ade38a7 100644 --- a/templates/gitea.service.j2 +++ b/templates/gitea.service.j2 @@ -5,7 +5,7 @@ After=network.target [Service] User={{ gitea_user }} Group={{ gitea_group }} -ExecStart={{ gitea_full_executable_path }} web --config {{ gitea_configuraion_path }}/gitea.ini --custom-path {{ gitea_custom }}/ +ExecStart={{ gitea_full_executable_path }} web --config {{ gitea_configuration_path }}/gitea.ini --custom-path {{ gitea_custom }}/ Restart=on-failure WorkingDirectory={{ gitea_home }} {% if gitea_systemd_cap_net_bind_service %} From b226af63cdb027ec23539cd27ce27b17f1789e12 Mon Sep 17 00:00:00 2001 From: Jens Timmerman Date: Tue, 8 Aug 2023 21:36:35 +0200 Subject: [PATCH 20/20] Update gitea.service.j2 Signed-off-by: Jens Timmerman --- templates/gitea.service.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/gitea.service.j2 b/templates/gitea.service.j2 index ade38a7..e47ee6d 100644 --- a/templates/gitea.service.j2 +++ b/templates/gitea.service.j2 @@ -5,7 +5,7 @@ After=network.target [Service] User={{ gitea_user }} Group={{ gitea_group }} -ExecStart={{ gitea_full_executable_path }} web --config {{ gitea_configuration_path }}/gitea.ini --custom-path {{ gitea_custom }}/ +ExecStart={{ gitea_full_executable_path }} web --config {{ gitea_configuration_path }}/gitea.ini --custom-path {{ gitea_custom }}/ --work-path {{ gitea_home }} Restart=on-failure WorkingDirectory={{ gitea_home }} {% if gitea_systemd_cap_net_bind_service %}