I have to deploy my web application (which is made in React) in Apache2 using Jenkins.
I want jenkins instead of redirecting the repository data to "Building in workspace /var/jenkins_home/workspace/" to automatically redirect them to "/var/www/" and build the build there when a push is made and so on updating the website automatically.
I’ve been looking for many parts and I can’t find information that can help me, I don’t know if it’s possible.
I use Ubuntu as operating system, but later I will deploy the Jenkins server to CentOS Stream.
So information for either one can work for me.
Try using bash command but it didn’t work
"dir("folder") {
sh "pwd"
}"
In folder I added the path to "/www/var/home/osboxes/jenkins/var/jenkins_home/workspace/CI – CD" but it gave me the following error:
2
Answers
In oders of complexity:
For all these try to use jenkins pipelines as code and commit your jenkinsfile in the project code.
Great, so deploy the file via FTP to the apache server with Jenkins. There is a command
lftp
. I typically use docker image with commands that I need, like https://hub.docker.com/r/minidocks/lftp .I would put that
lftp
command line in a script so you can test it locally first.