...
 
Commits (17)
/bundle/*
/cache/*
/chef*
/chef-zero*
/inspec*
/omnibus-software*
This diff is collapsed.
#!/bin/bash -e
#
# Author:: Lance Albertson <lance@osuosl.org>
# Copyright:: Copyright 2020, Cinc Project
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
TOP_DIR="$(pwd)"
export CI_PROJECT_DIR=${CI_PROJECT_DIR:-${TOP_DIR}}
source /home/omnibus/load-omnibus-toolchain.sh
set -ex
cd chef/omnibus
bundle install --without development --path ${CI_PROJECT_DIR}/bundle/vendor
bundle exec omnibus build cinc --override append_timestamp:false
......@@ -15,7 +15,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
name="$(basename ${0/chef/cinc})"
if [ "$(basename $0)" == "inspec" ] ; then
name="cinc-auditor"
else
name="$(basename ${0/chef/cinc})"
fi
echo "Redirecting to ${name}..."
exec /opt/cinc/bin/${name} $@
#!/bin/bash -e
#
# Author:: Lance Albertson <lance@osuosl.org>
# Copyright:: Copyright 2019, Cinc Project
# Copyright:: Copyright 2019-2020, Cinc Project
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
......@@ -17,31 +17,33 @@
# limitations under the License.
# This will patch Chef using Cinc branded patches
git_patch() {
if [ -n "${2}" ] ; then
CINC_BRANCH="${2}"
elif [ "${REF}" == "master" -o "${REF}" == "chef-15" -o -z "${REF}" ] ; then
CINC_BRANCH="stable/cinc"
else
CINC_BRANCH="stable/cinc-${REF}"
fi
echo "Patching ${1} from ${CINC_BRANCH}..."
git remote add -f --no-tags -t ${CINC_BRANCH} cinc https://gitlab.com/cinc-project/${1}.git
git merge --no-edit cinc/${CINC_BRANCH}
}
TOP_DIR="$(pwd)"
source /home/omnibus/load-omnibus-toolchain.sh
set -ex
# remove any previous builds
rm -rf chef omnibus-software
git config --global user.email || git config --global user.email "maintainers@cinc.sh"
echo "Cloning ${REF:-chef-15} branch from ${ORIGIN:-https://github.com/chef/chef.git}"
git clone -q --depth=1 -b ${REF:-chef-15} ${ORIGIN:-https://github.com/chef/chef.git}
git clone -q -b ${REF:-chef-15} ${ORIGIN:-https://github.com/chef/chef.git}
cd chef
echo "Patching chef..."
for patch in $(find ${TOP_DIR}/patches/chef/ -type f | sort) ; do
patch -p1 < $patch
done
git_patch chef
cd omnibus
echo "Cloning omnibus-software..."
ruby ${TOP_DIR}/scripts/checkout-omnibus-software.rb
ruby ${TOP_DIR}/scripts/checkout.rb -n omnibus-software -p $TOP_DIR
cd $TOP_DIR/omnibus-software
echo "Patching omnibus-software..."
for patch in $(find ${TOP_DIR}/patches/omnibus-software/ -type f | sort) ; do
patch -p1 < $patch
done
git_patch omnibus-software
cd $TOP_DIR
echo "Copying Cinc resources..."
cp -rp cinc/* chef/
echo "Updating omnibus configuration..."
mkdir -p ${CI_PROJECT_DIR:-$TOP_DIR}/{cache,cache/git_cache}
echo "cache_dir '${CI_PROJECT_DIR:-$TOP_DIR}/cache'" >> chef/omnibus/omnibus.rb
echo "git_cache_dir '${CI_PROJECT_DIR:-$TOP_DIR}/cache/git_cache'" >> chef/omnibus/omnibus.rb
sed -i -e 's/^use_git_caching false/use_git_caching true/g' chef/omnibus/omnibus.rb
From bc961b09c94be1f80156844d40da12b98fda7a33 Mon Sep 17 00:00:00 2001
From: Lance Albertson <lance@osuosl.org>
Date: Tue, 4 Jun 2019 14:04:38 -0700
Subject: [PATCH] Cinc stable patches
---
chef-bin/chef-bin.gemspec | 2 +-
chef-config/lib/chef-config/dist.rb | 10 +++++-----
lib/chef/dist.rb | 22 +++++++++++-----------
3 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/chef-bin/chef-bin.gemspec b/chef-bin/chef-bin.gemspec
index 66d14f3f5..832ca205f 100644
--- a/chef-bin/chef-bin.gemspec
+++ b/chef-bin/chef-bin.gemspec
@@ -22,5 +22,5 @@ Gem::Specification.new do |spec|
Dir.glob("{lib}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) }
spec.bindir = "bin"
- spec.executables = %w{ chef-apply chef-client chef-resource-inspector chef-service-manager chef-shell chef-solo chef-windows-service }
+ spec.executables = %w{ cinc-apply cinc-client cinc-resource-inspector cinc-service-manager cinc-shell cinc-solo cinc-windows-service }
end
diff --git a/chef-config/lib/chef-config/dist.rb b/chef-config/lib/chef-config/dist.rb
index d46c9c99d..fabb95a1f 100644
--- a/chef-config/lib/chef-config/dist.rb
+++ b/chef-config/lib/chef-config/dist.rb
@@ -1,19 +1,19 @@
module ChefConfig
class Dist
# The chef executable name.
- EXEC = "chef".freeze
+ EXEC = "cinc".freeze
# The client's alias (chef-client)
- CLIENT = "chef-client".freeze
+ CLIENT = "cinc-client".freeze
# A short name for the product
- SHORT = "chef".freeze
+ SHORT = "cinc".freeze
# The suffix for Chef's /etc/chef, /var/chef and C:\\Chef directories
# "cinc" => /etc/cinc, /var/cinc, C:\\cinc
- DIR_SUFFIX = "chef".freeze
+ DIR_SUFFIX = "cinc".freeze
# The user's configuration directory
- USER_CONF_DIR = ".chef".freeze
+ USER_CONF_DIR = ".cinc".freeze
end
end
diff --git a/lib/chef/dist.rb b/lib/chef/dist.rb
index f5f63103f..140434e4a 100644
--- a/lib/chef/dist.rb
+++ b/lib/chef/dist.rb
@@ -5,48 +5,48 @@ class Chef
# This class is not fully implemented, depending on it is not recommended!
# When referencing a product directly, like Chef (Now Chef Infra)
- PRODUCT = "Chef Infra Client".freeze
+ PRODUCT = "Cinc Client".freeze
# A short designation for the product, used in Windows event logs
# and some nomenclature.
SHORT = ChefConfig::Dist::SHORT.freeze
# The name of the server product
- SERVER_PRODUCT = "Chef Infra Server".freeze
+ SERVER_PRODUCT = "Cinc Server".freeze
# The client's alias (chef-client)
CLIENT = ChefConfig::Dist::CLIENT.freeze
# name of the automate product
- AUTOMATE = "Chef Automate".freeze
+ AUTOMATE = "Cinc Dashboard".freeze
# The chef executable, as in `chef gem install` or `chef generate cookbook`
EXEC = ChefConfig::Dist::EXEC.freeze
# product website address
- WEBSITE = "https://chef.io".freeze
+ WEBSITE = "https://gitlab.com/cinc-project/organization-subjects/wikis/home".freeze
# Chef-Zero's product name
- ZERO = "Chef Infra Zero".freeze
+ ZERO = "Cinc Zero".freeze
# Chef-Solo's product name
- SOLO = "Chef Infra Solo".freeze
+ SOLO = "Cinc Solo".freeze
# The chef-zero executable (local mode)
- ZEROEXEC = "chef-zero".freeze
+ ZEROEXEC = "cinc-zero".freeze
# The chef-solo executable (legacy local mode)
- SOLOEXEC = "chef-solo".freeze
+ SOLOEXEC = "cinc-solo".freeze
# The chef-shell executable
- SHELL = "chef-shell".freeze
+ SHELL = "cinc-shell".freeze
# The chef-apply executable
APPLY = "chef-apply".freeze
# Configuration related constants
# The chef-shell configuration file
- SHELL_CONF = "chef_shell.rb".freeze
+ SHELL_CONF = "cinc_shell.rb".freeze
# The configuration directory
CONF_DIR = ChefConfig::Config.etc_chef_dir.freeze
@@ -55,6 +55,6 @@ class Chef
USER_CONF_DIR = ChefConfig::Dist::USER_CONF_DIR.freeze
# The server's configuration directory
- SERVER_CONF_DIR = "/etc/chef-server".freeze
+ SERVER_CONF_DIR = "/etc/cinc-server".freeze
end
end
This diff is collapsed.
From 3064d84fea88c9933fe4b7f06b54fa57b0868c02 Mon Sep 17 00:00:00 2001
From: Marc Chamberland <chamberland.marc@gmail.com>
Date: Sat, 25 Jan 2020 16:55:25 -0500
Subject: [PATCH] revert to "chef"
Signed-off-by: Marc Chamberland <chamberland.marc@gmail.com>
---
chef-config/lib/chef-config/config.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/chef-config/lib/chef-config/config.rb b/chef-config/lib/chef-config/config.rb
index b2dff9a76..484e1ea2f 100644
--- a/chef-config/lib/chef-config/config.rb
+++ b/chef-config/lib/chef-config/config.rb
@@ -471,7 +471,7 @@ module ChefConfig
# When set to a String, Chef Zero disables multitenant support. This is
# what you want when using Chef Zero to serve a single Chef Repo. Setting
# this to `false` enables multi-tenant.
- default :single_org, ChefConfig::Dist::SHORT
+ default :single_org, "chef"
# Whether Chef Zero should operate in a mode analogous to OSS Chef Server
# 11 (true) or Chef Server 12 (false). Chef Zero can still serve
From b00c4f5e22cb4c0c6e185a203f6a57616c9d8d80 Mon Sep 17 00:00:00 2001
From: Lance Albertson <lance@osuosl.org>
Date: Sat, 5 Oct 2019 13:10:38 -0700
Subject: [PATCH] Stable Cinc patches
---
config/software/chef.rb | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/config/software/chef.rb b/config/software/chef.rb
index 42f8375..3bcb17f 100644
--- a/config/software/chef.rb
+++ b/config/software/chef.rb
@@ -1,5 +1,6 @@
#
# Copyright 2012-2019, Chef Software Inc.
+# Copyright 2019, Cinc Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -110,4 +111,9 @@ build do
remove_directory "#{gem_install_dir}/test"
end
end
+
+ copy "#{project_dir}/cinc/cinc-wrapper", "#{install_dir}/bin/"
+ %w(chef-apply chef-client chef-shell chef-solo).each do |bin|
+ link "#{install_dir}/bin/cinc-wrapper", "#{install_dir}/bin/#{bin}"
+ end
end
From b442301e59d968ad6fbbcb8a9d5efaf51e419098 Mon Sep 17 00:00:00 2001
From: Lance Albertson <lance@osuosl.org>
Date: Sat, 5 Oct 2019 17:11:28 -0700
Subject: [PATCH] Cinc branded chef-zero
---
config/software/chef-zero.rb | 40 ++++++++++++++++++++++++++++++++++++++++
config/software/chef.rb | 1 +
2 files changed, 41 insertions(+)
create mode 100644 config/software/chef-zero.rb
diff --git a/config/software/chef-zero.rb b/config/software/chef-zero.rb
new file mode 100644
index 0000000..9e49ba4
--- /dev/null
+++ b/config/software/chef-zero.rb
@@ -0,0 +1,40 @@
+#
+# Copyright:: Copyright (c) 2019 Cinc Project
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+name "chef-zero"
+default_version "stable/cinc"
+
+license "Apache-2.0"
+license_file "LICENSE"
+
+source git: "https://gitlab.com/cinc-project/chef-zero.git"
+
+relative_path "chef-zero"
+
+dependency "ruby"
+dependency "rubygems"
+dependency "bundler"
+
+build do
+ env = with_standard_compiler_flags(with_embedded_path)
+
+ bundle "install --without development chef pedant debug test", env: env
+
+ gem "build chef-zero.gemspec", env: env
+ gem "install chef-zero*.gem" \
+ " --no-document", env: env
+end
diff --git a/config/software/chef.rb b/config/software/chef.rb
index 3bcb17f..f162ed5 100644
--- a/config/software/chef.rb
+++ b/config/software/chef.rb
@@ -54,6 +54,7 @@ dependency "bundler"
dependency "ohai"
dependency "appbundler"
dependency "libarchive" # for archive resource
+dependency "chef-zero"
build do
env = with_standard_compiler_flags(with_embedded_path)
#!/bin/bash -e
#
# Author:: Lance Albertson <lance@osuosl.org>
# Copyright:: Copyright 2020, Cinc Project
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
TOP_DIR="$(pwd)"
export PATH="/opt/omnibus-toolchain/embedded/bin/:${PATH}"
package_cloud_push () {
package_cloud push cinc-project/${CHANNEL:-unstable} $@
}
source /home/omnibus/load-omnibus-toolchain.sh
set -x
gem install -N package_cloud
cd ${TOP_DIR}/chef/chef-utils
gem build chef-utils.gemspec
# chef gem requires chef-utils to build the gems
gem install -N chef-utils-[0-9]*.gem
cd ${TOP_DIR}/chef
gem build chef.gemspec
cd ${TOP_DIR}/chef/chef-bin
gem build chef-bin.gemspec
cd ${TOP_DIR}/chef/chef-config
gem build chef-config.gemspec
cd $TOP_DIR/chef
package_cloud_push chef-[0-9]*.gem
package_cloud_push chef-bin/chef-bin-[0-9]*.gem
package_cloud_push chef-config/chef-config-[0-9]*.gem
package_cloud_push chef-utils/chef-utils-[0-9]*.gem
#!/usr/bin/env ruby
#
# Author:: Lance Albertson <lance@osuosl.org>
# Copyright:: Copyright 2019, Cinc Project
# Copyright:: Copyright 2019-2020, Cinc Project
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
......@@ -23,19 +23,46 @@
require "bundler"
require "mixlib/shellout"
require "optparse"
options = {}
OptionParser.new do |opts|
opts.on("-r=REPO")
opts.on("-n=NAME")
opts.on("-g=GEM")
opts.on("-p=PATH")
end.parse!(into: options)
gemfile = File.read("Gemfile.lock")
sources = Bundler::LockfileParser.new(gemfile).sources
sources.each do |source|
if source.to_s =~ /omnibus-software/
origin = source.to_s.split(" ")[0]
ref = source.to_s.gsub(/[()]/, "").split(" ")[2].split("@")[1]
# puts "git clone --depth=1 -b #{ref} #{origin}"
git_clone = Mixlib::ShellOut.new("git clone #{origin}", cwd: "../../")
git_checkout = Mixlib::ShellOut.new("git checkout #{ref}", cwd: "../../omnibus-software/")
git_clone.run_command
git_clone.error!
git_checkout.run_command
git_checkout.error!
specs = Bundler::LockfileParser.new(gemfile).specs
def checkout(name, origin, ref, path)
puts "Cloning #{name} from #{origin} at #{ref} to #{path}/#{name}"
git_clone = Mixlib::ShellOut.new("git clone #{origin}", cwd: path)
git_checkout = Mixlib::ShellOut.new("git checkout #{ref}", cwd: "#{path}/#{name}")
git_clone.run_command
git_clone.error!
git_checkout.run_command
git_checkout.error!
end
gem_name = options[:g].nil? ? options[:n] : options[:g]
if options[:r].nil?
sources.each do |source|
if source.to_s =~ /#{gem_name}/
origin = source.to_s.split(" ")[0]
ref = source.to_s.gsub(/[()]/, "").split(" ")[2].split("@")[1]
checkout(options[:n], origin, ref, options[:p])
end
end
else
specs.each do |spec|
if spec.name =~ /^#{gem_name}$/
origin = options[:r]
ref = "v#{spec.version.to_s}"
checkout(options[:n], origin, ref, options[:p])
end
end
end
describe command 'cinc-client --version' do
its('exit_status') { should eq 0 }
its('stdout') { should match /^Cinc Client:/ }
end
describe command 'cinc-solo --version' do
its('exit_status') { should eq 0 }
its('stdout') { should match /^Cinc Client:/ }
end
platform = os.family
describe command 'cinc-solo -l info' do
its('exit_status') { should eq 0 }
its('stdout') { should match /Cinc Zero/ }
its('stdout') { should match /Cinc Client/ }
its('stdout') { should match /Cinc-client/ }
its('stdout') { should_not match /Chef Infra Zero/ }
its('stdout') { should_not match /Chef Infra Client/ }
its('stdout') { should_not match /Chef-client/ }
if platform == 'windows'
its('stdout') { should match %r{C:/cinc/client.rb.} }
its('stdout') { should match %r{C:/cinc} }
its('stdout') { should_not match %r{C:/chef/client.rb} }
its('stdout') { should_not match %r{C:/chef} }
else
its('stdout') { should match %r{/etc/cinc/client.rb} }
its('stdout') { should match %r{/var/cinc} }
its('stdout') { should_not match %r{/etc/chef/client.rb} }
its('stdout') { should_not match %r{/var/chef} }
end
end
if platform == 'windows'
describe command 'C:\cinc-project\cinc\embedded\bin\cinc-zero.bat --version' do
its('exit_status') { should eq 0 }
end
describe command 'cinc-auditor.bat version' do
its('exit_status') { should eq 0 }
end
describe command 'cinc-auditor.bat detect' do
its('exit_status') { should eq 0 }
end
else
describe command 'chef-solo -l info' do
its('exit_status') { should eq 0 }
its('stdout') { should match /^Redirecting to cinc-solo/ }
its('stdout') { should match /Cinc Zero/ }
its('stdout') { should match /Cinc Client/ }
its('stdout') { should match /Cinc-client/ }
its('stdout') { should match %r{/etc/cinc/client.rb} }
its('stdout') { should match %r{/var/cinc} }
its('stdout') { should_not match /Chef Infra Zero/ }
its('stdout') { should_not match /Chef Infra Client/ }
its('stdout') { should_not match /Chef-client/ }
its('stdout') { should_not match %r{/etc/chef/client.rb} }
its('stdout') { should_not match %r{/var/chef} }
end
describe command '/opt/cinc/embedded/bin/cinc-zero --version' do
its('exit_status') { should eq 0 }
end
describe command '/opt/cinc/bin/cinc-auditor version' do
its('exit_status') { should eq 0 }
end
describe command '/opt/cinc/bin/cinc-auditor detect' do
its('exit_status') { should eq 0 }
end
describe command '/opt/cinc/bin/inspec version' do
its('exit_status') { should eq 0 }
its('stdout') { should match /^Redirecting to cinc-auditor/ }
end
describe command 'chef-client --version' do
its('exit_status') { should eq 0 }
its('stdout') { should match /^Redirecting to cinc-client/ }
its('stdout') { should match /^Cinc Client:/ }
end
describe command 'chef-solo --version' do
its('exit_status') { should eq 0 }
its('stdout') { should match /^Redirecting to cinc-solo/ }
its('stdout') { should match /^Cinc Client:/ }
end
end