Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

save_environment_file added to save the generated environment files a…

…s json files
  • Loading branch information...
commit 79acd9a2fbe7911b868121499f704b94e451269b 1 parent e2bd44d
@mdxp authored
Showing with 15 additions and 3 deletions.
  1. +15 −3 lib/chef/jenkins.rb
View
18 lib/chef/jenkins.rb
@@ -141,8 +141,9 @@ def upload_cookbooks(cookbooks=[])
cu = Chef::Knife::CookbookUpload.new
cu.name_args = cookbooks
cu.config[:environment] = Chef::Config[:jenkins][:env_to]
- cu.config[:freeze] = true
+ cu.config[:freeze] = false
cu.run
+ save_environment_file
end
def prop(env_from=Chef::Config[:jenkins][:env_from], env_to=Chef::Config[:jenkins][:env_to])
@@ -150,13 +151,22 @@ def prop(env_from=Chef::Config[:jenkins][:env_from], env_to=Chef::Config[:jenkin
to = Chef::Environment.load(env_to)
to.cookbook_versions(from.cookbook_versions)
to.save
+ save_environment_file(env_to)
+ end
+
+ def save_environment_file(env_to=Chef::Config[:jenkins][:env_to])
+ Chef::Log.info("Saving environmnent #{env_to} to #{env_to}.json")
+ dir = Chef::Config[:jenkins][:repo_dir]
+ `knife environment show "#{env_to}" -Fj > "#{dir}/environments/#{env_to}.json"`
+
+ @git.add("#{dir}/environments/#{env_to}.json")
+ @git.commit("Updating #{env_to} with the latest cookbook versions", :allow_empty => true)
+ push_to_upstream
end
def sync(cookbook_path=Chef::Config[:cookbook_path], repo_dir=Chef::Config[:jenkins][:repo_dir])
add_upstream
- git_branch(integration_branch_name)
-
cookbooks_to_change = []
last_commit = read_last_commit
@@ -171,6 +181,8 @@ def sync(cookbook_path=Chef::Config[:cookbook_path], repo_dir=Chef::Config[:jenk
exit 0
end
+ git_branch(integration_branch_name)
+
cookbooks_to_change.each do |cookbook|
cookbook_path.each do |path|
metadata_file = File.join(path, cookbook, "metadata.rb")
Please sign in to comment.
Something went wrong with that request. Please try again.