docker-formula icon indicating copy to clipboard operation
docker-formula copied to clipboard

fix(suse): Fix support to install compose from PackageHub on SLES 15

Open ypid-geberit opened this issue 4 years ago • 7 comments

PR progress checklist (to be filled in by reviewers)

  • [ ] Changes to documentation are appropriate (or tick if not required)
  • [ ] Changes to tests are appropriate (or tick if not required)
  • [ ] Reviews completed

What type of PR is this?

Primary type

  • [ ] [build] Changes related to the build system
  • [ ] [chore] Changes to the build process or auxiliary tools and libraries such as documentation generation
  • [ ] [ci] Changes to the continuous integration configuration
  • [ ] [feat] A new feature
  • [x] [fix] A bug fix
  • [ ] [perf] A code change that improves performance
  • [ ] [refactor] A code change that neither fixes a bug nor adds a feature
  • [ ] [revert] A change used to revert a previous commit
  • [ ] [style] Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)

Secondary type

  • [ ] [docs] Documentation changes
  • [ ] [test] Adding missing or correcting existing tests

Does this PR introduce a BREAKING CHANGE?

No.

Related issues and/or pull requests

Describe the changes you're proposing

Pillar / config required to test the proposed changes

Debug log showing how the proposed changes work

Documentation checklist

  • [ ] Updated the README (e.g. Available states).
  • [ ] Updated pillar.example.

Testing checklist

  • [ ] Included in Kitchen (i.e. under state_top).
  • [ ] Covered by new/existing tests (e.g. InSpec, Serverspec, etc.).
  • [ ] Updated the relevant test pillar.

Additional context

To actually install the packages, you need to set the following in your pillar because the PackageHub repos are not enabled by default on SLES.

docker:
  pkg:
    docker:
      use_upstream: 'package'
    compose:
      use_upstream: 'package'

ypid-geberit avatar Aug 05 '21 15:08 ypid-geberit

Thanks, very much @ypid-geberit Two Suse checks are failing.

     ×  File /usr/local/bin/docker-compose is expected to be symlink
     expected `File /usr/local/bin/docker-compose.symlink?` to be truthy, got false
     ×  File /usr/local/bin/docker-compose is expected to be file
     expected `File /usr/local/bin/docker-compose.file?` to be truthy, got false

On SUSE this should be /usr/local/bin/python-docker-compose so you may need an IF condition and variable.

Can you update https://github.com/saltstack-formulas/docker-formula/blob/master/test/integration/archive/controls/archive_spec.rb and can be merged afterwards.

noelmcloughlin avatar Aug 23 '21 23:08 noelmcloughlin

Thanks looking at this! I am new to Test Kitchen and tried to see how to do this now. I found https://kitchen.ci/docs/getting-started/writing-test/ and https://github.com/ssplatt/filebeat-formula/blob/master/test/integration/helpers/serverspec/spec_helper.rb

I am not sure how to best test for the openSUSE version. I found https://docs.chef.io/inspec/resources/os/. Can you give me a hint?

ypid-geberit avatar Aug 24 '21 15:08 ypid-geberit

I can never remember syntax. I looked at prometheus-formula as reference and suggest this example is probably close to what is needed. Hopefully 'suse' is valid.

control 'docker components' do
  title 'this is just example'

  case platform[:family]
  when 'suse'
    compose_bin = '/usr/local/bin/python-docker-compose'
  else
    compose_bin = '/usr/local/bin/docker-compose'
  end

  describe file("#{compose_bin}") do
    it { should exist }
    its('group') { should eq 'root' }
    its('mode') { should cmp '0644' }
  end

noelmcloughlin avatar Aug 24 '21 15:08 noelmcloughlin

My mistake, I see "opensuse" is used in nginx-formula.

# Override by OS
case os[:name]
when 'redhat', 'centos', 'fedora'
  server_available = '/etc/nginx/conf.d'
  server_enabled   = '/etc/nginx/conf.d'
when 'opensuse'
  server_available = '/etc/nginx/vhosts.d'
  server_enabled   = '/etc/nginx/vhosts.d'
end

noelmcloughlin avatar Aug 24 '21 21:08 noelmcloughlin

Hi @ypid-geberit Can you amend the commit to lowercase as commitlint is complaining

fix(suse): fix support to install compose from PackageHub on SLES 15

noelmcloughlin avatar Feb 05 '22 22:02 noelmcloughlin

Try disabling Suse in .gitlab-ci due to https://github.com/saltstack-formulas/docker-formula/issues/313

noelmcloughlin avatar Feb 05 '22 23:02 noelmcloughlin

Can you amend the commit to lowercase as commitlint is complaining

All right.

Try disabling Suse in .gitlab-ci due to

I tried that.

PS: Note that I switched jobs and archived this account. I might be slow to respond and it might be quicker when you make those changes directly.

ypid-geberit avatar Feb 06 '22 13:02 ypid-geberit