Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated PR: Standardising Files #146

Merged
merged 13 commits into from
Aug 9, 2022
42 changes: 33 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ jobs:
strategy:
matrix:
os:
- almalinux-8
- amazonlinux-2
- debian-9
- debian-10
- centos-7
- centos-8
- ubuntu-1604
- centos-stream-8
- debian-10
- debian-11
- opensuse-leap-15
- rockylinux-8
- ubuntu-1804
- ubuntu-2004
- opensuse-leap-15
suite:
- resources
- source
Expand All @@ -57,16 +58,14 @@ jobs:
sudo journalctl -l --since today
KITCHEN_LOCAL_YAML=kitchen.dokken.yml /usr/bin/kitchen exec ${{ matrix.suite }}-${{ matrix.os }} -c "journalctl -l"

integration-macos:
integration-windows:
needs: lint-unit
runs-on: macos-latest
runs-on: macos-10.15
strategy:
matrix:
os:
- windows-2012r2
- windows-2016
- windows-2019
- macos-1015
suite:
- resources
fail-fast: false
Expand All @@ -83,3 +82,28 @@ jobs:
with:
suite: ${{ matrix.suite }}
os: ${{ matrix.os }}

integration-macos:
needs: lint-unit
runs-on: macos-latest
strategy:
matrix:
os:
- macos-latest
suite:
- resources
fail-fast: false

steps:
- name: Check out code
uses: actions/checkout@v2
- name: Install Chef
uses: actionshub/chef-install@main
- name: test-kitchen
uses: actionshub/test-kitchen@main
env:
CHEF_LICENSE: accept-no-persist
KITCHEN_LOCAL_YAML: kitchen.exec.yml
with:
suite: ${{ matrix.suite }}
os: ${{ matrix.os }}
4 changes: 0 additions & 4 deletions .overcommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ PreCommit:
enabled: true
required_executable: 'cookstyle'
command: ["cookstyle"]
Delivery:
enabled: true
required_executable: 'delivery'
flags: ['local', 'all']
CommitMsg:
HardTabs:
enabled: true
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

- Standardise files with files in sous-chefs/repo-management
- Update tested platforms
- Update Windows version to 2.35.1
- Update helpers to deal with 32/64bit
- Switch `git::package` to use `git_client` for windows
- Remove inclusion of `git::default` from `git_config` resource
- Add `password` property to `git_config` resource which is required on Windows if running as a different user
- Fix tests on MacOS and Windows

## 11.0.2 - *2022-05-16*

- Remove delivery folder
Expand Down
2 changes: 1 addition & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# limitations under the License.

if platform_family?('windows')
default['git']['version'] = '2.8.1'
default['git']['version'] = '2.35.1'
if node['kernel']['machine'] == 'x86_64'
default['git']['architecture'] = '64'
default['git']['checksum'] = '5e5283990cc91d1e9bd0858f8411e7d0afb70ce26e23680252fb4869288c7cfb'
Expand Down
2 changes: 1 addition & 1 deletion chefignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Dangerfile
examples/*
features/*
Guardfile
kitchen.yml*
kitchen*.yml
mlc_config.json
Procfile
Rakefile
Expand Down
39 changes: 17 additions & 22 deletions kitchen.dokken.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,62 +12,57 @@ provisioner:
chef_license: accept-no-persist

platforms:
- name: almalinux-8
driver:
image: dokken/almalinux-8
pid_one_command: /usr/lib/systemd/systemd

- name: amazonlinux-2
driver:
image: dokken/amazonlinux-2
pid_one_command: /usr/lib/systemd/systemd

- name: debian-9
- name: debian-10
driver:
image: dokken/debian-9
image: dokken/debian-10
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update

- name: debian-10
- name: debian-11
driver:
image: dokken/debian-10
image: dokken/debian-11
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update

- name: centos-7
driver:
image: dokken/centos-7
pid_one_command: /usr/lib/systemd/systemd

- name: centos-8
- name: centos-stream-8
driver:
image: dokken/centos-8
image: dokken/centos-stream-8
pid_one_command: /usr/lib/systemd/systemd

- name: fedora-latest
driver:
image: dokken/fedora-latest
pid_one_command: /usr/lib/systemd/systemd

- name: ubuntu-16.04
driver:
image: dokken/ubuntu-16.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update

- name: ubuntu-18.04
driver:
image: dokken/ubuntu-18.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update

- name: ubuntu-20.04
driver:
image: dokken/ubuntu-20.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update

- name: opensuse-leap-15
driver:
image: dokken/opensuse-leap-15
pid_one_command: /bin/systemd
pid_one_command: /usr/lib/systemd/systemd

- name: rockylinux-8
driver:
image: dokken/rockylinux-8
pid_one_command: /usr/lib/systemd/systemd
17 changes: 17 additions & 0 deletions kitchen.exec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
driver:
name: exec

transport:
name: exec

provisioner:
name: chef_zero
deprecations_as_errors: true

platforms:
- name: windows-latest
provisioner:
enforce_idempotency: false
multiple_converge: 1
- name: macos-latest
46 changes: 35 additions & 11 deletions kitchen.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,70 @@
---
driver:
name: vagrant
gui: false

provisioner:
name: chef_zero
product_name: chef
name: chef_infra
product_name: <%= ENV['CHEF_PRODUCT_NAME'] || 'chef' %>
enforce_idempotency: true
multiple_converge: 2
deprecations_as_errors: true
chef_license: accept-no-persist

verifier:
name: inspec

platforms:
- name: amazonlinux-2
- name: centos-7
- name: centos-8
- name: debian-9
- name: centos-stream-8
- name: debian-10
- name: freebsd-11
- name: fedora-29
- name: debian-11
- name: freebsd-13
- name: fedora-latest
- name: opensuse-leap-15
- name: ubuntu-16.04
- name: ubuntu-18.04
- name: ubuntu-20.04
- name: windows-2012r2
driver:
box: tas50/windows_2012r2
gui: false
customize:
cpus: 2
memory: 4096
transport:
name: winrm
elevated: true
provisioner:
enforce_idempotency: false
multiple_converge: 1
- name: windows-2016
driver:
box: tas50/windows_2016
gui: false
customize:
cpus: 2
memory: 4096
transport:
name: winrm
elevated: true
provisioner:
enforce_idempotency: false
multiple_converge: 1
- name: windows-2019
driver:
box: tas50/windows_2019
gui: false
customize:
cpus: 2
memory: 4096
transport:
name: winrm
elevated: true
provisioner:
enforce_idempotency: false
multiple_converge: 1
- name: macos-10.15
run_list: homebrew::default
driver:
box: tas50/macos_10.15
provider: vmware_fusion

suites:
- name: resources
Expand Down
14 changes: 11 additions & 3 deletions libraries/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,25 @@ def parsed_windows_display_name

def parsed_windows_package_version
return new_resource.windows_package_version if new_resource.windows_package_version
'2.7.4'
'2.35.1'
end

def parsed_windows_package_url
return new_resource.windows_package_url if new_resource.windows_package_url
"https://github.com/git-for-windows/git/releases/download/v%#{parsed_windows_package_version}.windows.1/Git-%#{parsed_windows_package_version}-32-bit.exe"
if node['kernel']['machine'] == 'x86_64'
"https://github.com/git-for-windows/git/releases/download/v#{parsed_windows_package_version}.windows.1/Git-#{parsed_windows_package_version}-64-bit.exe"
else
"https://github.com/git-for-windows/git/releases/download/v#{parsed_windows_package_version}.windows.1/Git-#{parsed_windows_package_version}-32-bit.exe"
end
end

def parsed_windows_package_checksum
return new_resource.windows_package_checksum if new_resource.windows_package_checksum
'49601d5102df249d6f866ecfa1eea68eb5672acc1dbb7e4051099e792f6da5fc'
if node['kernel']['machine'] == 'x86_64'
'5d66948e7ada0ab184b2745fdf6e11843443a97655891c3c6268b5985b88bf4f'
else
'5e45b1226b106dd241de0be0b350052afe53bd61dce80ac6044600dc85fbfa0b'
end
end
end
end
6 changes: 1 addition & 5 deletions recipes/package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

if platform?('windows')
include_recipe 'git::windows'
else
git_client 'default'
end
git_client 'default'
4 changes: 3 additions & 1 deletion resources/client_osx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
provides :git_client, platform: 'mac_os_x'

action :install do
package 'git'
package 'git' do
options '--override'
end
end
1 change: 1 addition & 0 deletions resources/client_windows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
windows_package parsed_windows_display_name do
source parsed_windows_package_url
checksum parsed_windows_package_checksum
version parsed_windows_package_version
installer_type :inno
end

Expand Down
25 changes: 17 additions & 8 deletions resources/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,25 @@
property :path, String, desired_state: false
property :user, String, desired_state: false
property :group, String, desired_state: false
property :password, String, desired_state: false, sensitive: true
property :options, String, desired_state: false

def initialize(*args)
super

@run_context.include_recipe 'git'
end

load_current_value do
cmd_env = user ? { 'USER' => user, 'HOME' => ::Dir.home(user) } : nil
config_vals = Mixlib::ShellOut.new("git config --get --#{scope} #{key}", user: user, group: group, cwd: path, env: cmd_env)
begin
home_dir = ::Dir.home(user)
rescue
value nil
end

cmd_env = user ? { 'USER' => user, 'HOME' => home_dir } : nil
config_vals = Mixlib::ShellOut.new(
"git config --get --#{scope} #{key}",
user: user,
group: group,
password: password,
cwd: path,
env: cmd_env
)
config_vals.run_command
if config_vals.stdout.empty?
value nil
Expand All @@ -31,6 +39,7 @@ def initialize(*args)
cwd new_resource.path
user new_resource.user
group new_resource.group
password new_resource.password
environment cmd_env
end
end
Expand Down
Loading