-
Notifications
You must be signed in to change notification settings - Fork 17
Pushing Changes to Jamf Pro
git4jamfpro was designed to be ran from a CI/CD platform in an automated fashion. However, you can run the git4jamfpro.sh script in Terminal as well with exactly the same results (just less magic).
git4jamfpro determines what it uploads to Jamf Pro based on the changes made between your last two commits. This means that source control is a required component of git4jamfpro. A pipeline (if configured correctly for git4jamfpro) will automatically run when a commit to your master branch occurs. What happens next is git4jamfpro determines the scripts or extension attributes that changed between the last two commits and those are the items that are uploaded to your Jamf Pro server.
So can you run from Terminal? Absolutely. You will, however, still need to properly commit your changes to source control before you can push those changes to Jamf Pro with git4jamfpro even if you want to run manually from Terminal.
When you clone the git4jamfpro repository down, the first thing you'd likely do is download the scripts and Extension Attributes from your template Jamf Pro server. This will populate the "scripts" and "extension_attributes" directories in your local git4jamfpro repository.
Next, you'd add/commit/push those changes to your forked git4jamfpro repository in source control so you have a replica of the scripts and extension attributes from your template Jamf Pro server in your source control.
Alternatively, you can test git4jamfpro with the included sample scripts and Extension Attributes.
So you want to make a change to a script and push that script to Jamf Pro? Cool, lets do that.
- Modify the script in your local git4jamfpro repository.
- Push that changed script to your source control:
# Inspect the changes
git status
# Stage the changed files
git add .
# OR stage a specific file
git add /path/to/git4jamfpro/scripts/Awesome\ Script/script.sh
# Commit the changes
git commit -m "Changed Awesome Script"
# Push the changes to your source control
git push
- Now you can run git4jamfpro.sh to push that change to Jamf Pro:
./git4jamfpro.sh --url <JAMF_PRO_URL> --username <API_USER> --password <API_PASS> --push-changes-to-jamf-pro --backup-updated
The Jamf Pro user account used with git4jamfpro must have the below permissions.
Jamf Pro Server Objects | Create | Read | Update | Delete |
---|---|---|---|---|
Computer Extension Attributes | ✓ | ✓ | ✓ | |
Scripts | ✓ | ✓ | ✓ |
You can optionally add the --dry-run
flag to simulate the process and see what could have been. 😛