github_projects

Clone all the public github projects for a given github ID

Geoff Williams

geoffwilliams

7,273 downloads

6,929 latest version

2.3 quality score

Version information

  • 0.2.0 (latest)
  • 0.1.0
released Nov 16th 2015

Start using this module

Documentation

geoffwilliams/github_projects — version 0.2.0 Nov 16th 2015

github_projects

Build Status

Table of Contents

  1. Overview
  2. Module Description - What the module does and why it is useful
  3. Setup - The basics of getting started with github_projects
  4. Usage - Configuration options and additional functionality
  5. Reference - An under-the-hood peek at what the module is doing and how
  6. Limitations - OS compatibility, etc.
  7. Development - Guide for contributing to the module

Overview

Clone (and optionally update) all GitHub projects for a given github user ID

Module Description

Downloads all the public repositories for a given GitHub user ID. The gitim script is used to do this and a complete copy of this project is supplied in this module's files directory. To avoid slowing down your puppet runs, a cron resource is used instead of an exec.

Setup

Setup Requirements

  • GitHub API usage requires that the user be authenticated against a valid GitHub account
  • While this can be done with a password, this is not recommended as passwords may give more access then is required
  • Instead, users should generate an OAuth token
  • Requires the pip3 python command to be present. On Ubuntu and Debian systems, this is provided in the python3-pip package
  • If you get errors about the pygithub library being missing despite apparently successful library installation, then you may have a miss-match between your pip3 and python3 versions. Check that the versions match and update the symlink at /usr/local/bin/python3 if this is the case

Beginning with github_projects

github_projects module needs to be included once to bring in the python dependencies into scope. The github_projects::get defined resource type can then be used to manage a given directory and checkout code from the specified GitHub user.

This is can be done with a hash of Hiera data:

profiles::github_projects::get:
    "/home/geoff/github": {
        "github_user": "GeoffWilliams",
        "local_user": "geoff",
        "token": "replace_with_you_oauth_hash",
    }

Once data is in Hiera, a simple profile class can both initiate Python and perform the download

class profiles::github_projects(
    $get = hiera("profiles::github_projects::get", {}),
) {

  include github_projects
  create_resources("github_projects::get", $get)

}

Usage

Put the classes, types, and resources for customizing, configuring, and doing the fancy stuff with your module here.

Reference

  • github_projects - Main class used to setup Python dependencies
  • github_projects::get - Defined resource type for cloning/updating repositories

Limitations

Needs Python 3, tested on Ubuntu 15.10. Installs the pygithub Python package and requires Internet access to download. Should work anywhere that pygithub does but this hasn't been tested.

Development

PRs accepted