Can't pass password from credentialsJSON to commitStatusPublisher (bitbucket server) Teamcity

503 Views Asked by At

It seems that i have an old version of commitStatusPublisher plugin and it can't convert credentialsJSON string to its value. In any other situation I can access password with

params.findRawParam("env.mypass")!!.value

or in buildstep, script content

$mypass

But commitStatusPublisher not working with it. Code example

import jetbrains.buildServer.configs.kotlin.v2019_2.*
import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.commitStatusPublisher



params {
    password("env.mypass", "credentialsJSON:8420d5dc-1d32-4f9e-a74d-c9444be05c23", display = ParameterDisplay.HIDDEN)
}


features {
    commitStatusPublisher {
        publisher = bitbucketServer {
            url = "https://bitbucket.domain.com/"
            userName = "user"
            password = params.findRawParam("env.mypass")!!.value

        }
    }
}

Maybe I can somehow extract 'raw' var to use it for that plugin?

for example

var pass = something("env.mypass")

features {
    commitStatusPublisher {
        publisher = bitbucketServer {
            url = "https://bitbucket.domain.com/"
            userName = "user"
            password = pass
        }
    }
}

In the result i want to keep password in TC tokens and use it with my version of commitStatusPublisher

1

There are 1 best solutions below

0
On

Seems like a bug. Recreating the token resolves problem