Merge pull request #10921 from chrisroberts/new-circle
Update circle configuration
This commit is contained in:
commit
263203e47c
|
@ -1,5 +1,128 @@
|
||||||
version: 2
|
version: 2
|
||||||
|
reference:
|
||||||
|
environment: &ENVIRONMENT
|
||||||
|
SLACK_TITLE: Vagrant CI
|
||||||
|
RELEASE_TARGET_REPONAME: vagrant-installers
|
||||||
|
images:
|
||||||
|
ruby23: &ruby23
|
||||||
|
docker:
|
||||||
|
- image: circleci/ruby:2.3
|
||||||
|
ruby24: &ruby24
|
||||||
|
docker:
|
||||||
|
- image: circleci/ruby:2.4
|
||||||
|
ruby25: &ruby25
|
||||||
|
docker:
|
||||||
|
- image: circleci/ruby:2.5
|
||||||
|
ruby26: &ruby26
|
||||||
|
docker:
|
||||||
|
- image: circleci/ruby:2.6
|
||||||
|
builder: &builder
|
||||||
|
environment:
|
||||||
|
<<: *ENVIRONMENT
|
||||||
|
docker:
|
||||||
|
- image: $BUILDER_IMAGE
|
||||||
|
auth:
|
||||||
|
username: $BUILDER_USERNAME
|
||||||
|
password: $BUILDER_PASSWORD
|
||||||
|
workflows:
|
||||||
|
public: &PUBLIC_WORKFLOW
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
only: /^pull\/.*/
|
||||||
|
master: &MASTER_WORKFLOW
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
only: master
|
||||||
|
private_build: &PRIVATE_WORKFLOW_BUILD
|
||||||
|
context: vagrant
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- /^build-.*/
|
||||||
|
tags:
|
||||||
|
only: /.*/
|
||||||
|
jobs:
|
||||||
|
private_failure: &PRIVATE_FAILURE
|
||||||
|
run:
|
||||||
|
name: Failure handler
|
||||||
|
command: |
|
||||||
|
if [ -f .output ]; then
|
||||||
|
slack -m "Vagrant job has failed: *${CIRCLE_JOB}*" -s error -f .output -T 5
|
||||||
|
else
|
||||||
|
slack -m "Vagrant job has failed: *${CIRCLE_JOB}*" -s error
|
||||||
|
fi
|
||||||
|
when: on_fail
|
||||||
|
unit_tests: &unit_tests
|
||||||
|
steps:
|
||||||
|
- run: sudo apt-get update ; sudo apt-get -yq install bsdtar
|
||||||
|
- checkout
|
||||||
|
- restore_cache:
|
||||||
|
key: static-site-gems-v1-{{ checksum "Gemfile.lock" }}
|
||||||
|
- run:
|
||||||
|
command: bundle check || bundle install --path vendor/bundle
|
||||||
|
- save_cache:
|
||||||
|
key: static-site-gems-v1-{{ checksum "Gemfile.lock" }}
|
||||||
|
paths:
|
||||||
|
- ./vendor/bundle
|
||||||
|
- run: bundle exec rake test:unit
|
||||||
jobs:
|
jobs:
|
||||||
|
build:
|
||||||
|
<<: *builder
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: gem build vagrant.gemspec
|
||||||
|
- *PRIVATE_FAILURE
|
||||||
|
- persist_to_workspace:
|
||||||
|
root: .
|
||||||
|
paths:
|
||||||
|
- ./*.gem
|
||||||
|
store:
|
||||||
|
<<: *builder
|
||||||
|
steps:
|
||||||
|
- attach_workspace:
|
||||||
|
at: .
|
||||||
|
- run: |
|
||||||
|
if [[ "${CIRCLE_BRANCH}" = "build-"* ]]; then
|
||||||
|
s3_dst="${ASSETS_PRIVATE_BUCKET}/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/${CIRCLE_BRANCH##build-}/"
|
||||||
|
else
|
||||||
|
s3_dst="${ASSETS_PRIVATE_BUCKET}/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/"
|
||||||
|
fi
|
||||||
|
s3_dst="${ASSETS_PRIVATE_BUCKET}/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/${CIRCLE_TAG}/"
|
||||||
|
aws s3 cp ./vagrant-*.gem "${s3_dst}" > .output 2>&1
|
||||||
|
- *PRIVATE_FAILURE
|
||||||
|
release:
|
||||||
|
<<: *builder
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- attach_workspace:
|
||||||
|
at: .
|
||||||
|
- run: |
|
||||||
|
set +e
|
||||||
|
gem=(vagrant-*.gem)
|
||||||
|
gem_version="${gem##vagrant-}"
|
||||||
|
gem_version="${gem_version%%.gem}"
|
||||||
|
export GITHUB_TOKEN="${HASHIBOT_TOKEN}"
|
||||||
|
if [ "${CIRCLE_TAG}" = "" ]; then
|
||||||
|
version="v${gem_version}+$(git rev-parse --short "${CIRCLE_SHA1}")"
|
||||||
|
ghr -u ${CIRCLE_PROJECT_USERNAME} -r ${RELEASE_TARGET_REPONAME} -c master -prerelease -delete -replace ${version} ${gem} > .output 2>&1
|
||||||
|
else
|
||||||
|
version="${CIRCLE_TAG}"
|
||||||
|
ghr -u ${CIRCLE_PROJECT_USERNAME} -r ${RELEASE_TARGET_REPONAME} -c master -delete -replace ${version} ${gem} > .output 2>&1
|
||||||
|
fi
|
||||||
|
slack -m "New Vagrant installers release triggered: *${version}*"
|
||||||
|
- *PRIVATE_FAILURE
|
||||||
|
test_ruby23:
|
||||||
|
<<: *ruby23
|
||||||
|
<<: *unit_tests
|
||||||
|
test_ruby24:
|
||||||
|
<<: *ruby24
|
||||||
|
<<: *unit_tests
|
||||||
|
test_ruby25:
|
||||||
|
<<: *ruby25
|
||||||
|
<<: *unit_tests
|
||||||
|
test_ruby26:
|
||||||
|
<<: *ruby26
|
||||||
|
<<: *unit_tests
|
||||||
build-website:
|
build-website:
|
||||||
# setting the working_directory along with the checkout path allows us to not have
|
# setting the working_directory along with the checkout path allows us to not have
|
||||||
# to cd into the website/ directory for commands
|
# to cd into the website/ directory for commands
|
||||||
|
@ -9,30 +132,65 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- checkout:
|
- checkout:
|
||||||
path: ~/project
|
path: ~/project
|
||||||
|
|
||||||
# restores gem cache
|
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: static-site-gems-v1-{{ checksum "Gemfile.lock" }}
|
key: static-site-gems-v1-{{ checksum "Gemfile.lock" }}
|
||||||
|
|
||||||
- run:
|
- run:
|
||||||
command: bundle check || bundle install --path vendor/bundle
|
command: bundle check || bundle install --path vendor/bundle
|
||||||
|
|
||||||
# saves gem cache if we have changed the Gemfile
|
|
||||||
- save_cache:
|
- save_cache:
|
||||||
key: static-site-gems-v1-{{ checksum "Gemfile.lock" }}
|
key: static-site-gems-v1-{{ checksum "Gemfile.lock" }}
|
||||||
paths:
|
paths:
|
||||||
- ~/project/website/vendor/bundle
|
- ~/project/website/vendor/bundle
|
||||||
|
|
||||||
# middleman build
|
|
||||||
- run:
|
- run:
|
||||||
command: bundle exec middleman build
|
command: bundle exec middleman build
|
||||||
|
|
||||||
# website deploy
|
|
||||||
- run:
|
- run:
|
||||||
command: ./scripts/deploy.sh
|
command: ./scripts/deploy.sh
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
|
builds:
|
||||||
|
jobs:
|
||||||
|
- build:
|
||||||
|
<<: *PRIVATE_WORKFLOW_BUILD
|
||||||
|
- store:
|
||||||
|
<<: *PRIVATE_WORKFLOW_BUILD
|
||||||
|
requires:
|
||||||
|
- build
|
||||||
|
- release:
|
||||||
|
<<: *PRIVATE_WORKFLOW_BUILD
|
||||||
|
requires:
|
||||||
|
- build
|
||||||
|
pull_requests:
|
||||||
|
jobs:
|
||||||
|
- test_ruby23:
|
||||||
|
<<: *PUBLIC_WORKFLOW
|
||||||
|
- test_ruby24:
|
||||||
|
<<: *PUBLIC_WORKFLOW
|
||||||
|
- test_ruby25:
|
||||||
|
<<: *PUBLIC_WORKFLOW
|
||||||
|
- test_ruby26:
|
||||||
|
<<: *PUBLIC_WORKFLOW
|
||||||
|
master:
|
||||||
|
jobs:
|
||||||
|
- test_ruby23:
|
||||||
|
<<: *MASTER_WORKFLOW
|
||||||
|
- test_ruby24:
|
||||||
|
<<: *MASTER_WORKFLOW
|
||||||
|
- test_ruby25:
|
||||||
|
<<: *MASTER_WORKFLOW
|
||||||
|
- test_ruby26:
|
||||||
|
<<: *MASTER_WORKFLOW
|
||||||
|
- build:
|
||||||
|
<<: *MASTER_WORKFLOW
|
||||||
|
context: vagrant
|
||||||
|
requires:
|
||||||
|
- test_ruby23
|
||||||
|
- test_ruby24
|
||||||
|
- test_ruby25
|
||||||
|
- test_ruby26
|
||||||
|
- store:
|
||||||
|
<<: *MASTER_WORKFLOW
|
||||||
|
context: vagrant
|
||||||
|
requires:
|
||||||
|
- build
|
||||||
website:
|
website:
|
||||||
jobs:
|
jobs:
|
||||||
- build-website:
|
- build-website:
|
||||||
|
|
|
@ -41,6 +41,10 @@ RSpec.configure do |c|
|
||||||
c.filter_run_excluding :windows
|
c.filter_run_excluding :windows
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if !Vagrant::Util::Which.which("bsdtar")
|
||||||
|
c.filter_run_excluding :bsdtar
|
||||||
|
end
|
||||||
|
|
||||||
c.after(:suite) do
|
c.after(:suite) do
|
||||||
FileUtils.rm_rf(VAGRANT_TEST_CWD)
|
FileUtils.rm_rf(VAGRANT_TEST_CWD)
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,8 +21,6 @@ describe VagrantPlugins::DockerProvider::Provider do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe ".usable?" do
|
describe ".usable?" do
|
||||||
subject { described_class.new(machine) }
|
|
||||||
|
|
||||||
it "returns true if usable" do
|
it "returns true if usable" do
|
||||||
allow(provider_config).to receive(:compose).and_return(false)
|
allow(provider_config).to receive(:compose).and_return(false)
|
||||||
allow(subject.driver).to receive(:execute).with("docker", "version").and_return(true)
|
allow(subject.driver).to receive(:execute).with("docker", "version").and_return(true)
|
||||||
|
@ -53,9 +51,10 @@ describe VagrantPlugins::DockerProvider::Provider do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#state" do
|
describe "#state" do
|
||||||
|
before { allow(subject).to receive(:driver).and_return(driver_obj) }
|
||||||
|
|
||||||
it "returns not_created if no ID" do
|
it "returns not_created if no ID" do
|
||||||
allow(machine).to receive(:id).and_return(nil)
|
allow(machine).to receive(:id).and_return(nil)
|
||||||
|
|
||||||
expect(subject.state.id).to eq(:not_created)
|
expect(subject.state.id).to eq(:not_created)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -63,7 +62,8 @@ describe VagrantPlugins::DockerProvider::Provider do
|
||||||
allow(provider_config).to receive(:compose).and_return(false)
|
allow(provider_config).to receive(:compose).and_return(false)
|
||||||
allow(platform).to receive(:windows?).and_return(false)
|
allow(platform).to receive(:windows?).and_return(false)
|
||||||
allow(platform).to receive(:darwin?).and_return(false)
|
allow(platform).to receive(:darwin?).and_return(false)
|
||||||
allow(machine).to receive(:id).and_return("foo")
|
expect(machine).to receive(:id).and_return("foo")
|
||||||
|
expect(driver_obj).to receive(:created?).with("foo").and_return(false)
|
||||||
|
|
||||||
expect(subject.state.id).to eq(:not_created)
|
expect(subject.state.id).to eq(:not_created)
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,7 +10,7 @@ require File.expand_path("../../../../base", __FILE__)
|
||||||
|
|
||||||
require "vagrant/util/file_checksum"
|
require "vagrant/util/file_checksum"
|
||||||
|
|
||||||
describe Vagrant::Action::Builtin::BoxAdd, :skip_windows do
|
describe Vagrant::Action::Builtin::BoxAdd, :skip_windows, :bsdtar do
|
||||||
include_context "unit"
|
include_context "unit"
|
||||||
|
|
||||||
let(:app) { lambda { |env| } }
|
let(:app) { lambda { |env| } }
|
||||||
|
|
|
@ -320,7 +320,7 @@ describe Vagrant::Box, :skip_windows do
|
||||||
FileUtils.rm_rf(scratch)
|
FileUtils.rm_rf(scratch)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should repackage the box" do
|
it "should repackage the box", :bsdtar do
|
||||||
test_file_contents = "hello, world!"
|
test_file_contents = "hello, world!"
|
||||||
|
|
||||||
# Put a file in the box directory to verify it is packaged properly
|
# Put a file in the box directory to verify it is packaged properly
|
||||||
|
|
Loading…
Reference in New Issue