travis-ci / packer-templates

Templates for Packer!
MIT License
104 stars 54 forks source link

Workaround to using latest version of chef on ubuntu ppc64le #839

Open svghadi opened 2 years ago

svghadi commented 2 years ago

Problem

Chef versions greater than v15.1.36 do not support ubuntu ppc64le. The packer build throws following error

2022/03/10 07:27:37 [INFO] (telemetry) Starting provisioner chef-solo
==> openstack: Provisioning with chef-solo
    openstack: Installing Chef...
2022/03/10 07:27:37 packer-builder-openstack plugin: [DEBUG] Opening new ssh session
2022/03/10 07:27:37 packer-builder-openstack plugin: [DEBUG] starting remote command: curl -L https://omnitruck.chef.io/install.sh | sudo bash -s -- -v 17.6.18
==> openstack:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
==> openstack:                                  Dload  Upload   Total   Spent    Left  Speed
==> openstack: 100 23409  100 23409    0     0   100k      0 --:--:-- --:--:-- --:--:--  101k
    openstack: ubuntu 16.04 ppc64le
    openstack: Getting information for chef stable 17.6.18 for ubuntu...
    openstack: downloading https://omnitruck.chef.io/stable/chef/metadata?v=17.6.18&p=ubuntu&pv=16.04&m=ppc64le
    openstack:   to file /tmp/install.sh.19355/metadata.txt
    openstack: trying wget...
    openstack: ERROR 404
    openstack: Omnitruck artifact does not exist for version 17.6.18 on platform ubuntu
    openstack:
    openstack: Either this means:
    openstack:    - We do not support ubuntu
    openstack:
    openstack: This is often the latter case due to running a prerelease or RC version of Chef
    openstack: or a gem version which was only pushed to rubygems and not omnitruck.
    openstack:
    openstack: You may be able to set your knife[:bootstrap_version] to the most recent stable
    openstack: release of Chef to fix this problem (or the most recent stable major version number).
    openstack:
    openstack: In order to test the version parameter, adventurous users may take the Metadata URL
    openstack: below and modify the '&v=<number>' parameter until you successfully get a URL that
    openstack: does not 404 (e.g. via curl or wget).  You should be able to use '&v=11' or '&v=12'
    openstack: successfully.
    openstack:
    openstack: If you cannot fix this problem by setting the bootstrap_version, it probably means
    openstack: that ubuntu is not supported.
    openstack:
    openstack: Metadata URL: https://omnitruck.chef.io/stable/chef/metadata?v=17.6.18&p=ubuntu&pv=16.04&m=ppc64le
2022/03/10 07:27:38 [INFO] (telemetry) ending chef-solo

Workaround

diff --git a/ci-sardonyx.yml b/ci-sardonyx.yml
index 9b17e150..dc08689d 100644
--- a/ci-sardonyx.yml
+++ b/ci-sardonyx.yml
@@ -159,8 +159,15 @@ provisioners:
   destination: /var/tmp/sardonyx-system-info-commands.yml
 - type: shell
   inline: chmod 0644 /var/tmp/sardonyx-system-info-commands.yml
+- type: file
+  source: /tmp/chef.deb
+  destination: /tmp/chef.deb
+- type: shell
+  inline: sudo dpkg -i /tmp/chef.deb && sudo rm -f /tmp/chef.deb
 - type: chef-solo
   version: 17.6.18
+  chef_license: "accept-silent"
+  skip_install: true
   config_template: chef-solo.rb.tmpl
   <% if ENV['CHEF_PROFILING'] %>
   execute_command: "{{if .Sudo}}sudo {{end}}CI=yes chef-solo --chef-license accept-silent -F doc --no-color -c {{.ConfigPath}} -j {{.JsonPath}}"