Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Incorrect validation specification for labels parameter #45

Open
akomakom opened this issue Oct 5, 2022 · 4 comments · May be fixed by #46
Open

Incorrect validation specification for labels parameter #45

akomakom opened this issue Oct 5, 2022 · 4 comments · May be fixed by #46

Comments

@akomakom
Copy link

akomakom commented Oct 5, 2022

After upgrading from 0.4.0 to 0.10.0 I had to (locally) change this line:

Optional[Array[String[1]]] $labels = undef,

# 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
Copy link
Contributor

oscarsj commented Oct 5, 2022

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?

@akomakom akomakom linked a pull request Oct 5, 2022 that will close this issue
@oscarsj
Copy link
Contributor

oscarsj commented Oct 7, 2022

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
Copy link
Author

akomakom commented Oct 7, 2022

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
Copy link

This seems invalid - current code looks fine to me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants