Skip to main content
Question

GitLab as a source of truth for JAMF scripts

  • August 16, 2021
  • 1 reply
  • 0 views

Forum|alt.badge.img+1

I am attempting to manage our organizations flow of scripts by using GitLab commits to add new scripts through the JAMF API. I am using Jenkins to auto-run these jobs on commit to check for changes, and then post those changes to our organizations JAMF Pro scripts.

I am new with APIs, and am having a hard time figuring out how to post multiple scripts to JAMF using the POST /v1/scripts. 

Has anyone ever found a good solution to adding multiple scripts at the same time through the API? And if so, is there a way to avoid this type of parameter declaration? I am still figuring out the SCM pull, so please ignore that part. I just need to know if there is a better way to POST new scripts, and clobber the old ones when scripts are edited.

 

stages { stage('Build') { when { changeset SCM } steps { container('ubuntu') { sh """ username="user" password="password" credentials=$(printf "$username:$password" | /usr/bin/iconv -t ISO-8859-1 | /usr/bin/base64 -i - ) jps="https://<jamf_server_url>" # Create auth token uapi_token=$(curl -s -H "Content-Type: application/json" -H "Authorization: Basic ${credentials}" -X POST "${jps}/uapi/auth/tokens" | jq -r '.token') curl -X POST "<jamf_server_url>" \\ -H "accept: application/json" \\ -H "Authorization: Bearer ${uapi_token}" -d "{\\"name\\":\\"Install Developer Utils Script\\",\\"info\\":\\"Installs utilities for developers\\",\\"notes\\":\\"Should be able to be re-run without problem.\\", "priority\\":\\"AFTER\\",\\"categoryId\\":\\"1\\",\\"categoryName\\":\\"Developer Tools\\",\\"parameter4\\":\\"1\\",\\"parameter5\\":\\"2\\",\\"parameter6\\":\\"3\\", \\"parameter7\\":\\"4\\",\\"parameter8\\":\\"5\\",\\"parameter9\\":\\"6\\",\\"parameter10\\":\\"7\\",\\"parameter11\\":\\"8\\",\\"osRequirements\\": \\"10.10.x\\","scriptContents\\":\\"echo \\\\\\"Trivial script.\\\\\\"\\"}" """ } } } }

 

1 reply

DBrowning
Forum|alt.badge.img+24
  • Esteemed Contributor
  • 668 replies
  • August 17, 2021

Hey @NateUpp take a look at git2jss


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings