Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

aclToken is not taken from Pipeline call #10

Open
drexlert opened this issue Sep 13, 2019 · 1 comment
Open

aclToken is not taken from Pipeline call #10

drexlert opened this issue Sep 13, 2019 · 1 comment

Comments

@drexlert
Copy link

Hello,
i think use/set token in pipeline call is not working as expected.
I don't want to set in Jenkins global configuration the ACLToken for Consul.
Then I tried to set the Token via pipeline wrapper call itself.
But the token is not taken from the pipeline call it throws a 403 and in the output the url don't have the part ?token=my-nice-token

this is my call
`node {
stage('wraper'){
script{
TEST_KEY = ''

wrap([
    $class: 'ConsulKVReadWrapper',
    reads: [[
    hostUrl: 'http://myconsul:8500',
    aclToken: 'my-nice-token',
    apiUri: '',
    debugMode: 'ENABLED',
    envKey: 'test_key',
    key: 'path/path/path/test'
    ]]
    ]) {
    echo env.test_key
    TEST_KEY = env.test_key
}

echo TEST_KEY
    }
}

}`

and output is this:
[Pipeline] wrap Consul READ URL: http://myconsul:8500/v1/kv/path/path/path/test<here is something missing> Response Headers: Content-Type=text/plain; charset=utf-8 Vary=Accept-Encoding Date=Fri, 13 Sep 2019 07:06:45 GMT org.apache.http.client.ClientProtocolException: Unexpected response status: 403

@Aquarius888
Copy link

Aquarius888 commented Nov 10, 2020

The issue is reproduced.
Also if the global ACL token is set, it won't be rewritten by 'local' wrapper value.

Workaround: it works as expected if global variable ACL token is set as ${ACL_TOKEN} and a variable ACL_TOKEN is defined in a job.

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

No branches or pull requests

2 participants