PATH Changes Not Taking Effect in the Runtime Environment
Symptom
After the PATH environment variable is modified on the server, the modification does not take effect in the Jenkins pipeline script execution environment.
Possible Causes
- Environment variables are classified into system and user environment variables. After modifying either type, you need to run the source command or log out and log back in to refresh the variables in the current session.
- The PATH environment variable used in the Jenkins pipeline script is a snapshot copied from the current server when the Jenkins process starts. Subsequent changes to the server environment variables are not reflected in the PATH environment variable of Jenkins during runtime.
Troubleshooting Procedure
- In the pipeline script, source the configuration file or define the required environment variables directly in the script to apply temporary changes.
- Synchronize the environment variables between the server and the Jenkins pipeline execution environment. Then restart the Jenkins service after synchronization.