Skip to content

Commit

Permalink
add support for removing test files
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandermeindl committed Oct 7, 2024
1 parent 758c17a commit c500e20
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
16 changes: 16 additions & 0 deletions roles/redmine/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,22 @@ redmine_write_permission_dirs:

redmine_plugin_access: readonly

redmine_plugin_remove_test_files: false
redmine_plugin_test_files:
- .git
- .gitignore
- test
- Gemfile.release
- eslint.config.cjs
- package.json
- .flayignore
- .gitlab-ci.yml
- .reek.yml
- .rubocop.yml
- .slim-lint.yml
- .stylelintrc.json
- .rails_best_practices.yml

# https://api.rubyonrails.org/classes/ActiveJob/QueueAdapters/AsyncAdapter.html
redmine_queue_adapter: async

Expand Down
24 changes: 23 additions & 1 deletion roles/redmine/tasks/instance_plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,31 @@
state: absent
loop: '{{ plugin["remove_plugins"] | default([]) }}'

- name: Set plugin target path for {{ plugin_name }}
ansible.builtin.set_fact:
plugin_target_path: '{{ redmine_plugin_dir }}/{{ plugin["target_dir"] | default(plugin_name) }}'

# this is required, because with git you can restore dev/test files
- name: Remove plugin dir before git fetch for product plugins {{ plugin_name }}

Check failure on line 30 in roles/redmine/tasks/instance_plugin.yml

View workflow job for this annotation

GitHub Actions / ansible-lint

fqcn[action-core]

Use FQCN for builtin module actions (file).
file:
path: '{{ plugin_target_path }}'
state: absent
when:
- redmine_plugin_remove_test_files
- plugin["product"] is defined and plugin["product"]

- name: Run remote deploy for plugin - {{ instance_name }}
ansible.builtin.include_tasks: task_remote_deploy.yml
vars:
repo_url: '{{ plugin[preferred_git_url] | default(plugin["url"]) }}'
repo_dest: '{{ redmine_plugin_dir }}/{{ plugin["target_dir"] | default(plugin_name) }}'
repo_dest: '{{ plugin_target_path }}'
repo_version: '{{ plugin["dev_version"] if instance.plugin_version is defined and instance.plugin_version == "dev" and plugin["dev_version"] is defined else plugin["version"] }}'

- name: Remove test files for {{ plugin_name }}

Check failure on line 45 in roles/redmine/tasks/instance_plugin.yml

View workflow job for this annotation

GitHub Actions / ansible-lint

fqcn[action-core]

Use FQCN for builtin module actions (file).
file:
path: '{{ plugin_target_path }}/{{ item }}'
state: absent
loop: '{{ redmine_plugin_test_files }}'
when:
- redmine_plugin_remove_test_files
- plugin["product"] is defined and plugin["product"]

0 comments on commit c500e20

Please sign in to comment.