Skip to main content

Version : v1.0.0

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.

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:

# Create a new tag, v1.0.1, and export my_great_script.py to a script object of the same name on the JSS

$ git2jss --file my_great_script.py --create --tag v1.0.1

# Export the file localscript.sh to a Script object on the JSS called do_something_great.sh
# using the existing tag v0.0.9

$ git2jss --file localscript.sh --name do_something_great.sh --tag v0.0.9

# 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

# 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

# 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

The name of the git tag that you have specified (eg v1.0.1)

@@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!

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git2jss-1.0.0.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git2jss-1.0.0-py2.py3-none-any.whl (17.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file git2jss-1.0.0.tar.gz.

File metadata

  • Download URL: git2jss-1.0.0.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for git2jss-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e16d7878901f9d62164da4fa3eabf32c0fdb7e682412f2990e80bd1337e596b6
MD5 f50ac7ef1f02f91e834ea966de114d89
BLAKE2b-256 c33640288871df9b70174744d6b5860565296b218bbf2c98881544f36d9eac6c

See more details on using hashes here.

File details

Details for the file git2jss-1.0.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for git2jss-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1a8dac55781104d43e8d2942d32addfc6e5e660bf376113203eabe31380baee4
MD5 134ea00b87342e8d8f0777c3ee0bb136
BLAKE2b-256 482332b6f7c06be5a0b0edc72f1aabf386852dbfeca8ac1f2bc269a10f0cbbbc

See more details on using hashes here.

Release history Release notifications | RSS feed

2.0.1

2 files

2.0.0

2 files

This release

1.0.0 This release

2 files

0.1.0

2 files

0.0.6

2 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