Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Edit workspace files via jenkins UI

Is there an easy way to edit our python files in the Jenkins workspace UI?

It would be super nice if we could get code highlighting too!

like image 763
Alex Waters Avatar asked Oct 21 '22 16:10

Alex Waters


2 Answers

There is a jenkins plugin that allows you to edit files: Config File Provider It cant edit random file but you can use it to achieve what you want.

enter image description here

The storage of the plugin is in the form of xml files in jenkins folder. This means that you could create script that recreates those files wherever you need them by parsing those xml files (plugin does this for the workspace although it requires build setp). For instance, i could add new custom config file like this:

Name: script.sh Comment: /var/log Content: ....

This will be available then in xml file which you could parse within cron job to create actual files where you need them

like image 127
majkinetor Avatar answered Oct 27 '22 08:10

majkinetor


The closest I can think of that Jenkins offers is a file upload. You can upload file with local changes and then trigger a build. This file will be replaced at already specified location. This feature can be used by making your build parameterized and adding File Parameter option. Below is what Jenkins says about the description of this feature.

Accepts a file submission from a browser as a build parameter. The uploaded file will be placed at the specified location in the workspace, which your build can then access and use. This is useful for many situations, such as:

Letting people run tests on the artifacts they built.

Automating the upload/release/deployment process by allowing the user to place the file. Perform data processing by uploading a dataset. It is possible to not submit any file. If it's case and if no file is already present at the specified location in the workspace, then nothing happens. If there's already a file present in the workspace, then this file will be kept as-is.

like image 43
Shiva Kumar Avatar answered Oct 27 '22 10:10

Shiva Kumar