Skillets and GitHub

The Skillet Framework uses GitHub as the primary option for storing skillets.

Create a New GitHub Repository

Login to GitHub and select New to add a new repository.

../_images/new_repo_button.png
Enter details for the repo. Adding a README.md file and an MIT license are recommended. You can also add a .gitignore file, primarily to ignore pushing any EDI directories such as .idea/ used by PyCharm.
../_images/create_repo_settings.png
Once the repository is created, click the green Code button to clone either the HTTPS or SSH URL. For the purposes of working with PanHandler and later tutorials, the SSH option is recommended. Click the Clipboard button to copy the URL.
../_images/clone_ssh_link.png

Add SSH Keys from PanHandler into GitHub

If you are using the SSH URL to import a GitHub repository into PanHandler, you must add your PanHandler SSH keys into your GitHub account.

In PanHandler, navigate to the top right of the page to find the ‘paloalto’ user settings. Click the dropdown menu and select View SSH Public Key.

../_images/view_ssh_public_key.png
On this screen you should see your ssh key. Copy the entire key (include ‘ssh-rsa’ at the beginning and ‘PAN_CNC’ at the end.
../_images/copy_ssh_key.png
Navigate back to GitHub. In the top right, click the dropdown menu next to your user icon and click Settings.
../_images/github_settings.png
Find the SSH and GPG keys settings and click the green New SSH key button.
../_images/github_new_ssh_key.png
Give the SSH key a title and paste the key copied from PanHandler. Click the green Add SSH key button.
../_images/github_add_key.png

Import a Repository into PanHandler

Please refer to the instructions above in order to copy the GitHub repository link to your clipboard. Navigate to PanHandler. Click the PanHandler dropdown menu in the top left corner and select Import Skillets.

../_images/panhandler_dropdown.png
Scroll down the page and locate the Import Repository Section. Enter the name of the repository and paste the URL you copied from the above step. Click Submit. Make sure you are using the SSH URL as opposed to the HTTPS URL.
../_images/import_skillet.png

Create a Skillet Directory

Prerequisites for creating a skillet directory:

  • A new repository created on GitHub

  • Text editor/IDE of choice (PyCharm, Sublime, etc.)

From the steps above, make sure that you’ve cloned the link for the repo you just created. In a terminal/bash shell enter the following:

> git clone {GitHub repository link}

This will add a directory to your local machine with the contents of the repository. Open this directory in your text editor/IDE. If you don’t already have a README.md file, you can add one now. Follow the ‘Configuration Tutorial’ to learn what to add in the README.md file.

Create a sub-directory that will contain the skillet content. Name the sub-directory something relevant to the skillet that will be created here.

Add a file with the name .skillet.yaml inside the sub-directory and another README.md.

../_images/skillet_directory_files.png

Leave these files blank for now; they will be populated later on in the tutorial.

Use Submodules

A submodule is a reference within a host Github repository that points to a specific commit in an external repository. Submodules are used to include external content in a repository in a manner that can be easy updates and referenced. In terms of skillets, the Playlist Include skillet framework uses submodules to reference

To initiate a submodule within a host repository, use the command git submodule add <submodule_clone_link>. This is similar to cloning a repository to a host machine. The contents of the submodule repository will be ‘copied’ to the working tree of the host repository and will be viewable if the host repository is cloned. It is recommended to navigate to a folder within the host repository before initiating a submodule to keep your working tree clean. On GitHub, the submodule will appear similarly to the ones below.

../_images/submodule_in_repository.png

When a submodule is added to a host repository for the first time, a new .gitmodules file will be created automatically. This file contains information about the connection between the submodule and host repository. Adding more than one submodule will create additional entries in the .gitmodules file.

An example of an entry in the .gitmodules file is:

[submodule "submodules/ironskillet-components"]
    path = submodules/ironskillet-components
    url = https://gitlab.com/panw-gse/as/ironskillet-components.git

When cloning a repository with a submodule, existing submodules will need to be initiated and updated before use. To do this, run the following commands:

  • clone the repository

  • open the repository

  • run git submodule init

  • run git submodule update

Submodules are tied to a specific commit when initiated, so they will need to be updated to pull the newest content from the submodule repository as needed. This can be done using the git submodule update --remote --merge command. This will update all submodules added within a host repository to the latest commit.