Active Choices and referencing a parameter

164 views
Skip to first unread message

Reuben Popp

unread,
Mar 20, 2023, 2:47:22 PM3/20/23
to BioUno Developers
Good morning/afternoon, I hope that this list is just low traffic and not dead.

I'm trying to set up a dynamic reference parameter in a Jenkinsfile and am struggling a bit with how to reference the value of a previous option.  Note the code below; where Target is used, I have attempted appending it to the cmd using + as well as the provided way below.  Both ways return my select as empty.  What is the proper way to reference another, earlier used option from the Jenkinsfile?  I see that it is getting set by watching the javascript console:

Values retrieved from Referenced Parameters: DeployLegacyBackend=No__LESEP__Target=FOO

Also, note my println entries.  Given that I have added a logger in Jenkins for biouno, should I not see entries for these?  What is the best way to debug scripts here?

Thanks in advance!
Reuben

For example, 

        [$class: 'DynamicReferenceParameter',
            choiceType: 'ET_FORMATTED_HTML',
            omitValueField: true,
            description: 'Choose a legacy backend install file.',
            name: 'LegacyBackendInstallFile',
            randomName: 'choice-parameter-5631314456178624',
            referencedParameters: 'DeployLegacyBackend,Target',
            script: [
                $class: 'GroovyScript',
                fallbackScript: [
                    classpath: [],
                    sandbox: true,
                    script: 'return[\'Listing not available.....\']'
                ],
                script: [
                    classpath: [],
                    sandbox: true,
                    script: '''
                        def rawFileList = []
                        def htmlOut = '<select id="install_file">'

                        def cmd = "gsutil ls gs://some-cloud-storage-bucket/Target | grep install.tar.gz"
                        def proc = ['sh', '-c', cmd].execute()
                        proc.waitFor()
                        def rawOutString = proc.text
                        println("rawOutString is [" + rawOutString + "].")
                        def rawOut = rawOutString.split('\\n')

                        rawOut.each { item ->
                            def tmpFile = item
                            println("tmpFile is [" + tmpFile + "].")
                        }
                        htmlOut += '</select>'

                        return htmlOut
                    '''
                ]
            ]
        ],

Reuben Popp

unread,
Mar 21, 2023, 10:37:20 AM3/21/23
to biouno-d...@googlegroups.com
Pinging the group again, per Bruno's request.

--
You received this message because you are subscribed to the Google Groups "BioUno Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to biouno-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/biouno-developers/6eaaa94a-16a3-428a-91f7-b2f51e73e534n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages