pycharm, set the environment variable for every project and script - environment-variables

I have the same problem like here.
And I can set the environment variable for a specific script in an specific project.
But how to set the environment variable for every project I open with pycharm?
What I want to do is, to set
/usr/local/cuda/extras/CUPTI/lib64/ to LD_LIBRARY_PATH
for every project

Related

How to set custom environment variable for run script

How to set a custom variable from command line which will be available in the script executed by build phases.
I have a run script in my Xcode project's Build Phases who's operation depend on the value of this custom variable.
So from Jenkins, I want to set the environment variable
MYVARIABLE="some value"
Which will be used by the run script
In global properties you can set environments. Please check https://www.baeldung.com/ops/jenkins-environment-variables

Unable to access environment variable in Bamboo Build Plan

I have a Bamboo Build Plan, with the following set of tasks.
Source Code Checkout
Artifactory Generic Resolve (To Get the zip file from Artifactory)
Script (To Extract the contents of zip file and to set to CATALINA_HOME & PATH environment variable)
Ant (For Build)
Task 3 has the following content in it:
APP_HOME=${bamboo.build.working.directory}
unzip $APP_HOME/tomcat/apache-tomcat-6.0.45-windows-x64.zip
export CATALINA_HOME=$APP_HOME/tomcat/apache-tomcat-6.0.45
export PATH="$PATH:$CATALINA_HOME/bin"
But when I execute 4th Task (Ant), the Build is not considering the CATALINA_HOME & PATH variable which is set as part of Task 3. What is wrong here? Why am I not able to access the environment variable that is set in Task 3?
Every Script Task runs in its own non-interactive shell, eventually invoked through the ExternalProcessBuilder. Existing environment variables are made available to the process (i.e. shell), as well as the additional environment variables defined in the task itself as documented. However, newly exported variables are not carried over to the next task as it is an entirely new, isolated shell.
What you could do is to dump the export statements to a file, and 'source' that file at the start of the next script task.

How to set Global Environment Variables from a file in Jenkins

I am new to Jenkin pardon me for any wrong statements.
I have to set Global Environment Variables from a File(say config or txt) and I want to place that file either in my local or somewhere on the server.
I have gone through some documentations but it all says to use EnvInject Plugin which is basically helps for a specific job when we are building it.
But I want a solution where Global env variables can fetch from the file so that Configure System page can load quickly.
I'm assuming that you are looking to read properties from a specific file and inject them as environment variables to your jenkins job.
You can follow below approach:
Create property file like env.properties with below content:
testvalue='mytest'
Sample code to read the file and inject read variables as environment variables
node`{load "${WORKSPACE}\env.properties"
echo "test value: ${testvalue}"
}

How can I reference an environment variable in TFS build configuration?

I have set an environment variable on my system named MSBUILD_HOME that points to the directory that contains the msbuild.exe.
I want to reference this environment variable in the TFS build configuration. Specifically, I want to reference it in the Build->Advanced->Path to MSBUILD field of an MSBuild configuration step.
I have tried: MSBUILD_HOME, $(MSBUILD_HOME), %MSBUILD_HOME% but nothing works and I've Googled this to death. What am I missing?
Doh! I just needed to restart the build agent to pick up the changes to the environment. Using $(MSBUILD_HOME) was the right way to reference it.

Read TFS build variables from file

Is it possible to read a file from the git source control and set values to TFS build variables so that we can use them in other steps?
We have a file with the version info and the branch (VER_TYPE=3 is DEV) that we use to set up assembly version together with the build number
VER_MAJOR=2018
VER_MINOR=1
VER_TYPE=3
Tks in advance!
It's possible to define or modify a variable from a script, use the task.setvariable logging command.
Sets a variable in the variable service of taskcontext. The first
task can set a variable, and following tasks are able to use the
variable. The variable is exposed to the following tasks as an
environment variable.
When issecret is set to true, the value of the variable will be saved
as secret and masked out from log. Secret variables are not passed
into tasks as environment variables and must be passed as inputs.
Examples:
##vso[task.setvariable variable=testvar;]testvalue
##vso[task.setvariable variable=testvar;issecret=true;]testvalue
More details please refer Define and modify your variables in a script
You can run a script on windows agent using either a Batch script task or PowerShell script task. You just need to read the specific file in source control, download it in the workspace on the build agent. Then read the file, a way using powershell for your reference: Read file line by line in PowerShell

Resources