Skip to content

Commit

Permalink
Add gems for stove and chef-stove and wire up expeditor (chef-boneyar…
Browse files Browse the repository at this point in the history
…d#142)

* Add gems for stove and chef-stove and wire up expeditor

We've released this as both so add expeditor to manage that.

Signed-off-by: Tim Smith <[email protected]>

* Use the right gemspec in the Gemfile

Signed-off-by: Tim Smith <[email protected]>
  • Loading branch information
tas50 authored Oct 15, 2019
1 parent 170f7d3 commit 407f7ce
Show file tree
Hide file tree
Showing 10 changed files with 184 additions and 36 deletions.
51 changes: 51 additions & 0 deletions .expeditor/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Documentation available at https://expeditor.chef.io/docs/getting-started/
---
# Slack channel in Chef Software slack to send notifications about build failures, etc
slack:
notify_channel: chef-ws-notify

# This publish is triggered by the `built_in:publish_rubygems` artifact_action.
rubygems:
- stove
- chef-stove

github:
# This deletes the GitHub PR branch after successfully merged into the release branch
delete_branch_on_merge: true
# The tag format to use (e.g. v1.0.0)
version_tag_format: "v{{version}}"
# allow bumping the minor release via label
minor_bump_labels:
- "Expeditor: Bump Version Minor"
# allow bumping the major release via label
major_bump_labels:
- "Expeditor: Bump Version Major"

changelog:
rollup_header: Changes not yet released to rubygems.org

# These actions are taken, in order they are specified, anytime a Pull Request is merged.
merge_actions:
- built_in:bump_version:
ignore_labels:
- "Expeditor: Skip Version Bump"
- "Expeditor: Skip All"
- bash:.expeditor/update_version.sh:
only_if: built_in:bump_version
- built_in:update_changelog:
ignore_labels:
- "Expeditor: Exclude From Changelog"
- "Expeditor: Skip All"
- built_in:build_gem:
only_if:
- built_in:bump_version

pipelines:
- verify:
description: Pull Request validation tests
public: true

promote:
actions:
- built_in:rollover_changelog
- built_in:publish_rubygems
44 changes: 44 additions & 0 deletions .expeditor/run_linux_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
#
# This script runs a passed in command, but first setups up the bundler caching on the repo

set -e

export USER="root"

# make sure we have the aws cli
apt-get update -y
apt-get install awscli -y

# grab the s3 bundler if it's there and use it for all operations in bundler
echo "Fetching bundle cache archive from s3://public-cd-buildkite-cache/${BUILDKITE_PIPELINE_SLUG}/${BUILDKITE_LABEL}/bundle.tar.bz2"
aws s3 cp "s3://public-cd-buildkite-cache/${BUILDKITE_PIPELINE_SLUG}/${BUILDKITE_LABEL}/bundle.tar.bz2" bundle.tar.bz2 || echo 'Could not pull the bundler archive from s3 for caching. Builds may be slower than usual as all gems will have to install.'
aws s3 cp "s3://public-cd-buildkite-cache/${BUILDKITE_PIPELINE_SLUG}/${BUILDKITE_LABEL}/bundle.sha256" bundle.sha256 || echo "Could not pull the sha256 hash of the vendor/bundle directory from s3. Without this we will compress and upload the bundler archive to S3 even if it hasn't changed"

echo "Restoring the bundle cache archive to vendor/bundle"
if [ -f bundle.tar.bz2 ]; then
tar -xjf bundle.tar.bz2
fi
bundle config --local path vendor/bundle

bundle install --jobs=7 --retry=3
bundle exec $1

if [[ -f bundle.tar.bz2 && -f bundle.sha256 ]]; then # dont' check the sha if we're missing either file
if shasum --check bundle.sha256 --status; then # if the the sha matches we're done
echo "Bundled gems have not changed. Skipping upload to s3"
exit
fi
fi

echo "Generating sha256 hash file of the vendor/bundle directory to ship to s3"
shasum -a 256 vendor/bundle > bundle.sha256

echo "Creating the tar.bz2 to of the vendor/bundle directory to ship to s3"
tar -cjf bundle.tar.bz2 vendor/

echo "Uploading the tar.bz2 of the vendor/bundle directory to s3"
aws s3 cp bundle.tar.bz2 "s3://public-cd-buildkite-cache/${BUILDKITE_PIPELINE_SLUG}/${BUILDKITE_LABEL}/bundle.tar.bz2" || echo 'Could not push the bundler directory to s3 for caching. Future builds may be slower if this continues.'

echo "Uploading the sha256 hash of the vendor/bundle directory to s3"
aws s3 cp bundle.sha256 "s3://public-cd-buildkite-cache/${BUILDKITE_PIPELINE_SLUG}/${BUILDKITE_LABEL}/bundle.sha256" || echo 'Could not push the bundler directory to s3 for caching. Future builds may be slower if this continues.'
12 changes: 12 additions & 0 deletions .expeditor/update_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
#
# 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

sed -i -r "s/^(\s*)VERSION = \".+\"/\1VERSION = \"$(cat VERSION)\"/" lib/chef_core/version.rb

# 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.
25 changes: 25 additions & 0 deletions .expeditor/verify.pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
steps:

- label: run-specs-ruby-2.4
command:
- .expeditor/run_linux_tests.sh "rake"
expeditor:
executor:
docker:
image: ruby:2.4-buster

- label: run-specs-ruby-2.5
command:
- .expeditor/run_linux_tests.sh "rake"
expeditor:
executor:
docker:
image: ruby:2.5-buster

- label: run-specs-ruby-2.6
command:
- .expeditor/run_linux_tests.sh "rake"
expeditor:
executor:
docker:
image: ruby:2.6-buster
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

This is the Changelog for the Stove gem.

<!-- latest_release -->
<!-- latest_release -->

<!-- release_rollup -->
<!-- release_rollup -->

<!-- latest_stable_release -->
## v7.1.1

- Release as chef-stove

<!-- latest_stable_release -->
## v7.1.0

- Removed support for Ruby 2.2 as it is now a end of life Ruby release.
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
source 'https://rubygems.org'
gemspec
gemspec name: 'stove'

# testing compatibility
gem 'rack', '< 2'
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.1.1
37 changes: 3 additions & 34 deletions chef-stove.gemspec
Original file line number Diff line number Diff line change
@@ -1,34 +1,3 @@
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'stove/version'

Gem::Specification.new do |spec|
spec.name = 'chef-stove'
spec.version = Stove::VERSION
spec.authors = ['Seth Vargo', 'Tim Smith']
spec.email = ['[email protected]', '[email protected]']
spec.description = "A utility for releasing Chef community cookbooks"
spec.summary = "A command-line utility for releasing Chef community cookbooks"
spec.homepage = 'https://github.com/chef/stove'
spec.license = 'Apache-2.0'

spec.files = %w{LICENSE} + Dir.glob("{lib,bin,templates}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) }
spec.bindir = 'bin'
spec.executables = 'stove'
spec.require_paths = ['lib']

spec.required_ruby_version = '>= 2.3'

# Runtime dependencies
spec.add_dependency 'chef-infra-api', '~> 0.5'
spec.add_dependency 'logify', '~> 0.2'

spec.add_development_dependency 'aruba', '~> 0.6.0'
spec.add_development_dependency 'bundler'
spec.add_development_dependency 'chef-community-zero', '~> 2.0'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'rspec-command', '~> 1.0'
spec.add_development_dependency 'webmock', '~> 3.0'
end
gemspec = eval(IO.read(File.expand_path("../stove.gemspec", __FILE__)))
gemspec.name = "chef-stove"
gemspec
2 changes: 1 addition & 1 deletion lib/stove/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Stove
VERSION = '7.1.1'
VERSION = "7.1.1".freeze
end
34 changes: 34 additions & 0 deletions stove.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'stove/version'

Gem::Specification.new do |spec|
spec.name = 'stove'
spec.version = Stove::VERSION
spec.authors = ['Seth Vargo', 'Tim Smith']
spec.email = ['[email protected]', '[email protected]']
spec.description = "A utility for releasing Chef community cookbooks"
spec.summary = "A command-line utility for releasing Chef community cookbooks"
spec.homepage = 'https://github.com/chef/stove'
spec.license = 'Apache-2.0'

spec.files = %w{LICENSE} + Dir.glob("{lib,bin,templates}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) }
spec.bindir = 'bin'
spec.executables = 'stove'
spec.require_paths = ['lib']

spec.required_ruby_version = '>= 2.3'

# Runtime dependencies
spec.add_dependency 'chef-infra-api', '~> 0.5'
spec.add_dependency 'logify', '~> 0.2'

spec.add_development_dependency 'aruba', '~> 0.6.0'
spec.add_development_dependency 'bundler'
spec.add_development_dependency 'chef-community-zero', '~> 2.0'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'rspec-command', '~> 1.0'
spec.add_development_dependency 'webmock', '~> 3.0'
end

0 comments on commit 407f7ce

Please sign in to comment.