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

Gitlab-runner installation fails. #188

Closed
mjburling opened this issue Feb 3, 2018 · 1 comment
Closed

Gitlab-runner installation fails. #188

mjburling opened this issue Feb 3, 2018 · 1 comment
Labels
bug Something isn't working

Comments

@mjburling
Copy link

mjburling commented Feb 3, 2018

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 4.10.9
  • Ruby: ruby 2.0.0p648 (2015-12-16) [x86_64-linux]
  • Distribution: CentOS 7.4
  • Module version: Master branch, v1.16.0 [2017-12-13]

How to reproduce (e.g Puppet code you use)

[...]
  include ::gitlab::cirunner

  $directories = [
    '/home/gitlab-runner/.aws',
    '/home/gitlab-runner/.docker',
    '/home/gitlab-runner/.gradle',
    '/home/gitlab-runner/.grails',
    '/home/gitlab-runner/.m2',
    '/home/gitlab-runner/.npm',
    '/home/gitlab-runner/.pulp',
    '/home/gitlab-runner/.rbh',
    '/home/gitlab-runner/.yarn',
  ]

  file { $directories:
    ensure  => directory,
    owner   => 'gitlab-runner',
    mode    => '0600',
    require =>  Package['gitlab-runner'],
  }
[...]

What are you seeing

It would seem that yumrepo[runner_gitlab-runner] can be created after package[gitlab-runner].

What behaviour did you expect instead

I expected yumrepo[runner_gitlab-runner] to be created before package[gitlab-runner] and successfully install gitlab.

Output log

Error: Execution of '/bin/yum -d 0 -e 0 -y install gitlab-runner' returned 1: Error: Nothing to do
Error: /Stage[main]/Gitlab::Cirunner/Package[gitlab-runner]/ensure: change from purged to present failed: Execution of '/bin/yum -d 0 -e 0 -y install gitlab-runner' returned 1: Error: Nothing to do
Notice: /Stage[main]/Gitlab::Cirunner/File_line[gitlab-runner-concurrent]: Dependency Package[gitlab-runner] has failures: true
Warning: /Stage[main]/Gitlab::Cirunner/File_line[gitlab-runner-concurrent]: Skipping because of failed dependencies
Notice: /Stage[main]/Gitlab::Cirunner/Exec[gitlab-runner-restart]: Dependency Package[gitlab-runner] has failures: true
Warning: /Stage[main]/Gitlab::Cirunner/Exec[gitlab-runner-restart]: Skipping because of failed dependencies
Notice: /Stage[main]/Gitlab::Cirunner/Gitlab::Runner[teng4317-gitlabci-docker-5790]/Exec[Register_runner_teng4317-gitlabci-docker-5790]: Dependency Package[gitlab-runner] has failures: true
Warning: /Stage[main]/Gitlab::Cirunner/Gitlab::Runner[teng4317-gitlabci-docker-5790]/Exec[Register_runner_teng4317-gitlabci-docker-5790]: Skipping because of failed dependencies
Notice: /Stage[main]/Gitlab::Cirunner/Yumrepo[runner_gitlab-runner]/ensure: created
Info: changing mode of /etc/yum.repos.d/runner_gitlab-runner.repo from 600 to 644

Any additional information you'd like to impart

It's not very elegant, but I've just gone ahead and cloned the repository and placed the package declarations inside of the if/case statement for repo management/osfamily. It works.

  if $manage_repo {
    $repo_base_url = 'https://packages.gitlab.com'

    case $::osfamily {
      'Debian': {
        include apt
        ensure_packages('apt-transport-https')

        $distid = downcase($::lsbdistid)

        ::apt::source { 'apt_gitlabci':
          comment  => 'GitlabCI Runner Repo',
          location => "${repo_base_url}/runner/${package_name}/${distid}/",
          release  => $::lsbdistcodename,
          repos    => 'main',
          key      => {
            'id'     => '1A4C919DB987D435939638B914219A96E15E78F4',
            'server' => 'keys.gnupg.net',
          },
          include  => {
            'src' => false,
            'deb' => true,
          },
        }
        Apt::Source['apt_gitlabci'] -> Package[$package_name]
        Exec['apt_update'] -> Package[$package_name]

        -> package { $package_name:
          ensure => $package_ensure,
        }
      }
      'RedHat': {
        yumrepo { "runner_${package_name}":
          ensure        => 'present',
          baseurl       => "${repo_base_url}/runner/${package_name}/el/${::operatingsystemmajrelease}/\$basearch",
          descr         => "runner_${package_name}",
          enabled       => '1',
          gpgcheck      => '0',
          gpgkey        => "${repo_base_url}/gpg.key",
          repo_gpgcheck => '1',
          sslcacert     => '/etc/pki/tls/certs/ca-bundle.crt',
          sslverify     => '1',
        }

        yumrepo { "runner_${package_name}-source":
          ensure        => 'present',
          baseurl       => "${repo_base_url}/runner/${package_name}/el/${::operatingsystemmajrelease}/SRPMS",
          descr         => "runner_${package_name}-source",
          enabled       => '1',
          gpgcheck      => '0',
          gpgkey        => "${repo_base_url}/gpg.key",
          repo_gpgcheck => '1',
          sslcacert     => '/etc/pki/tls/certs/ca-bundle.crt',
          sslverify     => '1',
        }
        -> package { $package_name:
          ensure => $package_ensure,
        }
      }
      default: {
        fail ("gitlab::cirunner::manage_repo parameter for ${::osfamily} is not supported.")
      }
    }
  } else {
    package { $package_name:
      ensure => $package_ensure,
    }
  }

Edits:

@juniorsysadmin juniorsysadmin added the bug Something isn't working label Feb 3, 2018
@LongLiveCHIEF
Copy link
Contributor

Can you please re-open this in https://github.com/voxpupuli/puppet-gitlab_ci_runner? This functionality is being moved out into its own module.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants