Search code examples
go-cd

how to copy build files from go-agent?


I am trying to deploy a static website using nginx on ubuntu, for that, i create a pipeline that has the following task

npm run build

this task build the website and store is in /var/lib/go-agent/pipelines/MyPipeline.

Now I need to copy the build directory to another path so that nginx could read it. How could this be done using GoCD? Or How to make the go-agent store the files in another directory?


Solution

  • Does nginx run on the same machine as the GoCD agent? If yes, a simple copy or rsync could be enough.

    If not, scp/rsync might help.

    But the proper way to deploy an application is to build some kind of package from it (like a tar ball or a zip file or so), and then collect it as an artifact. You can then have a second stage that deploys this artifact to any web or application servers you have.

    This has the advantage of versioning built in, so you can go to older instances of your pipeline, retrieve the artifact, and so deploy an old version if a new one breaks things.