File ansible-sap-install.yaml of Package ansible-sap-install

# Configuration file for changes before build.

# Types of available options for transformation:
# - remove_paths - Removes the specified files or directories.
# - remove_lines - Removes lines matching the patterns from the files matching specified glob patterns.
# - replace_text - Replaces text in files matching specified glob patterns.
# - update_yaml_key - Updates a specific key's value in the specified YAML files matching specified glob patterns.
# - append_yaml_list - Appends a new item to a list in the specified YAML files matching specified glob patterns.
# - set_yaml_value - Sets or replaces a specific key's value in the specified YAML files matching specified glob patterns.
# - remove_yaml_list_items - Removes specific items from a list in the specified YAML files matching specified glob patterns.

changes:
  - type: remove_paths
    paths:
      # Remove meta files within any role directory.
      - "roles/*/meta/main.yml"
      - "roles/*/meta/collection-requirements.yml"
      # Removal of other files is part of galaxy.yml build_ignore list.
      - "roles/sap_hostagent"  # Role does not support SLES.

  - type: remove_lines
    files:
      - "README.md"
      - "roles/*/README.md"
    patterns:
      - "\\[Ansible Lint"  # Remove Ansible Lint lines from README.md and all role README.md files.
      - "sap_hostagent"  # Remove unsupported role

  - type: replace_text
    # Update namespace to suse and downstream hyperlinks.
    files:
      - "galaxy.yml"
      - "README.md"
      - "roles/*/README.md"
    replacements:
      - { find: "namespace: community", replace: "namespace: suse" }
      - { find: "github.com/sap-linuxlab/community", replace: "github.com/SUSE/community" }
      - { find: "documentation:.*", replace: "documentation: https://github.com/SUSE/community.sap_install/blob/main/README.md" }
      - { find: "community.sap_install Ansible Collection", replace: "suse.sap_install Ansible Collection" }

  - type: update_yaml_key
    # Update the 'authors' key in galaxy.yml to 'SUSE'.
    files:
      - "galaxy.yml"
    key: "authors"
    value:
      - SUSE

  - type: remove_lines
    # Remove redhat.rhel_system_roles from roles, but keep it in choices
    # Role only uses linux_system_roles only for selinux, which is not included yet.
    files:
      - "roles/*/README.md"
      - "roles/*/defaults/main.yml"
      - "roles/*/meta/argument_specs.yml"
    patterns:
      - "use 'redhat.rhel_system_roles'"

  - type: replace_text
    # Update linux_system_roles names
    files:
      - "roles/*/README.md"
      - "roles/*/defaults/main.yml"
      - "roles/*/meta/argument_specs.yml"
    replacements:
      # Replace redhat.rhel_system_roles in choices with suse.linux_system_roles
      - { find: "redhat.rhel_system_roles", replace: "suse.linux_system_roles" }
      - { find: " - for the RHEL System Roles for SAP, or for Red Hat Automation Hub.<br>", replace: "<br>" }
      # Replace fedora.linux_system_roles with suse.linux_system_roles where applicable.
      - { find: "- _Default:_ `'fedora.linux_system_roles'`", replace: "- _Default:_ `'suse.linux_system_roles'`" }
      - { find: "- _Default:_ `fedora.linux_system_roles`", replace: "- _Default:_ `suse.linux_system_roles`" }
      - { find: ": 'fedora.linux_system_roles'", replace: ": 'suse.linux_system_roles'" }
      # Ensure that choice comments are retained before replacing them.
      - { find: "- `fedora.linux_system_roles` - for community/upstream.<br>", replace: "-X `fedora.linux_system_roles` - for community/upstream.<br>" }
      - { find: "- `fedora.linux_system_roles`", replace: "- `suse.linux_system_roles`" }
      - { find: "-X `fedora.linux_system_roles`", replace: "- `fedora.linux_system_roles`" }
      - { find: "Ansible Collection `fedora.linux_system_roles`", replace: "Ansible Collection `suse.linux_system_roles`" }
      - { find: "default: fedora.linux_system_roles", replace: "default: suse.linux_system_roles" }
      # Replace collection names
      - { find: "name: community.sap_install.", replace: "name: suse.sap_install." }
      - { find: "default: 'community.sap_install'", replace: "default: 'suse.sap_install'" }
      - { find: "_sap_install_collection: 'community.sap_install'", replace: "_sap_install_collection: 'suse.sap_install'" }

  - type: replace_text
    # Update shebang
    files:
      - "roles/sap_install_media_detect/files/tmp/sapfile"
    replacements:
      - { find: "/usr/bin/env bash", replace: "/usr/bin/bash" }

  - type: remove_yaml_list_items
    # This is used to remove specific collections from ansible_requirements.yml.
    files:
      - "requirements.yml"
    list_key: "collections"
    items_to_remove:
      - name: "fedora.linux_system_roles"

  - type: update_yaml_key
    # NOTE: Empty lines after update_yaml_key will add them to dictionary! 
    # Update the 'build_ignore' key in galaxy.yml to ignore specific files and directories during the build process.
    # Playbooks contain direct role calls, not collections.
    # Remove scripts and tests that are not required.
    files:
      - "galaxy.yml"
    key: "build_ignore"
    value:
      - "tests"
      - "roles/*/tests"
      - ".git*"
      - "*/.git*"
      - "*/*/.git*"
      - ".ansible-lint"
      - "*/*/.ansible-lint"
      - ".yamllint*"
      - "*/*/.yamllint*"
      - ".pylintrc*"
      - "bindep*"
      - ".pre-commit-config.yaml"
      - "workflows"
      - "changelogs/.plugin-cache.yaml"
      - "playbooks"
      - "tools/swpm2_parameters_inifile_generate.py"
      - "roles/*/tools/beautify-assert-output.sh"
openSUSE Build Service is sponsored by