37
Views
4
Comments
Solved
Jenkins Authorization token failure

Hi,

I am trying to get Outsystems to work on our CI/CD pipeline. The CI/CD pipeline is in Jenkins. So I followed the steps 

https://github.com/OutSystems/outsystems-pipeline/wiki/Building-an-OutSystems-pipeline-with-Jenkins

After I am done configuring, I am running the pipeline builds.

When I start the script in Jenkins, it fails on this line in the script:

          powershell "python -m outsystems.pipeline.fetch_lifetime_data --artifacts \"${env.ArtifactsFolder}\" --lt_url ${env.LifeTimeHostname} --lt_token ${env.AuthorizationToken} --lt_api_version ${env.LifeTimeAPIVersion}"

the error I get

fetch_lifetime_data.py: error: argument -t/--lt_token: expected one argument

and is probably caused by the omission of the secret in the AuthorizationToken

Warning: A secret was passed to "powershell" using Groovy String interpolation, which is insecure.
         Affected argument(s) used the following variable(s): [AuthorizationToken]

Has anyone seen this? How do I get around it, without putting the token in the script?

Thanks in advance,

Joris Teunissen

2019-03-18 15-58-58
Duarte Castaño
Staff
Solution

Hi Dorus,

The string interpolation warning is caused by the way in which you refer to the credential variable on each python script call.

For more info on how string interpolation works, please check here: https://docs.cloudbees.com/docs/admin-resources/latest/automating-with-jenkinsfile/string-interpolation

Regards,
Duarte

2021-08-12 11-00-27
Nordin Ahdi
 
MVP

Hi Joris,

Hope you’re doing well :)

I’m not sure if you configured the credentials in Jenkins correctly and whether you are including them correctly in the script. So let’s dubbel check!

And to be clear, the actual LifeTime authorization token (secret) should not be included in the script. 

If the LT token is configured correctly as a credential in Jenkins, it will be fetched by use of the credential ID which by the default is the string LifeTimeServiceAccountToken’.

Now, in the Python script file make sure you have the AuthorizationToken variable set correctly with the value (mind the single quotes): 

credentials(LifeTimeServiceAccountToken’

In this case LifeTimeServiceAccountToken is the credentials ID used in Jenkins.

Let me know how it goes!

Regards,

Nordin

UserImage.jpg
Joris Teunissen

Ha Nordin!

Thanks for the quick reaction. Nice that we can work on this together :-D. 

Yes, I stored the Lifetimetoken in the Manage Jenkins | Manage Credentials configuration part of Jenkins. That is the place I safely can store the token. 

But Groovy detects I am using the token in a an insecure way. 

Warning: A secret was passed to "powershell" using Groovy String interpolation, which is insecure.
         Affected argument(s) used the following variable(s): [AuthorizationToken]

For now, as a workaround, I hardcoded the token in the Jeninks script. But that is even more insecure I am afraid.

2019-03-18 15-58-58
Duarte Castaño
Staff
Solution

Hi Dorus,

The string interpolation warning is caused by the way in which you refer to the credential variable on each python script call.

For more info on how string interpolation works, please check here: https://docs.cloudbees.com/docs/admin-resources/latest/automating-with-jenkinsfile/string-interpolation

Regards,
Duarte

UserImage.jpg
Joris Teunissen

Thanks Duarte, 

You described it is a warning  (and not an error). So I tried again, and it is working now. Maybe also due to installation of new plugins.

Kind regards,

Joris

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.