Why does Jenkins Credentials show "This ID is already in use" - jenkins

I am doing a fresh install of Jenkins on an EC2 Ubuntu AMI. I install the default set of plugins (which includes the Credentials plugin). After logging in, I go to the Credentials link, select the default Global domain, and add a new credential. After I add a username with password credential (leaving the ID blank), I am able to add it. But then when I click on Update, I see "This ID is already in use" message under the ID field. I have tried this with Jenkins 2.23, 2.21, and 2.18 and I keep seeing the same message. Anyone know why this could be happening? Credentials Error Message

It turns out that the problem went away once I changed the version of one of the plugins. The Credentials Plugin version 2.1.5 was showing this problem. Once I changed the version of that particular plugin from 2.1.5 to 2.1.4, the problem went away and I haven't seen it since.

Should be fixed with (not released yet) v2.1.6: https://issues.jenkins-ci.org/browse/JENKINS-38861
EDIT: New version v2.1.6 was released and fixes the problem for me.

Related

Issue while package reset on xcode 13

Showing Recent Errors Only
git#github.com:XXX/iOS_Freestyle_Crew_SDK.git: The remote repository could not be accessed. Make sure a valid repository exists at the specified location and that the correct credentials have been supplied.
Issue got resolved after providing permissions to the git account for that particular folder or group.

Jenkins asking to enter initialadminstration password when upgrading version

I am trying to upgrade Jenkins version and deployed jenkins.war to webapps folder.After restarting the tomcat server jenkins taking to initial set up to register admin user.But i have already users created and assigned with roles.How to skip the initial set up and to to login page instead.
Looks like loading variables from JNDI was removed in 2.332.
https://community.jenkins.io/t/jenkins-home-variable-not-read-in-2-332-1-running-in-apache-tomcat-9/1826/4
To get it working, add the below in tomcat/bin/setenv.sh. Replace the path according to your directory structure
export JENKINS_HOME=/apps/jenkins

How to reset my jenkins user id and password

Forgot my Jenkins User ID and password is there any way to uninstall and remove the backup completely so that I can reinstall Jenkins with new settings/configurations? I tried finding the config file so that I could altered the
<useSecurity>true</useSecurity>
but I couldn't find the config file.
I also tried removing the application including the cache but yet installing again it shows me the login window
enter image description here

Jenkins Blue Ocean Plugin fails to connect to GitHub

I'm trying to create a Jenkins pipeline using Blue Ocean but when I try to connect to my GitHub using the GitHub generated access token, nothing happens. However, when I check the console, I get this error message. Someone please help me out.
blueocean.js:58216 Unhandled Rejection: "Error: fetch failed: 500 for http://127.0.0.1:8090/blue/rest/organizations/jenkins/scm/github/validate/?apiUrl=https://api.github.com\n at FetchFunctions.checkStatus (http://127.0.0.1:8090/adjuncts/49720cc1/io/jenkins/blueocean/blueocean-core-js.js:54923:25)" lo
gUnhandledPromiseRejection # blueocean.js:58216
At the network tab, the response is:
"message" : "No 'injectableValues' configured, cannot inject value with id [org.kohsuke.github.GitHubResponse$ResponseInfo]\
It seems the issue was with the version of blue ocean I had installed. I downgraded to 1.106. You can do the following to sort the issue.
Grab the 1.106. version of the plugin from Here
Then go to manage plugins > Advance > Upload Plugin and upload the 1.106 plugins and install it. All dependencies and indirect dependencies will also be satisfied with this version.
For more information check here
Downgrading GitHub API to 1.106 worked for me.

Jenkins: How to Change LDAP Password

My institution requires me to periodically change my LDAP password.
In the past, I was able to perform the following steps to change my password:-
Create a Base64 encoded password at http://www.base64encode.org/
Edit /var/lib/jenkins/config.xml and change <managerPassword/>.
However, the recent version of Jenkins no longer use <managerPassword/>. Instead, I'm seeing <managerPasswordSecret/>.
I'm not sure how to generate the new secret password, so I did the following:-
Backup /var/lib/jenkins/config.xml first.
Edit /var/lib/jenkins/config.xml and change <useSecurity/> to false.
Restart Jenkins service.
Go to Jenkins.
Enable LDAP Security.
Enter new LDAP password.
Save it.
Open up /var/lib/jenkins/config.xml and copy <managerPasswordSecret/>.
Restore backup config file.
Replace <managerPasswordSecret/> with the new value.
This is incredibly convoluted.
Is there a more straightforward way for me to maintain my LDAP password change in the future?
Thanks much!
None of the above solutions worked for me with a newer version of Jenkins (2.78). What did work was putting the managerPasswordSecret in without any encryption. Once I ran Jenkins, the password got encrypted for me.
You can still use <managerPassword>.
Generate the new encoded password with
perl -e 'use MIME::Base64; print encode_base64("yourNewPassword");'
In your config.xml, find <hudson>/<securityRealm>/<managerPasswordSecret>. Change <managerPasswordSecret> to <managerPassword> (both before and after) and put the encoding from #1 between them. Save the file.
Restart jenkins
Login and using the UI, reset the LDAP Manager password to the same yourNewPassword. config.xml should now be back to <managerPasswordSecret>.
If you are paranoid (like me), restart jenkins again to use the newly modified config.xml.
I was trying to do same thing and this is simple solution (use from Jenkins console):
import com.trilead.ssh2.crypto.Base64;
import javax.crypto.Cipher;
import jenkins.security.CryptoConfidentialKey;
import hudson.util.Secret;
CryptoConfidentialKey KEY = new CryptoConfidentialKey(Secret.class.getName());
Cipher cipher = KEY.encrypt();
String MAGIC = "::::MAGIC::::";
String VALUE_TO_ENCRYPT = "";
println(new String(Base64.encode(cipher.doFinal((VALUE_TO_ENCRYPT + MAGIC).getBytes("UTF-8")))));
Decoding is simpler:
println(hudson.util.Secret.decrypt(HashFromConfigXmlHere));
Edit your config.xml file by hand.
If your Jenkins uses a <managerPasswordSecret> set of tags, put the new plain text password in there and Jenkins will read it. Once Jenkins starts up, go to the Configure System > Configure Global Security page and click Save. That will update that field with the encrypted version.
The current easiest and fastest solution (just worked for me) is from Cloudbees: simply enter the new password into the password field in the config.xml as plain text (not encrypted) then Jenkins will read that correctly. Once you start Jenkins and just re-save the Manage Jenkins -> Configure Global Security page
https://support.cloudbees.com/hc/en-us/articles/221230028-Changing-LDAP-Password
I tried solution provided by #alkuzad and its working fine. Just to clarify that you can't use Jenkins web Console when LDAP user password is expired. So what I did is as follow (I have groovy script plugin in Jenkins. I also provided run script access to anonymous user - not a good idea but it's the way I initially found to resolve this recurring issue).
Downloaded jenkins-cli.jar
put above code in GroovyPasswordClass.txt (not to forget using new password in place of VALUE_TO_ENCRYPT in code)
start jenkins server (its requirement to have jenkins running)
run below command from command prompt
java -jar jenkins-cli.jar -s groovy GroovyPasswordClass.txt
This will print encrypted password.
Better Option
Well, later I found better way to do authentication if directory service provider is MS Active Directory. In that case instead of LDAP plugin, I used Active Directory plugin for authentication. This I found better because
1) Response is faster when use Active directory plugin instead of generic LDAP protocol based plugin
2) Active Directory plugin uses user data with which Jenkins service was started and no need to configure any user account in Jenkins. So you will never have situation that your Jenkins login not working because user configured for ldap has expired password.
Hope this will help others trying to resolve this issue.

Resources