What is the working directory in Jenkins after executing a shell command window?

I look at Jenkins work and try to understand it.

I have an Execute shell in the Build field:

> mkdir mydir > cd mydir > > svn export --force https://example.com/repo/mydir . 

When Jenkins executes this command and proceeds to the next build step, what is its working directory? workspece-root/ or workspace-root/mydir ?

As a next step, I have Call up top-level Maven targets (still in the Build section).

I really want to know why this succeeds?
Is this because Jenkins automatically returns to the workspace-root/ folder after the shell command window is executed, or is it because the next task is a โ€œtop-levelโ€ task, so does Jenkins go back to workspace-root/ ?

+6
source share
2 answers

Each build step is a separate process that Jenkins puts off. They do not share anything, neither the current directory nor environment variables set / not changed within the build step . Each new build step begins by creating a new process from the parent process (the one that runs Jenkins)

Not that Jenkins has โ€œreturnedโ€ to $WORKSPACE . This is what Jenkins casts off the previous session.

+10
source

Recently, I saw that if you type CWD, I would get Project_NAME. For example, D: \ Jenkins \ workspace \ my_project

Any script that you possibly run will not be found. Therefore, we can make a "CD path" before starting the scripts.

0
source

Source: https://habr.com/ru/post/971343/


All Articles