From 0c0b666e17a6470a82c4d26399fe40f87dd82acd Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Tue, 3 Oct 2023 19:48:06 +0100 Subject: [PATCH] Update centos to centos-stream-8 Signed-off-by: Dan Webb --- .github/workflows/ci.yml | 4 ++-- documentation/resource_atlantis_installer.md | 16 ++++++++-------- kitchen.yml | 4 ++-- libraries/helpers.rb | 18 ++++++++++++++++-- resources/installer.rb | 5 +++-- resources/terraform_installer.rb | 3 ++- resources/terragrunt_installer.rb | 4 ++-- test/cookbooks/test/recipes/default.rb | 13 ++++++++++--- test/integration/default/atlantis.rb | 4 ++-- 9 files changed, 47 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 63a3774..fcd008b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,9 +24,9 @@ jobs: matrix: os: - "centos-7" - - "centos-8" - - "ubuntu-1804" + - "centos-stream-8" - "ubuntu-2004" + - "ubuntu-2204" suite: - "default" fail-fast: false diff --git a/documentation/resource_atlantis_installer.md b/documentation/resource_atlantis_installer.md index e062821..f927612 100644 --- a/documentation/resource_atlantis_installer.md +++ b/documentation/resource_atlantis_installer.md @@ -9,14 +9,14 @@ ## Properties -| name | Type | Default | Description | -| --------------------------- | --------------- | ------------------------------------------------------------------ | ------------- | -| checksum | String | `a236e7c9df159f8787b143c670f1899dd4bc4349f23ed696468600280fa1266e` | Required | -| download_base_url | String | `https://github.com/runatlantis/atlantis/releases/download` | | -| group | String, Integer | `atlantis` | | -| owner | String | `atlantis` | | -| mode | String, Integer | `0755` | | -| version | String | `0.15.0` | Required | +| name | Type | Default | Description | +| --------------------------- | --------------- | ------------------------------------------------------------------ | ----------- | +| checksum | String | `cc6e7f018de56d4d6e9b580e025da44a8e13d533b47fac73ca36acbeb8531d12` | | +| download_base_url | String | `https://github.com/runatlantis/atlantis/releases/download` | | +| group | String, Integer | `atlantis` | | +| owner | String | `atlantis` | | +| mode | String, Integer | `0755` | | +| version | String | `0.25.0` | | ## Examples diff --git a/kitchen.yml b/kitchen.yml index 73b9d3b..ce6ec5e 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -15,9 +15,9 @@ verifier: platforms: - name: centos-7 - - name: centos-8 - - name: ubuntu-18.04 + - name: centos-stream-8 - name: ubuntu-20.04 + - name: ubuntu-22.04 suites: - name: default diff --git a/libraries/helpers.rb b/libraries/helpers.rb index dffae50..965efff 100644 --- a/libraries/helpers.rb +++ b/libraries/helpers.rb @@ -3,16 +3,30 @@ module AtlantisCookbook module Helpers def cpu_arch - if node['kernel']['processor'].match?(/x86_64/) + case node['kernel']['processor'] + when /x86_64/ 'amd64' + when /armv8/ + 'arm64' else '386' end end + def platform + case node['platform'] + when 'windows' + 'windows' + when 'mac_os_x' + 'darwin' + else + 'linux' + end + end + def github_download_url(base_url, version) # https://github.com/runatlantis/atlantis/releases/download/v0.4.4/atlantis_linux_amd64.zip - "#{base_url}/v#{version}/atlantis_linux_#{cpu_arch}.zip" + "#{base_url}/v#{version}/atlantis_$#{platform}_#{cpu_arch}.zip" end def hashicorp_download_url(base_url, product, version) diff --git a/resources/installer.rb b/resources/installer.rb index 506e29a..b94cabd 100644 --- a/resources/installer.rb +++ b/resources/installer.rb @@ -11,7 +11,8 @@ property :owner, String, default: 'atlantis' property :mode, [String, Integer], default: '0755' -property :version, String, default: '0.15.0' +property :version, String, default: '0.25.0' +property :ignore_checksum, [true, false], default: false default_action :install @@ -21,7 +22,7 @@ ark 'atlantis' do url github_download_url(new_resource.download_base_url, new_resource.version) version new_resource.version - checksum new_resource.checksum unless new_resource.checksum.nil? + checksum new_resource.checksum unless new_resource.ignore_checksum prefix_root '/opt/atlantis' prefix_home '/opt/atlantis' has_binaries ['atlantis'] diff --git a/resources/terraform_installer.rb b/resources/terraform_installer.rb index 444aa4b..6920ff9 100644 --- a/resources/terraform_installer.rb +++ b/resources/terraform_installer.rb @@ -8,6 +8,7 @@ property :append_version_to_file, [true, false], default: false property :checksum, String, regex: /^[a-zA-Z0-9]{64}$/, default: '35c662be9d32d38815cde5fa4c9fa61a3b7f39952ecd50ebf92fd1b2ddd6109b' property :download_base_url, String, default: 'https://releases.hashicorp.com' +property :ignore_checksum, [true, false], default: false property :group, [String, Integer], default: 'atlantis' property :owner, String, default: 'atlantis' @@ -27,7 +28,7 @@ new_resource.version ) version new_resource.version - checksum new_resource.checksum unless new_resource.checksum.nil? + checksum new_resource.checksum unless new_resource.ignore_checksum prefix_root '/opt/atlantis' prefix_home '/opt/atlantis' owner new_resource.owner diff --git a/resources/terragrunt_installer.rb b/resources/terragrunt_installer.rb index 4c03a8e..7b422c2 100644 --- a/resources/terragrunt_installer.rb +++ b/resources/terragrunt_installer.rb @@ -7,6 +7,7 @@ property :checksum, String, regex: /^[a-zA-Z0-9]{64}$/, default: '3b033389977ca6e7d10bad10514f22fa767c85b76db92befe83e67bafa2c8413' property :download_base_url, String, default: 'https://github.com/gruntwork-io/terragrunt/releases/download' +property :ignore_checksum, [true, false], default: false property :group, [String, Integer], default: 'root' property :owner, [String, Integer], default: 'root' @@ -19,8 +20,7 @@ action :install do remote_file '/usr/local/bin/terragrunt' do source terragrunt_github_download_url(new_resource.download_base_url, new_resource.version) - checksum new_resource.checksum unless new_resource.checksum.nil? - + checksum new_resource.checksum unless new_resource.ignore_checksum owner new_resource.owner group new_resource.group mode new_resource.mode diff --git a/test/cookbooks/test/recipes/default.rb b/test/cookbooks/test/recipes/default.rb index 2d762f1..b7376ce 100644 --- a/test/cookbooks/test/recipes/default.rb +++ b/test/cookbooks/test/recipes/default.rb @@ -26,8 +26,13 @@ # install required dependencies package %w(unzip git) -atlantis_installer 'atlantis' -terraform_installer 'terraform' +atlantis_installer 'atlantis' do + ignore_checksum true +end + +terraform_installer 'terraform' do + ignore_checksum true +end terragrunt_repo_config = { 'repos' => [ @@ -77,7 +82,9 @@ template_variables terragrunt_repo_config end -terragrunt_installer 'terragrunt' +terragrunt_installer 'terragrunt' do + ignore_checksum true +end if node['platform_version'] == '14.04' atlantis_service_upstart 'atlantis' diff --git a/test/integration/default/atlantis.rb b/test/integration/default/atlantis.rb index eff33de..5315945 100644 --- a/test/integration/default/atlantis.rb +++ b/test/integration/default/atlantis.rb @@ -11,11 +11,11 @@ # if needed you may have to install `coreutils` (package name for deb derivitives) # root@dokken:/# sha256sum /usr/local/bin/atlantis/atlantis # c094def53949d658bb3ead360b86a432e3cc48609252621da7855f7fc7f0d136 /usr/local/bin/atlantis/atlantis - its('sha256sum') { should eq 'e4169fdad7cd01809565b723b0c3a30f8119481e1cee79be20cf577f6607865e' } + its('sha256sum') { should eq 'cc6e7f018de56d4d6e9b580e025da44a8e13d533b47fac73ca36acbeb8531d12' } end describe command("#{atlantis_bin} version") do - its('stdout') { should match(/(atlantis)\s0.15.0/) } + its('stdout') { should match(/(atlantis)\s0.25.0/) } its('exit_status') { should eq 0 } end