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

Multiple environment variables cannot be passed to gitlab-runner #261

Closed
jessereynolds opened this issue Aug 7, 2018 · 1 comment
Closed

Comments

@jessereynolds
Copy link

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: any
  • Ruby: any
  • Distribution: any
  • Module version: 2.1.0

Problem

There is no nice way to specify a runner config hash that results in multiple --env FOO=BAR options passed to the gitlab-runner register ... command. This is because each parameter is represented as a hash key and you can not have duplicate keys in a hash. The below hiera yaml shows a very hacky workaround to achieve this, but this is horrible.

Hiera data for a node:

gitlab_ci_runners:
  docker_puppet:
    url: 'https://gitlab.example/'
    registration-token: xxxxxxxx
    executor: docker
    docker-image: ruby:2.5
    env: "HTTP_PROXY=%{proxy} --env HTTPS_PROXY=%{proxy} --env NO_PROXY=gitlab.example"

Suggestion

Perhaps a key unstructured_parameters containing an array could be handled, eg:

gitlab_ci_runners:
  docker_puppet:
    url: 'https://gitlab.example/'
    registration-token: xxxxxxxx
    executor: docker
    docker-image: ruby:2.5
    unstructured_parameters: 
    - env HTTP_PROXY=%{proxy}
    - env HTTPS_PROXY=%{proxy}
    - env NO_PROXY=gitlab.example

Or a special hash for environment variables:

gitlab_ci_runners:
  docker_puppet:
    url: 'https://gitlab.example/'
    registration-token: xxxxxxxx
    executor: docker
    docker-image: ruby:2.5
    environment_variables: 
      HTTP_PROXY: %{proxy}
      HTTPS_PROXY: %{proxy}
      NO_PROXY: gitlab.example
@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
None yet
Projects
None yet
Development

No branches or pull requests

2 participants