#Is there a way to tell dagger to ignore

1 messages · Page 1 of 1 (latest)

crisp viper
#

@scenic cloak @fair hazel and some of us were discussing how to make this a better experience yesterday.

fair hazel
#

Doesn't just --my-arg "" do what you need?

dim pagoda
#

hmm I didn't try ""... if you are familiar with Jenkins, I directly used the input parameter like --my-arg $params.myArg and kept the parameter field blank. That effectively becomes --my-arg . If I wanted to add "" I'm afraid I'd have to add a condition.

crisp viper
#

@dim pagoda ah, okay, I was also going to ask if you're just using // +optional or also using // +default at all in your cases.

#

Do you use declarative pipelines or scripted pipelines?

dim pagoda
#

declarative, I tried both ways. having just // +optional and with // +default

fair hazel
#

What about --my-arg "$params.myArg"? Doesn't that work?

#

Good to do it like that anyway to prevent values from variables having spaces inside.

dim pagoda
#

good point, let me try that

#

ok that worked. I feel silly for not trying that

crisp viper
#

I was wondering if something like this would be needed.

pipeline {
    agent any
    
    stages {
        stage('Example Stage') {
            steps {
                sh dagger call foo --my-arg "${params.myArg}"
            }
        }
    }
}

Nice! Glad to learn that this works! (note real one below 👇 )

dim pagoda
#

This is what I did

sh "dagger call -m ./mymodule promote --sources \"$params.sources\" --user PIPELINE_USR --pass PIPELINE_PSW --tag \"$params.tag\" --targetTag \"$params.targetTag\""