make build path="/pipeline_path"
make build path=$pipelinepath
make build path="$pipelinepath"
export myVar="/path/to/myProject"
CONFIDENTIALITY. This email and any attachments are confidential to Alef Edge Inc., and may also be privileged, except where the email states it can be disclosed. If this email is received in error, please do not disclose the contents to anyone, notify the sender by return email, and delete this email (and any attachments) from your system.
--
You received this message because you are subscribed to the Google Groups "go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email to go-cd+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/083817de-2527-4e3e-a53f-36d4a1b407f4%40googlegroups.com.
[go] Task: echo $(pwd)took: 0.2s
$(pwd)
One thing I've learned working with GoCD for a while is, you don't want to use absolute paths anywhere. Especially when agents are run across different hosts or as ephemeral containers somewhere.To get the current pipeline path one can use something like $(pwd) or dirname etc. and use relative paths from that location.Another point is Tasks within a job don't share any session on a shell of any kind among them. So if you export a variable and try to use it in the next task or later within the job it wouldn't work. They will have to be specified at the environment, pipeline, stage or at a job level. The specificity goes in the reverse order. Also as a general convention I've achieved best results when these scripts are NOT in GoCD tasks but instead in a separate shell script file and added as part of the source code or via a separate ops repo material(s).HTH.
On Wed, 8 Apr, 2020, 17:13 Shivani Shinde, <shivan...@alefedge.com> wrote:
Hi everyone,I am having the hardest time dealing with variables for a task.What I want to achieve:1. I want to pass a variable(pipeline's path) to the task which generates builds. This is build command:
make build path="/pipeline_path"I tried setting variable pipelinepath, in the environment variable path, and using it in the task as specified in the document like:
make build path=$pipelinepathor
make build path="$pipelinepath"
But it does not work!2. I want to export certain variable assigning it a path of the directory I git cloned. I have mentioned the git URL in Materials of pipeline and mentioned destination directory as 'myProject'.I want to do the following:
export myVar="/path/to/myProject"I want to achieve this at task level.How can I work on this? Any help will be appreciated!Thank you.
CONFIDENTIALITY. This email and any attachments are confidential to Alef Edge Inc., and may also be privileged, except where the email states it can be disclosed. If this email is received in error, please do not disclose the contents to anyone, notify the sender by return email, and delete this email (and any attachments) from your system.
--
You received this message because you are subscribed to the Google Groups "go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email to go...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to go-cd+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/ba9282ab-cf09-4be5-808a-4711cefe6d90%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/CAD9m7CwALQuoEXNv3TNjAuGAJD1%2BPMU-kO5mzyrhddyREw7_HQ%40mail.gmail.com.
But I need to pass the path to my command which will be something like this:make build path=$(pwd)Where I mention make in custom command field. How do you suggest to use bash -c with this command?
On Wed, Apr 8, 2020, 7:25 PM 'Ashwanth Kumar' via go-cd <go...@googlegroups.com> wrote:
Try using it like thisbash -c "echo $(pwd)"
To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/ba9282ab-cf09-4be5-808a-4711cefe6d90%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email to go...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/CAD9m7CwALQuoEXNv3TNjAuGAJD1%2BPMU-kO5mzyrhddyREw7_HQ%40mail.gmail.com.
bash -c 'make build path="$(pwd)"'
took: 0.2sexited: 127failed, took: 0.2s, exited: 127
failed
I specified the following in task:
To unsubscribe from this group and stop receiving emails from it, send an email to go-cd+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/72225a93-0f73-4f0c-9534-e5e606de96a0%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/CAC4v4bH4UWh1bXtwXgot9j2Ls15eqwuJz_byBvo3SPUg9CcJow%40mail.gmail.com.
bash -c "make clean build_ap pkg path=$(pwd)"
took: 0.3sexited: 127failed, took: 0.3s, exited: 127
To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/CAD9m7CzP%3DhQj8D%3DXB_RcJiJBa_n4orv9kFhs1_ykT7ftto4MxA%40mail.gmail.com.
make: pwd: Command not foundmake: uname: Command not found/bin/sh: 1: basename: not found/bin/sh: 1: date: not foundmake: git: Command not found
I was able to get it working. I mentioned my environment variables at Stage level. And mentioned task as:
bash
-c
make build pkg path=$pipelinepath