raffienficiaud.atlassian-bambooagent-cmake-role

Ansible Atlassian Bambooagent CMake Role

This role installs a specific version of cmake on remote machines and sets up cmake, cpack, and ctest as system builders for Bamboo agent capabilities. It also adds cmake to the PATH on Windows and saves the cmake version and paths in a fact called bamboo_capabilities.

Requirements

This role works only on Ubuntu, macOS, and Windows. You need to have the official installation files available. For Linux, this should be the tar file from the official CMake download site. For Windows and macOS, you'll need the .exe and .dmg installers, respectively.

Role Variables

Variable Default Description
cmake_installation required A dictionary with information about the installation, detailed below.
linux_install_prefix '' The installation prefix for Linux (defaults to an empty string).
bamboo_capabilities (empty dict) A dictionary storing the agent's capabilities. It will include additional keys after running the role.

CMake Installation

  • For Linux: The cmake tar file is extracted under {{ linux_install_prefix }}/usr/local/cmake-version-specific. You need to provide the file, subfolder, and version fields in cmake_installation. Example:

    local_cmake_version:
      major: 3
      minor: 4
      patch: 1
    
    local_cmake_installation:
      file: 'cmake-{{ local_cmake_version.major }}.{{ local_cmake_version.minor }}.{{ local_cmake_version.patch }}-Linux-x86_64.tar.gz'
      subfolder: cmake-{{ local_cmake_version.major }}.{{ local_cmake_version.minor }}.{{ local_cmake_version.patch }}-Linux-x86_64
      version: "{{ local_cmake_version }}"
    
  • For macOS: The role will use the DMG installer, and you must specify the 'version'. Example:

    bamboo_cmake_version:
      major: 3
      minor: 4
      patch: 1
    
    local_cmake_installation:
      file: 'cmake-{{ local_cmake_version.major }}.{{ local_cmake_version.minor }}.{{ local_cmake_version.patch }}-Darwin-x86_64.dmg'
      install_cmd: 'rm -rf /Applications/CMake.app && cp -R -f "${mount}/CMake.app" /Applications/'
      remove_interactive: True
      version: "{{ local_cmake_version }}"
    

Linux Install Prefix

This variable sets where to install cmake so that it can be moved if needed. You might use something like {{ bambooagent_install_root }}/usr/local, which keeps the installed binaries separate from the rest of the operating system. This folder will take precedence when the agent starts.

Capabilities Decreed by the Role

After running this role, the following capabilities will be declared on the Bamboo agent:

Capability Value
system.builder.command.cmake(/ctest/cpack) Location of the commands
cmake_version Version of cmake

Dependencies

This role depends on the DMG installation role named ansible-atlassian-bambooagent-install-dmg-role.

Example Playbook

Here’s an example of how to use this role for installing on macOS agents:

- hosts: osx-agents
  vars:

    # Define the cmake version and installer
    - play_cmake_version:
        major: 3
        minor: 7
        patch: 1

    - play_cmake_installation:
        file: "/path/to/cmake/installers/cmake-{{ play_cmake_version.major }}.{{ play_cmake_version.minor }}.{{ play_cmake_version.patch }}-Darwin-x86_64.dmg"
        install_cmd: 'rm -rf /Applications/CMake.app && cp -R -f "${mount}/CMake.app" /Applications/'
        remove_interactive: True
        version: "{{ bamboo_cmake_version }}"

  pre_tasks:
    - name: '[BAMBOO] Clear capabilities declaration'
      set_fact:
        bamboo_capabilities: {}

  roles:
    - role: atlassian-bambooagent-cmake-role
      vars:
        cmake_installation: "{{ play_cmake_installation }}"
        linux_install_prefix: "/home/bambooagent/"

License

BSD

Author Information

Feel free to share your comments, pull requests, or bug reports on the related GitHub project.

Informazioni sul progetto

Installs CMake in an Atlassian Bamboo remote agent and declares the cmake builder capability

Installa
ansible-galaxy install raffienficiaud.atlassian-bambooagent-cmake-role
Licenza
Unknown
Download
119
Proprietario
ML Engineer, computer vision and C++/Python addict. Open source advocate. Atlassian enthusiast https://bitbucket.org/renficiaud https://yayimorphology.org