We use jcasc for jenkins config and have a browserstack credential, the cred gets created but when we reload the casc we see
Error
Failed to construct instance of class com.browserstack.automate.ci.jenkins.BrowserStackCredentials. Constructor:
public com.browserstack.automate.ci.jenkins.BrowserStackCredentials(
java.lang.String,java.lang.String,java.lang.String,java.lang.String).
Arguments: [
java.lang.String, java.lang.String, java.lang.String, java.lang.String].
Expected Parameters:
id java.lang.String, description java.lang.String, username java.lang.String, accesskey java.lang.String
Environment
- Jenkins 2.426.3
- BrowserStack plugin 1.2.12
- Configuration as Code AWS SSM secrets 1.0.1
- Configuration as Code Plugin 1775.v810dc950b_514
JCasc yaml excerpt
queueItemAuthenticator:
authenticators:
- global:
strategy: "triggeringUsersAuthorizationStrategy"
...
credentials:
system:
domainCredentials:
- credentials:
...
- browserStack:
id: "browserstack-access-key"
username: "...."
accesskey: "..."
description: "..."
We also see, other unrelated modification get blocked (e.g., adding a 2nd shared library via jcasc - if browserstack cred is present in config - we don't get the 2nd lib)
Additional Information
The browserstack cred does get created and passes the verification test in the credential web ui.
In addition, on my other jenkins instance - the cred is working properly and I checked that the values match.
This only seems to fail in our test environment when making unrelated change to credentials. If I add a new shared library to the yaml, it fails.
In our other environments, the reload and view work properly. I haven't tested the deploy to them as, proving efficacy and safety in test environment must come first.
The test environment is a different VPC and does use a different OKTA but I'm not sure how those could relate to the problem
The error message indicates that there is a mismatch between the arguments provided and the expected parameters for the BrowserStackCredentials constructor.
The constructor for BrowserStackCredentials expects the following parameters:
id: A unique identifier for the credentials. description: A description for the credentials. username: The username for the BrowserStack account. accesskey: The access key for the BrowserStack account.
Make sure you are providing the correct arguments in the correct order when constructing an instance of BrowserStackCredentials. If you are using this constructor in your code, ensure that the arguments match the expected parameters. If you are configuring this in a Jenkins job or configuration, verify that the values are entered correctly in the Jenkins UI.