ninxsoft / Jade-CLI

A Mac command-line tool that automatically downloads your Jamf assets.
MIT License
23 stars 2 forks source link

New CLI Option to generate download URL #1

Closed aarondavidpolley closed 3 years ago

aarondavidpolley commented 3 years ago

So part of a workflow I have currently is to store the downloads for Jamf Pro Installers on a private cloud linux server that's accessible to my scripts for updating many Jamf Pro instances.....

Currently I can use JADE to load them on my machine and then SCP them to my linux host, but I more often go to jamf.com, start a download, stop it immediately, and grab the "where from" address in get info on my Mac so that I can directly curl/wget the file on to my cloud server as its much faster.

It would be amazing to have a JADE CLI option to print the download URL including the temporary AWS/cloudfront CDN session/user tokens rather than actually downloading the file.

Screen Shot 2021-03-11 at 11 28 06 pm
ninxsoft commented 3 years ago

Sounds like a great idea!

As the download URLs are crazy long and would destroy my pretty tables, I am tempted to make this an optional flag to export the asset data as a property list, json, or yaml file. You would then be able to tweak your workflow any way you see fit with the exported file(s).

This will also help with workflows where you want to report on the latest version of a particular asset (and perform no action if the version matches what you already have downloaded).

The following examples have been truncated, but I hope you get the idea.

jade --list --plist /path/to/output.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>jamf</key>
  <array>
    <dict>
      <key>version</key>
      <string>10.27.0</string>
      <key>downloads</key>
      <array>
        <dict>
          <key>checksum</key>
          <string>really_long_checksum</string>
          <key>platform</key>
          <string>mac</string>
          <key>url</key>
          <string>https://ci.jamfcloud.com/path/to/download.dmg</string>
        </dict>
        <dict>
          <key>checksum</key>
          <string>really_long_checksum</string>
          <key>platform</key>
          <string>windows</string>
          <key>url</key>
          <string>https://ci.jamfcloud.com/path/to/download.msi</string>
        </dict>
        <dict>
          <key>checksum</key>
          <string>really_long_checksum</string>
          <key>platform</key>
          <string>linux</string>
          <key>url</key>
          <string>https://ci.jamfcloud.com/path/to/download.run</string>
        </dict>
      </array>
    </dict>
  </array>
</dict>
</plist>

jade --list --json /path/to/output.json:

{
  "jamf": [{
    "version": "10.27.0",
    "downloads": [{
      "platform": "mac",
      "checksum": "really_long_checksum",
      "url": "https://ci.jamfcloud.com/path/to/download.dmg"
    }, {
      "platform": "windows",
      "checksum": "really_long_checksum",
      "url": "https://ci.jamfcloud.com/path/to/download.msi"
    }, {
      "platform": "linux",
      "checksum": "really_long_checksum",
      "url": "https://ci.jamfcloud.com/path/to/download.run"
    }]
  }]
}

jade --list --yaml /path/to/output.yaml:

---
jamf:
- version: 10.27.0
  downloads:
  - platform: mac
    checksum: really_long_checksum
    url: https://ci.jamfcloud.com/path/to/download.dmg
  - platform: windows
    checksum: really_long_checksum
    url: https://ci.jamfcloud.com/path/to/download.msi
  - platform: linux
    checksum: really_long_checksum
    url: https://ci.jamfcloud.com/path/to/download.run
aarondavidpolley commented 3 years ago

Yeah I’m definitely down for that! Love the idea of 3 different formats depending on what’s suits best. And agree the version comparison could be killer too.

ninxsoft commented 3 years ago

Opted for jade --list --export /path/to/export --format [json|plist|yaml] over the previously mentioned example.

This feature has been implemented in #2.

You can now grab version 1.3 from the releases page.