Git Product home page Git Product logo

git4jamfpro's Introduction

git4jamfpro

A tool designed for CI/CD pipelines that uploads the most recently changed scripts and extension attributes in source control to a Jamf Pro server(s).

This is a rewrite of the great (but very aged) git2jss python library written by badstreff.

What are the benefits of git4jamfpro?

  • Designed and packaged to be be ran in a CI/CD pipeline. We even include sample pipeline config files for CircleCI, Bitbucket, and GitHub to get you up and running quickly.
  • No python dependency; git4jamfpro is written in bash.
  • Uses modern Bearer Token authentication with Jamf Pro.
  • Allows you to download all scripts and extension attributes (EAs) in parallel from a Jamf Pro server.
  • You can update (or create) scripts/EAs locally, commit the changes to your repository, and the changed scripts/EAs are pushed to Jamf Pro automatically by your pipeline. This ensures that script/EA changes are always tracked in source control.
  • When a script/EA is updated, a backup can be left as an artifact in your CI/CD pipeline.

Setting up git4jamfpro

  1. Fork your own copy of the repository.
  2. Clone the repository locally:
git clone [email protected]:YOUR_ORGANIZATION/git4jamfpro.git (or equivalent)
  1. Traverse into the repository:
cd git4jamfpro
  1. Download your scripts/EAs:
./git4jamfpro --url <YOUR_JAMF_PRO_SERVER> \
    --username <API_USER> \
    --password <API_PASS> \
    --download-scripts \
    --download-eas
  1. Commit the repository populated with scripts/EAs to your source control:
git add .
git commit -m "initial commit with scripts/EAs"
  1. Configure your pipeline (see the Wiki for CircleCI, Bitbucket, and GitHub setup).

  2. Now you can make changes to your scripts locally, push those changes to source control, and watch your pipeline automatically update Jamf Pro ๐Ÿคฏ.

Required Permissions

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 โœ“ โœ“ โœ“

git4jamfpro's People

Contributors

ryangball avatar allpurposeben avatar

Stargazers

 avatar  avatar Anton Winter avatar Mike Matz avatar Serge avatar Brad Reno avatar  avatar Ryon Riley avatar Andrew Seago avatar  avatar Kris Payne avatar Amado Tejada avatar  avatar GadgetGeekNI avatar  avatar KC Santos avatar Simon Swist avatar  avatar  avatar  avatar  avatar  avatar  avatar David West-Talarek avatar  avatar  avatar Dane Abernathy avatar Robert Schroeder avatar  avatar Mort avatar wiley avatar notverypc avatar Adam W avatar Richard Purves avatar Christopher Grande avatar John Mahlman avatar John Hutchison avatar Greg avatar  avatar

Watchers

notverypc avatar  avatar Chad Swarthout avatar wiley avatar  avatar

git4jamfpro's Issues

Error when downloading Scripts

Hello (and thank you for the great tool!)

I tried downloading my scripts for the first setup, and keep getting this error:
`Getting identifying info for all scripts in Jamf Pro...
-:10.5: Opening and ending tag mismatch: br line 8 and p

^ -:11.8: Opening and ending tag mismatch: p line 8 and body ^ -:12.8: Opening and ending tag mismatch: body line 5 and html ^ -:13.1: Premature end of data in tag html line 1

^
-:1: parser error : Document is empty

^`
Any pointers on where to look? I suspect some naming in one of the scripts is what trips git4jamfpro up....

Bye, Fridolin.

Also add control for Config Profiles?

Hello, great project, looking forward to getting it set up.

I wondered though, if adding Config Profiles to this would make sense? Obviously not so easy to edit them, but as a version control system could it also work?

Thanks
David

Not pushing changes to server, document empty

Hi, probably more my issue than the tool.

Got it installed in dev and pulled my my scripts and EAs. Tried making changes to one script and when the git4jamfpro Job runs the push errors with

cat: ''$'\n''<script>'$'\n'' [script] Open URL'$'\n'' Scripts'$'\n'' '$'\n'' '$'\n'' After'$'\n'' '$'\n'' <os_requirements/>'$'\n''</script>': No such file or directory
-:1.1: Document is empty

^
Could not determine name of script from the xml record, skipping.

I thought maybe it's failing on the script name; square brackets, but failed on new script without brackets.

Also errored on Run actions/upload-artifact@v3 until I created a backups folder, which I created manually, (even though .gitconfig excludes it) but it uploads 9bytes.

Where can I find out about the steps?

  • name: Archive Backups
    uses: actions/upload-artifact@v3
    steps:
    - uses: actions/checkout@v3

I can't find a macAdmins Slack channel for this, and my other inane questions ;-) Thanks

Argument list too long -:1.1: Document is empty

Hi all, I seem to be doing something wrong...
I'm pulling down a script and xml, renaming one of the parameters in the xml and pushing back up and getting the error in the title.

This is my xml, no formatting issues. Not sure where to go from here.

<?xml version="1.0" encoding="UTF-8"?>
<script>
  <name>setupYourMac.sh</name>
  <category>Enrollment</category>
  <info/>
  <notes/>
  <priority>After</priority>
  <parameters>
    <parameter4>scriptLog</parameter4>
    <parameter5>debugMode</parameter5>
    <parameter6>welcomeDialog</parameter6>
    <parameter7>completedActionOption</parameter7>
    <parameter8>requiredMinimumBuild</parameter8>
    <parameter9>outdatedOsAction</parameter9>
    <parameter10>webhookURL</parameter10>
    <parameter11>presetConfiguration</parameter11>
  </parameters>
  <os_requirements/>
</script>

I saw a different issue similar to this but I noticed I already have that hotfix as I just started using git4jamfpro in the past week or so.

xml parse errors

On some scripts, when making changes or trying to upload new. I get an error similar to this.

-:-1.0: unterminated entity reference & echo "Uninstalling ATP" && /usr/local/McAfee/uninstall ATP

This will cause the modified script to be empty in jamf pro. Here is the full line in question

[[ -f "/usr/local/McAfee/uninstall" ]] && echo "Uninstalling ATP" && /usr/local/McAfee/uninstall ATP

It seems to be unhappy with my usage of &&?

This line in another script tripped it up, with the following error. -:18.34: xmlParseEntityRef: no name /usr/bin/caffeinate -d -i -m -u & caffeinatePID=$!. This failed at script creation.

/usr/bin/caffeinate -d -i -m -u & caffeinatePID=$!

Delete Jamf scripts?

Thanks for this great script. Looking into testing this. This does not delete Jamf scripts on the Jamf pro server correct?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.