Cannot set artifactory repository on Jenkins - jenkins

I followed Empower Jenkins with Artifactory video on YouTube. Basically, I added a new user to artifactory and granted it deploy permissions. Then I configured system configuration on Jenkins and tested that the configurations were right.
I created a new job and tried to set the deployment task to deploy it to artifactory. The problem is there is no repository on the dropdown.
I want to know how to fix this.

Try saving the job and reloading it.
The logic behind this behavior is to avoid a long list of repositories. Some users have hundreds of local repositories which takes a long time to display. By entering credentials, you can display a filtered list containing only relevant repositories.
There is an open issue to add a refresh button so there will be no need to save the job prior to displaying the list.
Update
This issue was resolved with the release of version 2.2.3 of the plugin. For more info see HAP-483

Related

Jenkins GitHub Webhook not triggering builds

I have a Jenkins server (2.249) setup and I have connected my GitHub account and tested the connection and it works fine, but for a normal pipeline job where you enter the GitHub repo url, Jenkins seems to add an extra slash at the end? So I can't get my normal pipeline job to build on a push event, I've checked the logs and it says:
skipped [repo-name] because it doesn't have a matching repository.
So I've starting to think its because Jenkins is adding an extra slash at the end of my repo url? The webhook on the GitHub side works as it gives back a green tick and it works on another multibranch job for push events, just not the normal pipeline jobs.
Don't know if the problem is still on after more than one year but because I've just faced the same issue, here is an answer that help me to understand : https://serverfault.com/a/884717
Just to resume the answer : you have to complete the git part (scm) of your Project Configuration :
For my part: as the project is a private one, in an organisation that I can't update to add a personal token (as I'm not the owner of the resource - organisation), I choose to use the git+ssh url with a ssh key access to this repo. The next trick for github is to add the github's IPs to the jenkins user know_hosts file !
The reason behind the need to add twice the repository url is obscure. But I could only see that in https://github.com/jenkinsci/github-plugin/blob/master/src/main/java/com/cloudbees/jenkins/GitHubRepositoryNameContributor.java#L113 the method parseAssociatedNames will try to get the Jenkins'job associated names from :
com.cloudbees.jenkins.GitHubRepositoryNameContributor$FromSCM
com.cloudbees.jenkins.GitHubTrigger$GitHubRepositoryNameContributorImpl
org.jenkinsci.plugins.github_branch_source.GitHubSCMSourceRepositoryNameContributor
I think the third one is for multibranch pipelines. I don't really know for the second but indeed the first one is fromSCM configuration !

Is there a way to log changes in Jenkins server configuration?

I'm looking for something like the Job Config history plugin but to log the changes in the Jenkins server itself (any change under the /manage section or credentials).
I tested the Audit Trail plugin, but it only logs who and when, but nothing about the content of the change.
I'm using the roles based strategy, so there is a reduced group of people able to do changes, but I still need more precise information.
Job Config History Plugin also tracks system configuration. Just click on Job Config History (on the left-side menu) on the main dashboard (outside of any job). When there, you can see all server configuration changes with all features like diffs and raw XML access.

Jenkins pipeline menu does not show the "Configure", "Build Now", and some other options

I have a Jenkins pipeline that I have setup with a project I have on GitHub. Initially, I manually initiated a build each time I changed my code by clicking the "Build Now" option. However, I did two things to make my process easier:
I setup a GitHub hook to run the build I defined in my Jenkinsfile after each push to my master branch
I setup a periodic build to build every hour
I left my Jenkins for a day, came back, and everything, even from the dashboard, looks different.
For example:
My dashboard used to have these options:
New Item
People
Build History
Project Relationship
Check File Fingerprint
Manage Jenkins
My Views
Lockable Resources
Credentials
New View
The current dashboard only has three of those options:
People
Build History
Credentials
Also, when I clicked on my pipeline, the options I had were:
Status
Changes
Build Now
Delete Pipeline
Configure
Full Stage View
Rename
Pipeline Syntax
Whereas now, they are:
Status
Full Stage View
GitHub Hook Log
Git Polling Log
How can I change my configurations/settings to see the pages the way I saw them before? It seems I can't create any new items or change my current pipeline, which are things I may need to do in the future.
It turns out I wasn't logged in. I didn't think the initial pages would even show up if I hadn't been logged in, so I didn't even consider it to be a possibility. I logged in and all my issues were resolved.

Jenkins: Tracing the history of unsaved new test definition (copied from another test definition)?

Recently, in our enterprise production setup, it seems someone has tried to setup a new job / test definition by using another (copying) from identical job. However, (s)he seems to have NOT saved (and probably, am guessing here, closed the browser with the session being lost).
But the new job got saved though it was not set to stable or active; we knew about this because changes uploaded to gerrit, started failing in this newly setup partial job (because, these changes were in certain repos that met certain TDD settings).
Question: Jenkins system does not have trace of who setup the system in 'configure versions' option. Is there anyway to know the details of who setup the job / when was that done ?
No, Jenkins does not store that information by default.
If your Jenkins instance happen to be running behind an Apache or Nginx web server, there might be access logs that can help you. To find out when the job was created you could look at when its config.xml file was created/modified.
However, there are a few plugins that can add this functionality so that you won't have this problem again:
JobConfigHistory Plugin – Tracks changes in your job configurations and gives the ability to restore old versions.
Audit Trail Plugin – Keeps a log of who performed particular Jenkins operations, such as configuring jobs.

Build Jenkins project on BitBucket pushes and pull requests

I have a scenario where I'm setting up Jenkins for my app. I have BitBucket set up and firing appropriate webhooks.
I want to start a build whenever a push is made to the repo as well as whenever someone creates/updates a pull request.
I've looked at the BitBucket Plugin. It works good if I have the BitBucket webhook to fire for all pushes.
Then I added the BitBucket Pull request plugin to build on every pull request create/update. So I changed the BitBucket webhook preferences to fire on pushes and PR creates/updates.
Unfortunately, these plugins have conflicting settings, hence they cannot be used at the same time (as per my research, the minute I send custom webhooks from BitBucket, the first one stops working, but the second one works)
Has anyone been able to set this up correctly? Maybe there's a plugin for what I want, but I couldn't find it.
I want to keep writing a proxy in front of Jenkins to manage webhooks the last option, only if there really is nothing I can do.
Thanks for the help!

Resources