raffienficiaud.atlassian-bambooagent-cmake-role
Ansible Atlassian Bambooagent CMake 角色
该角色用于在远程机器上安装特定版本的 cmake
并将 cmake/cpack/ctest
注册为 Bamboo 代理的系统构建器能力。
同时在 Windows 上将 cmake
注册到 PATH
,并在事实 bamboo_capabilities
中注册 cmake 版本及路径。
要求
目前仅支持 Ubuntu、OSX 和 Windows。需要在磁盘上有官方安装包。在 Linux 上,这应为官方 CMake 下载页面提供的 tar 文件。在 Windows 和 OSX 上,分别是 .exe
和 .dmg
打包安装程序。
角色变量
变量 | 默认值 | 说明 |
---|---|---|
cmake_installation |
必需 | 描述安装的字典,详见下文。 |
linux_install_prefix |
'' |
Linux 的安装前缀(默认空字符串)。 |
bamboo_capabilities |
(空字典) | 保存代理能力的事实字典。运行后字典将包含额外键值。 |
cmake_installation
在 Linux 上:cmake 的 tar 文件解压到远程的
{{ linux_install_prefix }}/usr/local/cmake-version-specific
目录下。cmake_installation
的file
、subfolder
和version
字段必须定义。 示例: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 }}"
在 OSX 上:该角色使用 DMG 安装程序,应该附加 'version'。示例:
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
该变量用于在特定前缀下安装 cmake
,使其成为可重定位包。例如,可以使用 {{ bambooagent_install_root }}/usr/local
,这样可以将正在使用的二进制文件与操作系统的其他部分隔离。该文件夹在代理启动时应该优先于系统路径。
角色声明的能力
运行后,该角色在 Bamboo 代理实例上声明以下能力:
能力 | 值 |
---|---|
system.builder.command.cmake(/ctest/cpack) |
命令的位置 |
cmake_version |
cmake 的版本 |
依赖关系
该角色依赖于 DMG 安装角色 ansible-atlassian-bambooagent-install-dmg-role
。
示例剧本
以下是如何在 OSX 代理上使用该角色进行安装的示例。
- hosts: osx-agents
vars:
# 声明 cmake 版本和安装程序
- 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] 清空能力声明'
set_fact:
bamboo_capabilities: {}
roles:
# 安装 cmake
- role: atlassian-bambooagent-cmake-role
vars:
cmake_installation: "{{ play_cmake_installation }}"
linux_install_prefix: "/home/bambooagent/"
许可证
BSD
作者信息
欢迎对 Ansible 的任何评论、PR 或 bug 报告,具体请看对应的 Github 项目。
关于项目
Installs CMake in an Atlassian Bamboo remote agent and declares the cmake builder capability
安装
ansible-galaxy install raffienficiaud.atlassian-bambooagent-cmake-role
许可证
Unknown
下载
119
拥有者
ML Engineer, computer vision and C++/Python addict.
Open source advocate.
Atlassian enthusiast https://bitbucket.org/renficiaud
https://yayimorphology.org