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

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.

Related

Jenkins Build With Parameters shows old and new parameter fields

My Jenkins shared pipeline, used by dozens of repos internally, has several parameter fields defined. We have several repos that initially used another library, or their own ad-hoc pipelines, but then imported the shared library.
In some of these cases, the "Build With Parameters" UI shows both the old and new parameters. We have re-run the pipelines several times, but the old fields won't go away.
If we create a new branch, only the new fields are shown.
I am thinking there's an xml file on the controller that we have to wipe, but I'm not sure where.
Has anyone seen this? What's the resolution?
Update 1
I went into the jobs folder for a branch showing this, and backed-up the config.xml file:
> cd /mnt/data/jenkins/jobs/<org>/jobs/workflows/jobs/<repo>/branches/jenkins-test/
> mv config.xml config.xml-bak
Upon re-running the job, it re-creates the config.xml and it has the same issue: old and new fields still showing.
So I deleted the entire jenkins-test branch folder. The job doesn't go away in the UI. I made a test commit to the branch in Github, Jenkins picked it up and ran it. It automatically re-created the jenkins-test folder on the controller, and upon re-trying Build With Parameters, it still shows the old and new params.
Got to keep digging...
Update 2
I created https://issues.jenkins.io/browse/JENKINS-69652 for this.
update 3
I confirmed the commit that triggered the build is the right commit in the source repo, and it is pulling the correct commit of the pipeline library.
Update 4
Interesting. I Replayed a run, and entered a dummy pipeline:
pipeline {
agent none
stages {
stage ('hello') {
steps {
echo 'hello!'
}
}
}
}
Going back to the Build With Parameters UI, it now shows only the old parameter fields. Where is this coming from? Where is it stuck??
My first guess is that you're loading a Pipeline library implicitly and defining the parameters in that implicitly loaded Pipeline library.
Pipeline libraries that are loaded implicitly are loaded into the Jenkinsfile without requiring an #Library reference to load them.
Check the jobs and the parent folders of those jobs and the root for Pipeline libraries that are defined and have the 'Load implicitly" checkbox enabled.

Veracode as a precommit hook for git

How to integrate Veracode scanner as a pre-commit hook for git working repository? How can we check weather the scanner is actually running?
You can create a GitHub Action about Veracode static scan analysis. To do this you can follow the steps below:
In the Security tab of your GitHub project (you need to have admin rights for the GitHub project), click on "Enable settings" for "Code
scanning alerts".
This takes you to the Settings of the project, where you need to “Enable” “GitHub Advanced Security” for “Code scanning”,
and then click the “Go to code scanning” button that will be enabled.
Scrolling down on the list appearing with multiple code scanning tools, you pick “Veracode Static Analysis” (usually appearing on the bottom of the page).
Clicking to “Set up this workflow”, automatically creates a subdirectory in master branch in .github/workflows path. The workflow is configured in a .yml file, that contains the steps of the pipeline.
Prerequisite: you need to set up Veracode API Keys as Project Secrets (have a look here Create Veracode API keys and here
setup GitHub Action Secrets for Repository. Name your API Keys as VERACODE_API_ID and VERACODE_API_KEY (as these are the names that are set in .yml file or change them accordingly in both locations)
In the .yml file that got created automatically there is a pipeline that runs according to the rules set on the line where it says
you can have a look at this link for more information on push/pull request branches/tags
branch names can be altered, following regular expressions as well, see here for more info.
You can configure the Action to run on schedule as well.
Hover over “cron” to see the man-read format that appears. With this, the Action will run according to cron. Scheduled workflows run on the latest commit on the default or base branch.
Find more information on how to configure scheduled events on GitHub Actions here
In the Actions tab of your Project you can now see the logs of the run of the pipeline and each run's status.
After you have set up the GitHub Action as described above (steps 1-8), and the Action has run well (check its status as described in step 9) in the Security tab of your GitHub project, you should be able to see that "Code scanning alerts" are "Active", click on "View alerts", that takes you to the list of the Veracode flaws if any.

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 !

No Save/Apply button on Jenkins pipeline configuration page

The Save/Apply button is missing from Jenkins pipeline configuration page. There seems to be no other way to apply changes to the configuration settings. I am unable to find any useful answers or workarounds as well. I have tried several Javascript workarounds, reinstallation, uninstalled plugins that generated warnings, and stuff but nothing seems to be working. I am using Jenkins version 2.222.3 with BlueOcean.
It would be a great help if anyone can suggest a solution.
Jenkins Pipeline configuration is defined in Jenkins Pipeline (e.g. Jenkinsfile). To change your configuration, you need to edit your Jenkinsfile.
E.g. to change "Build periodically", here's an example of edit you need to do:
pipeline {
triggers {
cron('* * * * *') // run every minute
This is why the page you're looking at is called "View Configuration" — it is for viewing only.
Using the GitHub plugin, we have an organization folder that is scanned for any repositories that contain a Jenkinsfile. The configuration you are viewing is driven by a config.xml that is copied from the organization folder into each job that runs in a repo. So you want your changes to affect jobs/my_organization/config.xml, not jobs/my_organization/jobs/my_repo/config.xml.
In the UI this is accomplished by going up a level or two from the job or job run. There you will see the link change from "View Configuration" to "Configure".

Cannot set artifactory repository on 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

Resources