<commit_before>#
# Cookbook Name:: jenkins-server
# Recipe:: JenkinsServer
#
# Copyright (c) 2015 The Authors, All Rights Reserved.
package 'emacs'
package 'git'

include_recipe 'jenkins::master'

jenkins_plugin 'greenballs'
jenkins_plugin 'github'
jenkins_plugin 'cmakebuilder'
jenkins_plugin 'xunit'
jenkins_plugin 'mercurial'
jenkins_plugin 'multiple-scms'

secretsfilename = File.join(Chef::Config[:file_cache_path], 'cookbooks/aws_chef_jenkins/files/default/', node['secretsfilename'])
secretsfile = File.read(secretsfilename)
secretsobject = JSON.parse(secretsfile)

serverinstance = search("aws_opsworks_instance", "self:true").first

unless serverinstance.nil?
  template "#{node['jenkins']['master']['home']}/hudson.tasks.Mailer.xml" do
    source 'default/mailer-plugin.xml.erb'
    variables :mailer => {
                'default-suffix' => '@astrocompute-ci.org',
                'smtp-port' => 587,
                'smtp-username' => secretsobject['smtp'].first['username'],
                'smtp-password' => secretsobject['smtp'].first['password'],
                'public-dns' => serverinstance['public_dns'],
                'reply-to' => '<EMAIL>',
                'smtp-host' => 'email-smtp.eu-west-1.amazonaws.com'
              }
    notifies :reload, 'service[jenkins]', :delayed
  end

  secretsobject['jenkins_users']['passwords'].each do |password|
    jenkins_password_credentials "#{password['name']}" do
      username "#{password['username']}"
      description "account #{password['username']} on slave"
      password "#{password['password']}"
    end
  end

  secretsobject['jenkins_users']['ssh_keys'].each do |sshkey|
    ssh_private_key_file = File.join(Chef::Config[:file_cache_path], 'cookbooks/aws_chef_jenkins/files/default', sshkey['keyname'])
    ssh_private_key = File.read(ssh_private_key_file)<commit_msg>added replyto address parameter in template. Now we can get the value from the attributes. This solves #2<commit_after>#
# Cookbook Name:: jenkins-server
# Recipe:: JenkinsServer
#
# Copyright (c) 2015 The Authors, All Rights Reserved.
package 'emacs'
package 'git'

include_recipe 'jenkins::master'

jenkins_plugin 'greenballs'
jenkins_plugin 'github'
jenkins_plugin 'cmakebuilder'
jenkins_plugin 'xunit'
jenkins_plugin 'mercurial'
jenkins_plugin 'multiple-scms'

secretsfilename = File.join(Chef::Config[:file_cache_path], 'cookbooks/aws_chef_jenkins/files/default/', node['secretsfilename'])
secretsfile = File.read(secretsfilename)
secretsobject = JSON.parse(secretsfile)

serverinstance = search("aws_opsworks_instance", "self:true").first

unless serverinstance.nil?
  template "#{node['jenkins']['master']['home']}/hudson.tasks.Mailer.xml" do
    source 'default/mailer-plugin.xml.erb'
    variables :mailer => {
                'default-suffix' => '@astrocompute-ci.org',
                'smtp-port' => 587,
                'smtp-username' => secretsobject['smtp'].first['username'],
                'smtp-password' => secretsobject['smtp'].first['password'],
                'public-dns' => serverinstance['public_dns'],
                'reply-to' => node['replytoaddress'],
                'smtp-host' => 'email-smtp.eu-west-1.amazonaws.com'
              }
    notifies :reload, 'service[jenkins]', :delayed
  end

  secretsobject['jenkins_users']['passwords'].each do |password|
    jenkins_password_credentials "#{password['name']}" do
      username "#{password['username']}"
      description "account #{password['username']} on slave"
      password "#{password['password']}"
    end
  end

  secretsobject['jenkins_users']['ssh_keys'].each do |sshkey|
    ssh_private_key_file = File.join(Chef::Config[:file_cache_path], 'cookbooks/aws_chef_jenkins/files/default', sshkey['keyname'])
    ssh_private_key = File.read(ssh_private_key_file)
{'fraction_non_alphanumeric': 0.14856692085195897, 'fraction_numerical': 0.004470155140678412, 'mean_word_length': 4.298050139275766, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1172053', 'n_tokens_mistral': 1259, 'n_tokens_neox': 1191, 'n_words': 210}