diff --git a/.expeditor/config.yml b/.expeditor/config.yml new file mode 100644 index 000000000..5b8aa8262 --- /dev/null +++ b/.expeditor/config.yml @@ -0,0 +1,31 @@ +# The name of the product key for this product from mixlib-install +product_key: chefdk + +# Slack channel in Chef Software slack to send notifications about build failures, etc +slack: + notify_channel: chef-notify + +# When a version of ChefDK hits the current channel, build a corresponding Docker image +# and publish that image to https://hub.docker.com/r/chef/chefdk +docker: + enable: true + build_args: + CHANNEL: "{{channel}}" + VERSION: "{{version}}" + +github: + # The file where the MAJOR.MINOR.PATCH version is kept + version_file: "VERSION" + + # When a PR is merged, bump the PATCH version + bump_version_on_merge: true + + # After the PATCH version has been bumped, execute this script + # to distribute that version to other files in the repository. + update_version_script: ".expeditor/update_version.sh" + + # The tag format Expeditor should use when tagging version commits + version_tag_format: "v{{version}}" + + # After the version is bumped and the tag is pushed to Github, trigger a Jenkins build + trigger_build_on_bump: true diff --git a/.expeditor/update_version.sh b/.expeditor/update_version.sh new file mode 100644 index 000000000..62635b94a --- /dev/null +++ b/.expeditor/update_version.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# +# After a PR merge, Chef Expeditor will bump the PATCH version in the VERSION file. +# It then executes this file to update any other files/components with that new version. +# + +set -evx + +# The github-changelog-generator requires that LANG be set +export LANG=en_US.UTF-8 + +# Only install groups required to run the Rake command +export BUNDLE_WITHOUT=omnibus_package:test:aix:bsd:linux:mac_os_x:solaris:windows:default + +# We need to run a bundle install so that our `bundle exec rake` command will work. +gem environment +omnibus_bundler=$(grep bundler omnibus_overrides.rb | cut -d'"' -f2) +gem install bundler -v $omnibus_bundler --user-install --conservative +bundle install + +# Run a rake command that will update various files in chef/chef-dk with the new VERSION +bundle exec rake version:update + +# Run the following commands to update the changelog and dockerfile, but ignore errors. +bundle exec rake changelog:update || true +bundle exec rake update_dockerfile || true + +# Our `rake` command can sometimes modify this file, but we don't care about the +# changes it makes. Reset it to HEAD. +git checkout .bundle/config + +# Once Expeditor finshes executing this script, it will commit the changes and push +# the commit as a new tag corresponding to the value in the VERSION file. diff --git a/VERSION b/VERSION new file mode 100644 index 000000000..227cea215 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +2.0.0 diff --git a/tasks/version.rb b/tasks/version.rb index 730fe5fca..b6a24a6f0 100644 --- a/tasks/version.rb +++ b/tasks/version.rb @@ -42,6 +42,7 @@ desc "Bump patch version in lib/chef-dk/version.rb and update Gemfile*.lock conservatively to include the new version. If Gemfile has changed, this will update modified constraints as well." task :bump => "ci_version_bump" + # Can be deleted when we migrate fully to expeditor desc "Show the current version." task :show do puts version @@ -55,6 +56,10 @@ def version end end + def version_file + File.expand_path("../../VERSION", __FILE__) + end + def version_rb_path File.expand_path("../../lib/chef-dk/version.rb", __FILE__) end @@ -67,6 +72,7 @@ def release_notes_path File.expand_path("../../RELEASE_NOTES.md", __FILE__) end + # Can be deleted when we migrate fully to expeditor # Add 1 to the current patch version in the VERSION file, and write it back out. desc "Bump the patch version in lib/chef-dk/version.rb." task :bump_patch do @@ -80,6 +86,7 @@ def release_notes_path IO.write(version_rb_path, new_version_file) end + # Can be deleted when we migrate fully to expeditor desc "Bump the minor version in lib/chef-dk/version.rb" task :bump_minor do current_version_file = IO.read(version_rb_path) @@ -96,6 +103,7 @@ def release_notes_path Rake::Task["bundle:install"].invoke end + # Can be deleted when we migrate fully to expeditor desc "Bump the major version in lib/chef-dk/version.rb" task :bump_major do current_version_file = IO.read(version_rb_path) @@ -112,6 +120,24 @@ def release_notes_path Rake::Task["bundle:install"].invoke end + # Called from .expeditor/update_version.sh + desc "Propogate the version from VERSION to the necessary parts of the repo" + task :update do + version = IO.read(version_file).chomp + + updated_version_file = IO.read(version_rb_path).sub(/^(\s*VERSION\s*=\s*")(\d+\.\d+\.\d+)/) do + "#{$1}#{version}" + end + + updated_gemfile_lock = IO.read(gemfile_lock_path).gsub!(/^\s*(chef-dk)\s*\((= )?\S+\)\s*$/) do |line| + line.gsub(/\((= )?\d+(\.\d+)+/) { "(#{$1}#{version}" } + end + + IO.write(version_rb_path, updated_version_file) + IO.write(gemfile_lock_path, updated_gemfile_lock) + end + + # Can be deleted when we migrate fully to expeditor desc "Update the Gemfile.lock to include the current chef-dk version" task :update_gemfile_lock do if File.exist?(gemfile_lock_path)