将脚本从git repo推送到jss。包括模板和标记。
git2jss的Python项目详细描述
吉特2JSS
版本:v2.0.1
作者:geoff lee
概述
问题:如何确保对jamf jss中的脚本和computerextensionattributes所做的所有更改都被记录、可逆并与源代码管理中的内容匹配?
答案:努力做到零
使用git2jss,在开发/测试环境中对jss脚本或cea进行更改并将其推送到git存储库后,您可以将带标记的副本导出到jss,并在“notes”字段中填写git changelog。还原更改与导出以前标记的版本一样简单。
还可以在连续集成管道中使用此脚本将脚本从给定分支的头部导出到JSS
还支持一些重要值的模板化,因此脚本会自动包含上次更改的详细信息,以及它们在源代码管理中的位置。
默认情况下,密码存储在系统密钥链中
安装/使用
注意:需要python-jss和keyring模块。如果手动安装,则需要确保它们存在。 通过pip安装应该会帮你解决这个问题。
通过PIP安装
如果要安装到virtualenv中
^{tt3}$
应该是你需要做的。
如果安装到OS X 10.13上而不使用Virtualenv, 您需要使用sudo,并安装缺少的依赖项:
^{tt4}$
^{tt5}$
或手动
克隆repo并运行安装脚本
^{tt6}$
^{tt7}$
示例
命令行
您可以在命令行上使用它,如下所示:
# Export the file localscript.sh to a Script object on the JSS called do_something_great.sh # using the existing tag v0.0.9 $ git tag v0.0.9 && git push origin v0.0.9 $ git2jss --file localscript.sh --name do_something_great.sh --tag v0.0.9 # Export the file run-softwareupdate.py at the head of the master branch # to an object on the JSS with the same name $ git2jss --file run-softwareupdate.py --branch master # Export the file check_firewall.sh to a ComputerExtensionAttribute object on the JSS called # FirewallCheck, using the existing tag v0.0.9 $ git2jss --mode ComputerExtensionAttribute --file check_firewall.sh --name check-firewall --tag v0.0.9 # Export each script in the current folder that has a script object on the server # with a matching name, and exists at tag v1.0.2 $ git2jss --all --tag v1.0.2 # Or do the same for all files at the head of branch 'production' $ git2jss --all --branch production # Show information about the currently configured JSS (or enter details if none configured) $ git2jss --jss-info
模板化
以下变量(如果嵌入到脚本中)将在传输到jss时替换为指示值
Variable | Value |
---|---|
^{tt8}$ | If –tag was used: The name of the git tag that you have specified (eg v1.0.1) If –branch was used: The commit hash of the last change of the file, and a note of the branch |
^{tt9}$ | Assuming you have a git remote called ‘origin’, the URL thereof (eg https://github.com/uoe-macos/jss) |
^{tt10}$ | The name of the file in the git repository identified by @@ORIGIN`` |
^{tt11}$ | The date of the last change of the file in Git |
^{tt12}$ | The username used by git2jss to authenticate to the JSS at the time the script was exported |
^{tt13}$ | The entire Git log for this script, formatted thus: ^{tt14}$ |
@@LOG用于在JSS中构造“Notes”字段,覆盖以前存在的任何内容
贡献
欢迎提出问题和请求