Doesn't seem hard but can't copy file in job

21 views
Skip to first unread message

Max DiOrio

unread,
Jun 19, 2019, 2:58:22 PM6/19/19
to go-cd
Hi,

Just starting to use GoCD.  I have a Pipeline to push a git repo to a remote server upon changes.  I want to take the checked out repo, which I believe the working directory is /var/lib/go-agent/pipelines/Grafana/*

I now want to copy the files to another directory - should be simple, run a job task with:

command /bin/cp
Arguments:  -r * /var/lib/grafana/grafana

I have no idea why it can't stat the dir. I logged in as the go user, and can navigate to the directory and run the command manually and it works fine.

Any idea?

Thanks!

[go] Task: /usr/bin/pwdtook: 0.103s
/var/lib/go-agent/pipelines/Grafana
[go] Task status: passed, took: 0.103s
[go] Task: /bin/cp -r * /var/lib/grafana/grafanatook: 0.103sexited: 1
/bin/cp: cannot stat ‘*’: No such file or directory
[go] Task status: failed, took: 0.103s, exited: 1
[go] Current job status: failed

Max DiOrio

unread,
Jun 19, 2019, 3:07:22 PM6/19/19
to go-cd
As always - I figure it out right after I post to a group.

Turns out that go encloses the command in quotes by default, which means the console is interpreting the asterisk as a literal, not as a wildcard.  Had to change it to run as bash -c cp -r ./* /var/lib/grafana/grafana and that worked perfectly.

Hope this may help someone else.
Reply all
Reply to author
Forward
0 new messages