Telefonica / puppet-github-actions-runner

In This Repository you can find a module that will setup all of the files and configuration needed for GitHub Actions runner to work on Linux hosts (Ubuntu, Debian and CentOS).
Apache License 2.0
12 stars 15 forks source link

Incorrect validation specification for labels parameter #45

Open akomakom opened 2 years ago

akomakom commented 2 years ago

After upgrading from 0.4.0 to 0.10.0 I had to (locally) change this line: https://github.com/Telefonica/puppet-github-actions-runner/blob/5efef4c6146f484cd6d1fd097bdb44e656c62e16/manifests/instance.pp#L69

# from:
Optional[Array[String[1]]]     $labels                = undef,
# to
Optional[Array[String]]        $labels                = undef,

There seemed to be no way to specify labels. I'm guessing that a valid parameter would be:

[ ['one'], ['two'] ]

but what it would actually do with it I did not check. After correcting the code, I was able to use a flat array as a parameter:

[ 'one', 'two' ]
oscarsj commented 2 years ago

Thanks for the report, we will investigate. If you think the patch you applied fixes the issue, maybe you want to send a PR with it?

oscarsj commented 2 years ago

hi again @akomakom , i have been trying to reproduce the error but to no avail: with a hiera config like:

github_actions_runner::ensure: present
github_actions_runner::instances:
    mistica-android:
        repo_name: 'mistica-android'
        labels:
          - self-hosted-novum
          - linux
          - exclusive-runner
          - more-labels

and module version 0.10.0:

mod 'github_actions_runner',
  :git => 'https://github.com/Telefonica/puppet-github-actions-runner',
  :ref => '0.10.0'

I get no errors, and I see that labels are correctly created:

Info: Applying configuration version '1665129316'
Notice: /Stage[main]/Github_actions_runner/Github_actions_runner::Instance[mistica-android]/File[/srv/actions-runner-2.292.0/mistica-android/configure_install_runner.sh]/content: 
--- /srv/actions-runner-2.292.0/mistica-android/configure_install_runner.sh 2022-10-07 07:48:47.632754123 +0000
+++ /tmp/puppet-file20221007-824-159v7w1    2022-10-07 07:55:40.118202424 +0000
@@ -24,7 +24,7 @@
   --name jenkinsslave-prod-10-mistica-android  \
   --url https://github.com/Telefonica/mistica-android                              \
   --token ${TOKEN}                               \
-  --labels self-hosted-novum,linux &>/dev/null
+  --labels self-hosted-novum,linux,exclusive-runner,more-labels &>/dev/null

Can I have some more instructions to reproduce the error?

akomakom commented 2 years ago

I am not using hiera, and I'm on github enterprise (unlikely to matter).
Simple example:

    $labels = split("one two three", ' ')

    notify{"Using labels value ${labels}":}

    class { 'github_actions_runner':
      ..... ,
      instances             => {
        'main' => {
          org_name => 'MyOrg',
          labels   => $labels,
        }
      }
    }
traylenator commented 1 year ago

This seems invalid - current code looks fine to me.