Skip to content

Instantly share code, notes, and snippets.

@op-ct
Last active November 13, 2019 23:30
Show Gist options
  • Select an option

  • Save op-ct/9ac271c85937cd58ee0906b4c8b25811 to your computer and use it in GitHub Desktop.

Select an option

Save op-ct/9ac271c85937cd58ee0906b4c8b25811 to your computer and use it in GitHub Desktop.
WIP: octocatalog-diff settings for local factsets
module OctocatalogDiff
class Config
def self.config
settings = {}
settings[:puppet_binary] = File.join( `bundle show puppet`.chomp, 'bin', 'puppet')
settings[:hiera_path_strip] = '/etc/puppetlabs/code/environments'
settings[:hiera_config] = 'hiera.yaml'
settings[:fact_file] = 'spec/factsets/sampled.facts.json'
settings[:from_env] = 'origin/master'
settings[:basedir] = Dir.pwd
# Needed to run r10k and deploy the environment
settings[:bootstrap_script] = File.join(Dir.pwd,'scripts/octocatalog_diff_bootstrap.sh')
# hack to keep executables out of /tmp
ENV['OCTOCATALOG_DIFF_TEMPDIR'] ||= File.join(__dir__,'.OCTOCATALOG_DIFF_TEMPDIR')
require 'fileutils'
FileUtils.mkdir_p ENV['OCTOCATALOG_DIFF_TEMPDIR']
# Cache the master branch and catalogs in home directory. This will speed up the second
# and subsequent octocatalog-diff runs against the same node on the same branch. It's safe
# to leave this enabled, but if you know that you never want to do caching on your system,
# comment these lines out so the tool doesn't spend the time maintaining the cache.
settings[:cached_master_dir] = File.join(__dir__, '..', '.OCTOCATALOG_DIFF_CACHE')
FileUtils.mkdir_p settings[:cached_master_dir]
settings[:safe_to_delete_cached_master_dir] = settings[:cached_master_dir]
settings
end
end
end
#!/bin/sh -x
#cp $BASEDIR/Gemfile.lock ./
rvm config-get > $BASEDIR/r1
gem env | tee f1
ls -l
pwd
bundle check --dry-run || bundle --local || bundle
bundle exec r10k puppetfile install -v warn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment