When Jenkins packages and builds a node project, does it require the machine where Jenkins is located to have a node environment, or does it require the configured ssh remote server to have a node environment?
I built Jenkins on my local machine without ssh configuration, and then the build was successful. It means that it depends on the node environment of the machine where my local Jenkins is located, so I have the above questions.
Please give me some advice! ! !
I’m not very familiar with Jenkins, but since I’ve been invited, let’s talk about my understanding. The node environment is only needed where node projects need to be run.
Jenkins is just a continuous integration environment. The node project that Jenkins executes and builds is on the machine, and that machine needs to have the node environment installed.
Of course your ssh server must have a node environment.
In fact, ssh is just for remote control. It sends commands to the remote machine to perform related operations. It has nothing to do with your local environment.
I don’t know why your build was successful. Either your remote machine already has a Node environment, or you didn’t build successfully at all. You can look at the logs, or just ssh to the remote machine yourself and go through the build process.
I understand, in fact, it mainly depends on which step you want to package. If npm install and npm run build scripts are written in the command executed by Jenkins itself when building, then the Jenkins machine is required to have a node environment. To do this, just send the packaged dist directory to the remote machine. The remote server only needs to decompress it to start the web service. If this script is written in the remote command, then all the source code must be sent to the remote server, and the remote server must have a node environment, so that the node tasks must be handed over to the remote server.