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

Using ENV Variables in Target Command #145

Open
agosto-lorinronken opened this issue Dec 2, 2020 · 1 comment
Open

Using ENV Variables in Target Command #145

agosto-lorinronken opened this issue Dec 2, 2020 · 1 comment

Comments

@agosto-lorinronken
Copy link

Hello,

I am having trouble identifying the correct syntax to apply an environment variable to my salt pipeline in order to feed that to the Salt command. Essentially, we have an upstream pipeline that sets up a server and a downstream pipeline that runs Salt on that newly configured server. I am feeding the server name as a Environment variable into the downstream job but having trouble finding how to reference it in salt. Here is the command I currently am trying:

stage('Apply Salt Rev Configuration') {
       steps {
         salt(authtype: 'pam', clientInterface: local(arguments: 'My APP 1', function: 'grains.append', target: '{{CA_HOSTNAME}}', targettype: 'glob'), credentialsId: 'my-salt-master', saveFile: true, servername: 'myservername.com:8000')
         script {
          env.WORKSPACE = pwd()
          def output = readFile "${env.WORKSPACE}/saltOutput.json"
          echo output
        }
       }
    }

I have tired to also use {{env.CA_HOSTNAME}} and "{{CA_HOSTNAME}}" to no avail. I have tested the above command by manually providing the server name versus using the CA_HOSTNAME variable and confirmed that the salt config applied correctly.

Is this supported by chance and if so what am I missing?

Thank you for your help!!

@yukpun
Copy link

yukpun commented Jul 29, 2021

Try to use just ${WORKSPACE} or ${CA_HOSTNAME}
One more variant it could be - ${params.WORKSPACE}
Maybe it could help

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