What I am trying to achieve is as follows:
Create a Jenkins Secret Text. Inject it into the Nuget.config in the source as a password into the packageSourceCredentials section. But the value shows up as all *** in the configuration file. Is this even possible?
Related
I need to store a .csv or .txt file and access it from the Jenkinsfile. I currently have couple of files which are in the credential storage (logins, passwords and so on) but this file just has to be stored on the Jenkins machine. I know I could upload it directly to the node but I would prefer doing it in the similar fashion as with the credentials (using web interface).
You can save the file in Managed Files through the web interface: Manage Jenkins > Managed files > Add a new Config.
Each file saved there will have an auto generated ID or you can set your own id, next you can use Config File Provider Plugin to access your files through Jenkins Pipeline using the file ID like this:
configFileProvider([configFile(fileId: 'maven-settings', targetLocation: '/path/to/file/in/workspace')]) {}
I have a groovy script that runs the command jenkins-cli create-job and uses an xml template to create a new maven job. In the template, I attempt to specify the owner using the jenkins ownership plugin, but this information is ignored. It appears that jenkins uses the default setting and sets the owner to the creator, which in this case is jenkins and thereby deployman. I'd like to somehow get around this and assign the proper own either by passing it on the command line or telling jenkins to ignore that default setting that sets the owner to the creator. Does anyone know how to do this?
Note: I have inspected the xml file passed on the command line and the config xml file of the new project in jenkins and run a diff between them. The only difference the the owner set to the wrong person.
https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI
Read "Working with Credentials" section.
Also you can validate who is logged in with following jenkins cli command.
who-am-i : Reports your credential and permissions
I have a jenkins job that pulls source code from GitHub public repo. I need to pass some files such as instance-specific configuration files containing secrets to the job and merge with source code prior to running build because these files are obviously inappropriate to be put in public SCM. The Jenkins instance is a multi-tenanted shared service.
The config files don't change often so I don't want to implement using file parameter which forces user manually input the file on every run. Another reason file parameter doesn't work is some builds are triggered automatically by SCM.
I don't want to use Config File Provider Plugin either, because the plugin requires jenkins admin access but I want users with job-level privileges manage the files themselves.
Ideally the uploaded files are saved alongside with job config.xml instead of in workspace, because I would like to delete workspace after each build. I can write scripts to copy the files from job config folder to workspace.
Are there any solutions available? Thanks.
If the "special" files are being placed in a folder with say some access privileges to it, couldn't you either run a Pre-SCM-Buildstep to move the files with shell commands, or introduce a regular build step (i.e. after the SCM stuff and before the other build steps) that would also use shell commands to move files?
I have an API key, for example, that is not stored in a git repo that I'd like to copy from a directory on a build machine. Where is the appropriate place to place these so that the jenkins user can still access them during a build. The host OS is ubuntu server and jenkins home is located at path /var/lib/jenkins.
Should these be placed and copied from /opt? from /var/lib/jenkins? from /var/lib/jenkins/userContent? What is accessible during a build?
Sounds like this should be a Jenkins build parameter.
Use a parameterized Jenkins build and specify the API key as a string param?
I am having some information in build.xml file which I would like to access in Jenkins email plugin,to be able to send that parameter. How can I access the parameter in Jenkins ?
I would recommend to use the Inject Env plugin.
Instead of reading the build.xml file, move your properties in a dedicated file (build.properties for example).
Next, this plugin can inject variables in your job using the build.properties file.