What is a workspace?
Each build has its own workspace: a directory that is synced between the Continua server and any agents the build runs on. A workspace is where you would generally put files that the build needs to work with - like source code and the outputs of a build. Continua automatically puts files in the workspace but they're used internally and won't be of much use to the end user. By default, Continua puts the build's variables and the build's log in the workspace. Each stage of the build defines what gets put in the workspace using Workspace Rules and Repository Rules. By default, all repositories will have their contents copied to the Source directory and any files placed in the Output directory will be synced between stages. Using a copy of the repository means that we can run multiple builds of the same stage, at the same time, on the same agent without any conflicts. This is very useful if you set up feature branch builds.
What can I find in a Build's Workspace?
The contents of a build's work space changes depending on where it is and what stage the build is at. When a build has been initialized, the work space contains the variables and build log and only exists on the server. Once a build hast started, the work space will have been copied to an agent and will additionally contain whatever repositories were associated with the Configuration that started the build. Lets assume you have associated two Repositories with the Configuration you're about to build and have called them MySourceRepo and MyBinariesRepo. The work space on the agent will look something like this:
As the build progresses the work space will change depending on your workspace rules. By default, the workspace during the second stage would look like this:
How do I make use of files in the Workspace?
The first and most important thing is to make sure your files are actually in the workspace. The three main ways to get files in your workspace are:
- Workspace Rules and Repository Rules. These rules can be used to copy your repository into the work space and also sync files from the workspace between stages.
- Copy Action. It's a pretty simple concept, specify a source file/directory and give it the workspace's path using query syntax as the destination directory.
- When running executables within the build process, be sure they output to directory within the workspace.
When designing your workflow and creating actions, you can always get the full path to your workspace by using the query syntax $Workspace$.