No description, website, or topics provided.
Python
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 23 commits ahead of pebbleit:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
README.md
munki-trello.cfg-template
munki-trello.py

README.md

Introduction

This is a script that utilises a Trello board to manage the promotion of Munki items through development to testing to production catalogs. You should make five lists on your Trello board:

  • To Development: Items placed in this list will be moved to the development catalog when the script next runs.
  • Development: Items in here are in the Development list. Do not place items directly in here, the script will manage the addition / removal of items to the list.
  • To Testing: Items placed in this list will be moved to the testing catalog when the script next runs.
  • Testing: Items here are in testing.
  • To Production: Items here will be moved into production on the next run.

When items are moved into production, they can be moved to a dated list, so you have a history of when items were placed into production. One list will be made per day.

Usage

Setup

It is recommended that this script is run under a service Trello account rather than a real persons, so you can separate the changes made by the script from normal users. This user will need to have access to the Trello board you're using. You will need to know the board ID - the board ID is the part after /b and before the name of your board (with a URL or https://trello.com/b/AbCdEfGh/my-trello-board, AbCdEfGh would be the board ID.)

You will need an API key. Make note of the key and then head over to Trello's instructions for creating a user token. Choose how long you want to issue to token for - using the value of 'never' will stop the token from expiring. The only required option is read and write access to the Trello account. The name can be anything you like, it's how you will identify the token in future.

https://trello.com/1/authorize?key=substitutewithyourapplicationkey&name=munki-trello&expiration=never&response_type=token&scope=read,write

You will be given a 64 character string that you will need to take note of.

You will also need to install the trello module:

$ sudo easy_install trello

Running the script

You have two options - you can run the script manually on a machine with the Munki Tools installed (this will run on OS X or Linux, Windows isn't tested), or you can use the Docker container. For more details about the Docker container, see it's own repository and it's entry on the Docker Hub.

Example

$ python munki-trello.py --boardid 12345 --key myverylongkey --token myevenlongertoken --repo-path /Volumes/my-repo

Options

  • --boardid: Required. The ID of your Trello board.
  • --key: Required. Your Trello API key.
  • --token: Required. Your Trello User Token.
  • --config: Optional. A file to read configuration settings from.
  • --to-dev-list: Optional. The name of your 'To Development' list. Defaults to To Development.
  • --dev-list: Optional. The name of your 'Development' list. Defaults to Development.
  • --to-test-list: Optional. The name of your 'To Testing' list. Defaults to To Testing.
  • --test-list: Optional. The name of your 'Testing' list. Defaults to Testing.
  • --to-prod-list: Optional. The name of your 'To Production' list. Defaults to To Production.
  • --prod-suffix or --suffix: Optional. The suffix that will be put after the dated 'Production' lists. Defaults to Production; if unset packages will be added to the production list.
  • --prod-list: Optional. The name of your 'Production' list. Defaults to Production; only used when --prod-suffix is unset.
  • --repo-path: Optional. The path to your Munki repository. Defaults to /Volumes/Munki.
  • --makecatalogs: Optional. The path to makecatalogs. Defaults to /usr/local/munki/makecatalogs.
  • --date-format: Optional. The date format to use when creating dated lists. See strftime(1) for details of the formating options. Defaults to %d/%m/%y.
  • --dev-stage-days: Optional. Set the due date for autostaging; as packages are added into development, this will set the card due date to the current time plus the about of time given. You will need to seperately turn on staging, which is independent of this option. Default: 0 (no due date set).
  • --stage-test: Optional. Automatically promote packages with a due date set from the development list into the testing list. Note: there is a separate option to enable the setting of the due date. Default: False (no auto promotion to test).
  • --test-stage-dates: Optional. Set the due date for autostaging; as packages are added into test, this will set the card due date to the current time plus the about of time given. You will need to separately turn on staging, which is independent of this option. Default: 0 (no due date set).
  • --stage-prod: Optional. Automatically promote packages with a due date set from the testing list into the production list. Note: there is a separate option to enable the setting of the due date. Default: False (no auto promotion to test).

Configuration file

You can give all of the command line options in a configuration file, which will be read first. The default configuration file locations are: /etc/munki-trello/munki-trello.cfg ./munki-trello.cfg and these will always be checked. You can also add an extra config file location by using the --config command line option.

N.B. Configuration files will be processed before command line options.

Options on the command line will be used in preference to those in the configuration file. An example configuration file is in munki-trello.cfg-template.

Troubleshooting

I'm seeing items that won't move to the next stage no matter how often I move them.

Make sure the combination of name and version is unique. For speed, the initial ingest of Munki data is done via your all catalog rather than traversing your pkgsinfo files. If you have two pkgsinfo files that have the same version / name combination as anther, this script won't touch anything after the first. Once the duplicate(s) have been removed, the item will be promoted to the next stage.