I have an API that checks for holiday and runs/not runs a build based on the result. The problem now is that I have to manually change Jenkins jobs to include that logic which is obviously very inefficient. Is there a way/tool to quickly add/remove that check or any other checks in the future to specific jobs quickly without going through them one-by-one? I could see maybe using Jenkins API as one option, is there anything else?
Thanks.
User JobDSL you can programmatically solve your problems in one place with a Groovy DSL.
https://wiki.jenkins-ci.org/display/JENKINS/Job+DSL+Plugin
Related
I wonder if there is a way to close a issue automatically at a certain time like every Friday at 18:00 if that issue has a label or something like that.
GitLab did not include such a feature.
They use their own bot to triage issues and merge requests.
This isn't a feature of GitLab itself. However, you could run a scheduled pipeline that uses the issues API to do this.
To make sure the scheduled pipeline has the properly scoped API access, you can generate a project access token and place it in the CI/CD variables.
The scheduled pipeline does not even necessarily have to be configured in the same project in which you want issues to be expired, if you're concerned about it triggering existing pipeline jobs. For example, you can create a new project called "issue cleanup" and setup the pipeline there to cleanup issues of one or more other projects on the schedule
At work we have recently started using Jenkins.
I would like to be able to see the basic status of builds from within Vim.
Is there a typical or standard way of doing this?
Currently i am using my own script which interacts with the jenkins API but it seems unlikely to me that there would be no more common ways of doing something which i think rather a lot of people would want to do.
You can use this vim plugin, which I have developed;
https://github.com/burnettk/vim-jenkins
Since most apps that use Jenkins going forward will use Jenkinsfiles, I decided to use that as the hook. So what you do is add a comment anywhere in your Jenkinsfile with the path to its build plan, like this:
// BUILD_PLAN_PATH: /view/Sweetapps/job/hot-app/job/master
This comment is theoretically useful even apart from this feature as documentation, but its purpose is for the plugin to parse it to figure out how to interact with the jenkins API to fetch the build status (FAILURE/SUCCESS/etc) for the build plan that goes with this Jenkinfile. Once the comment is in place, fetch your build status by running:
:JenkinsShowLastBuildResult
Or its shortcut ("jenkins build"):
<Leader>jb
The build status will be echo'ed into your vim window.
My favorite feature is still Jenkinsfile validation. I use it multiple times a day.
:JenkinsValidateJenkinsFile
or the shortcut (short for "jenkins Jenkinsfile"):
<Leader>jj
Hopefully people like the features, and maybe get some ideas about other features that might be useful to add. Pull requests are of course welcome. I intend to add a feature to open the same build plan that is already documented in the Jenkinsfile in a browser window (using mac "open", but probably if anyone cares to make it work on linux or windows, it would be possible).
I am trying to find a way to search multiple project's code in gitlab CE.
Has anyone encountered this before, or have a recommended approach?
(I realize that if this is even possible, then I would likely need to create a script that mimics the current call from the GUI multiple times and combine the results. )
Recently came into a similar need. My particular use case is a self-hosted instance of GitLab CE. Seems like it's possible to use GitLab's API where the scope is limited to snippet, then loop through your groups and projects.
Example code:
https:// (instance_server) /search?utf8=%E2%9C%93&snippets=&scope=&search= (key words) &group_id=22&project_id=81
Other links:
GitLab's paid version.
https://docs.gitlab.com/ee/user/search/advanced_search_syntax.html#syntax-search-filters
Mention of original request (closed)
https://gitlab.com/gitlab-org/gitlab-ce/issues/14597
https://forum.gitlab.com/t/search-code-across-all-projects/2263 (SourceGraph)
You can create a Group, migrate or move all of the projects you want to search to that group, and then search just that group.
I have just a single instance of jenkins on a local machine which we are using to build our code. We have different project teams working on different projects, and different jobs for each project.
To eliminate the possibility of someone from one team accidentally messing up another team's job, i have created multiple jenkins users.
However, all of the users that can log on still see all of the jobs. Is there a way for certain users to only see the jobs that pertain to them?
I have searched extensively for something like this but no luck. I haven't found any plugins for this. I am using matrix based security currently, and although you can change the permissions of all the users through this, you can not apply specific permissions to specific jobs. At least to my knowledge. Any ideas?
Just to clarify, I want one of the many teams to log in to their user account in jenkins, and only see their jobs. The jobs of the other teams should not be visible, only the ones that they are assigned should be visible when they log on
The closest thing i have found for this is in the Role Strategy Plugin, there is a user-based job filter
Turns out there is a feature already in jenkins for this, no plugins necessary!
In the Configure Global Security section in Manage Jenkins, click "Project-based matrix authorization strategy".
Then you can configure permissions in the job configure screen for that particular job by clicking "enable project-based security".
Now you can configure your Jenkins so that "Joe can access project A, B, and C but he can't see D".
I've been doing some research into finally automating our Development builds and still have one nagging question that I'm hoping the StackOverflow community can solve for me.
My understanding is that an IntervalTrigger when setup properly will check VSS every X seconds for changes and if it finds a modified file, will run my tasks. One of my tasks would be to checkout the AssemblyInfo files and update the version numbers. After these files are updated they would be checked back into VSS.
Thinking about this solution it doesn't make much sense because in my mind, I'm forcing the check for changed files to true every time the trigger fires. Am I missing something here? Is there a way of doing this without triggering an automatic build on the AssemblyInfo check-in?
You can use a Filtered Source Control Block to exclude certain files from the trigger.
I just posted a bunch about my default build process here which may be of some interest to you: SVN Website Development and Deployment Solution
The way I usually configure my projects with CC.NET is to have two project blocks per solution. One configured as an interval trigger that does nothing more than get the latest from my repository, build the solution, and run unit tests. The other is a schedule trigger that does all the things the other one does, but actually publishes a build. This includes changing version numbers, publishing files, etc. This might work in your case, since the change in version would cause the interval project to trigger, but only once.
Checking the automatically generated AssemblyInfo into the version control system is a bad idea, don't do it. You'll get a lot of noise (50% of all commits!) in your history. Also, it does not give you any new information - you can always pull this from VCS. Have your build script autogenerate those files is a good practice, but don't push those changes back!