Skip to main content
https://dev.azure.com/gklee/git2jss/_apis/build/status/gkluoe.git2jss?branchName=master

Git2JSS

Version : v2.0.1

Author: Geoff Lee

Overview

Question: How do you ensure that all changes to Scripts and ComputerExtensionAttributes in your JAMF JSS are logged, reversible, and match what you have in source control?

Answer: Make it zero-effort.

Using Git2jss, after making changes to JSS Scripts or CEAs in your dev/test environment and pushing them to a Git repository, you can export a tagged copy to your JSS, complete with the Git changelog in the ‘Notes’ field. Reverting a change is as easy as exporting the previous tagged version.

You can also use this script in a Continuous Integration pipeline to export scripts from the head of a given branch to your JSS.

Templating of some important values is also supported, so your scripts automatically contain details of the last change, and where they can be found in source control.

Passwords are stored in the system keychain by default.

Installation / Usage

NB: the python-jss and keyring modules are required. If manually installing, you’ll need to make sure they are present. Installing via pip should take care of this for you.

Install via pip

If you’re installing into a virtualenv

$ pip install git2jss

should be all you need to do.

If installing onto OS X 10.13 and not using a virtualenv, you’ll need to use sudo, and install a missing dependency:

$ sudo pip install git2jss

$ sudo pip install cryptography

Or manually

Clone the repo and run the setup script

$ git clone https://github.com/gkluoe/git2jss.git

$ python setup.py install

Examples

Commandline

You can use it on the commandine like this:

# 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

Templating

The following variables, if embedded into your script, will be replaced with the indicated values when being transferred to the JSS

Variable

Value

@@VERSION

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

@@ORIGIN

Assuming you have a git remote called ‘origin’, the URL thereof (eg https://github.com/uoe-macos/jss)

@@PATH

The name of the file in the git repository identified by @@ORIGIN``

@@DATE

The date of the last change of the file in Git

@@USER

The username used by git2jss to authenticate to the JSS at the time the script was exported

@@LOG

The entire Git log for this script, formatted thus: '%h - %cD %ce: %n %s%n'

@@LOG is used to construct the ‘Notes’ field in the JSS, overwriting anything that was present previously.

Contributing

Issues and pull requests are very welcome!

Metadata

Release files for git2jss 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for git2jss 2.0.1
File Size Uploaded
git2jss-2.0.1.tar.gz 15.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for git2jss 2.0.1
File Interpreter ABI Platform
git2jss-2.0.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 43.2 kB

Release files / git2jss-2.0.1.tar.gz

Download URL git2jss-2.0.1.tar.gz
Size 15.3 kB
Tags Source
SHA-256 checksum
How to use checksums
10a7f7199477084fa2b9ed1e77f713fa73af36647b08bc8893cf320e1fc01788
BLAKE2b-256 checksum
How to use checksums
1120a27c8915d42183aed32eeb45daa23de064f45a4d35a1976af6bda08cf6c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.10

Release files / git2jss-2.0.1-py2.py3-none-any.whl

Download URL git2jss-2.0.1-py2.py3-none-any.whl
Size 27.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
5a760eb9ad8859e73a984ccb467c8e43bb017e84939c72957e5d6b5561e01340
BLAKE2b-256 checksum
How to use checksums
e5820e4eda346dbffe658ae4eb06b624f1d23a947ddc5b9dc0d5cf131f263c1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.10

Release history Release notifications | RSS feed

This release

2.0.1 This release

2 release files

2.0.0

2 release files

1.0.0

2 release files

0.1.0

2 release files

0.0.6

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page