Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Add expeditor #1213

Merged
merged 5 commits into from
Apr 12, 2017
Merged
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
31 changes: 31 additions & 0 deletions .expeditor/config.yml
Original file line number Diff line number Diff line change
@@ -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
33 changes: 33 additions & 0 deletions .expeditor/update_version.sh
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.0.0
26 changes: 26 additions & 0 deletions tasks/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down