How to manage changes to PDQ Deploy with Git

company ColbyB
Colby Bouma|Updated January 26, 2021
Managing changes to PDQ Deploy with Git
Managing changes to PDQ Deploy with Git

Have you ever wanted a detailed history of the changes you’ve made to PDQ Deploy and Inventory? You can accomplish this with the built in Export feature and your own git repository. The Export feature creates XML files which are fairly readable and work very well with git. If you follow my workflow of exporting and committing after every change you get some handy benefits:

  • Quickly find when a change was made

  • See exactly what changed

  • Keep notes on why you made a change

  • Create a sort of undo button by importing a snippet of XML

Setting up Gitlab and preparing your workstation

1. Install and configure Gitlab

a. Create a virtual machine with at least 2GB RAM, 20GB HDD, and 1 CPU core. You can use your favorite Linux distro, but I chose Ubuntu 16.04 for this demo. I followed to install Gitlab.

sudo apt-get install curl openssh-server ca-certificates postfix
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
sudo apt-get install gitlab-ce

c. You should now be able to log into your Gitlab webpage and change the root password.

d. Create a user account for yourself. It’s never a good idea to run as root.

gitlab-admin-area
gitlab-new-user

2. Create a repository.

gitlab-new-project

3. Install Git on your workstation.

Default is fine.

4. Clone the repository to your workstation

clone-repository
clone-repository-black

5. Create the initial export. In PDQ Deploy, go to File > Preferences > Export All

xml-preferences-export

6. Commit the initial export with the comment “Initial commit”

git add .\Deploy_Settings.xml
git commit -m “Initial commit”

initial-commit

7. Push the initial commit to Gitlab

git push -u origin master

git-credentials
git-push-black
repository-pdq-settings-git

Workflow for managing changes to PDQ Deploy or Inventory

Perform an export after making any change. If you need to make multiple changes, do them one at a time and export after each change. This makes it much easier to look through and encourages detailed notes instead of “Huh, looks like I changed some stuff”.

1. Perform an export and save over the previous file

export-deploy-settings-1
confirm-replace-file-git

2. Commit all changed files:

git commit -a

git-commit-2

3. Press “i” to enter INSERT mode

git-editor-press-i

4. Write a comment such as “Increase ‘Backups to Keep’ to 200”

I also like to make a note of the path to the item I have changed, such as “Database > Backups to Keep”. The first line is a brief note to summarize the commit; everything below that can be as detailed as you want. Make sure to put a blank line after the first line if you are going to write detailed notes.

Keep-200

5. To save and close the comment hit the ESC key, type “:x”, and hit ENTER.

Keep-200-x

6. Synchronize with Gitlab:

git push origin master

(If you make multiple changes you can wait to do this step until you’re done.)

git-push-origin
backups-to-keep

Undo button

1. Find the snippet of code you want to restore

restore-code-pdq-deploy (1)

2. Copy and paste it into a text editor

In this example I had to rearrange it a little bit due to how the diff was formatted. For packages you want everything between <Package> and </Package>.

Package-code-snip

3. Save it as an XML file

activation-status-save

4. Import it

import-to-pdq-deploy
import-rebuilt-package (1)

And now that you know how to manage changes to Deploy with Git, you can take that next step by seeing what you can do with Git and PowerShell scanners.

company ColbyB
Colby Bouma

Colby was an employee at PDQ.

Related articles