Is this the expected behaviour?
yes, the command line utility, by default, does not know the name of your repository and therefore does not know what the workspace should be.
what are the best practices to overcome this?
- specify the desired workspace in your yaml to override the default calculation, OR
- provide the appropriate command line flags so that drone can determine the default workspace
You can read more about workspaces here:
And see a working example at https://github.com/drone-plugins/drone-gh-pages/blob/master/.drone.yml#L1:L3
This is an example of using the command line flag:
drone exec --repo.link https://github.com/foo/bar
The above example provides the command line utility with the same field the drone server uses to determine the default path. The primary different between
drone exec and the server is that drone server has access to all the data in the hook payload. The command line utility does not have access to this information by default.
That being said, every single piece of data that the server has access to can be simulated from the command line utility using flags. You can run
drone help exec to see the full list of available flags.