Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automate setup portion of granting jenkins access to a github repo #20

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
#
# Copyright 2010, VMware, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
Expand All @@ -24,6 +23,8 @@
default[:jenkins][:mirror] = "http://mirrors.jenkins-ci.org"
default[:jenkins][:package_url] = "http://pkg.jenkins-ci.org"
default[:jenkins][:java_home] = ENV['JAVA_HOME']
default[:jenkins][:build_user_email] = "jenkins-build@#{node[:fdqn]}"
default[:jenkins][:build_user_name] = "automated build process"

default[:jenkins][:server][:home] = "/var/lib/jenkins"
default[:jenkins][:server][:user] = "jenkins"
Expand Down
2 changes: 2 additions & 0 deletions files/default/github_keys.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
|1|PqPXrISFgHy5RWIfbyYGR7KIL28=|RfHGHY2BbmNjcxg5WSNaXx3bWzo= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
|1|d7o19/ibbnCCocPRkaivkSBaN30=|ytVikmR/5WzQ4uwLqF0yQc7sbok= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
29 changes: 29 additions & 0 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,28 @@
group node[:jenkins][:server][:group]
end

#cookbook_file "#{pkey}" do
#source "id_rsa"
#mode 0600
#owner node[:jenkins][:server][:user]
#group node[:jenkins][:server][:group]
#end

#cookbook_file "#{pkey}.pub" do
#source "id_rsa.pub"
#mode 0644
#owner node[:jenkins][:server][:user]
#group node[:jenkins][:server][:group]
#end

cookbook_file "#{node[:jenkins][:server][:home]}/.ssh/known_hosts" do
source "github_keys.pub"
mode 0644
owner node[:jenkins][:server][:user]
group node[:jenkins][:server][:group]
end


execute "ssh-keygen -f #{pkey} -N ''" do
user node[:jenkins][:server][:user]
group node[:jenkins][:server][:group]
Expand All @@ -53,6 +75,13 @@
end
end

template "#{node[:jenkins][:server][:home]}/.gitconfig" do
source "dot_gitconfig.erb"
mode 0664
owner node[:jenkins][:server][:user]
group node[:jenkins][:server][:group]
end

directory "#{node[:jenkins][:server][:home]}/plugins" do
owner node[:jenkins][:server][:user]
group node[:jenkins][:server][:group]
Expand Down
3 changes: 3 additions & 0 deletions templates/default/dot_gitconfig.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[user]
email = <%= node[:jenkins][:build_user_email] %>
name = <%= node[:jenkins][:build_user_name] %>