Is the code different per environment? I ask, because I think your build
and deploy activities should be separate. Builds should create artifacts
and put them on a shelf (or artifact repo). Then the deployment job should
be able to select whichever version of the artifact it wants to deploy to
any environment.

Is this a situation where you would want to define different environments
in GoCD to contain the specific environmental information? It would be a
manual task every time you wanted a new environment to define the new
environment and variables, but you could clone the pipelines into the new
environment and keep all the changes in the environment variables without
having to change any of the tasks.

I definitely see where you are coming from though, I would love to have
GoCD automatically recognize temporary feature branches to kick off
automatic builds and run tests of the code prior to merging it back into
master/develop.

For your 2nd approach, could you use relative paths? Especially since you
are defining the child folder, I don't think you need to know the parent
folder's full path.

On Fri, Jun 28, 2019 at 6:37 AM Moisés Belchín <[email protected]>
wrote:

> Hi,
>
> I'm right now using GoCD for automate our deployments.
>
> These are the versions I'm using.
>
>     go-agent  17.10.0-5380
>     go-server 17.10.0-5380
>
>
> I'd like to expose a case that I wasn't able to fix just by configuring
> GoCD, I couldn't find anything that can help me out on that, most likely
> I'm missing something ;-)
>
> Here's the case I'd like to achive:
>
> We have a GIT repository: `frontend-app`
>
> In that repo every developer can push changes to different branches
> following this naming convention: `dev-1`, `dev-2`, ...
>
> The goal to achieve is that every time a developer pushes changes to
> `dev-1`, goCD will take those changes in that branch, build it and deploy
> to our environment `dev-1`.
>
> If developer 2 pushes changes to `dev-2`, goCD will take those changes,
> build them and deploy to `dev-2` environment.
>
> The first I've tried, to achieve this, is configure the pipeline using
> only 1 material and try to use some glob pattern on branch names. As you
> can see in the attached screenshot.
>
> [image: gocd-01.png]
>
>
>
> However I couldn't get this working.
>
> The second thing I tried is to use multiple materials. To be able to have
> multiple materials you need to configure the material giving to it a
> specific Destination directory. As you can see in the attached screenshot:
>
> [image: gocd-02.png]
>
>
>
> With this approach I was able to have goCD pulling for new changes and
> checking repo out on the specific Destination directory.
>
> For my pipeline I have configured a template with a bunch of tasks to
> build the project, before deploying it, ie: `npm install`, `npm test`, `npm
> run-script build`, etc...
>
> However, those tasks are then executed on the parent directory
> (`go-agent/pipelines/frontend-app/`), instead of in the Destination
> directory (dev-1, dev-2, ...)
>
>     go-agent/pipelines/frontend-app/
>       |_ dev-1
>       |_ dev-2
>       |_ ...
>
> I've been reading about goCD environment variables and I couldn't find any
> variable that holds the destination directory, so I could reference it in
> my tasks.
>
>
> Of course, as a solution, you can always create several pipelines in order
> to achieve this, ie:
>
> frontend-app-dev-1, frontend-app-dev-2, etc...
>
> But my problem is that I have 8 dev environments and also 10 projects. So
> as you can imagine is quite a job to configure all those things separately.
>
> Specially if later we make any change, that's a lot of work to do it
> manually and prone to errors.
>
> So my questions are:
>
>  1. in case the first approach (branch glob pattern), can this goal be
> achieved by using Branch glob pattern ?
>
>  2. if we use second approach (several materials), Does someone know if
> this can be achieved ? I think I'm almost there, but probably I'm missing
> something when configuring my tasks.
>
>  3. Any other ideas to be able to get this working ?
>
>  4. Is there any other way to achieve the things I need ?
>
> Thanks in advance.
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/go-cd/1e103e59-2494-41fb-864f-c646170e1633%40googlegroups.com
> <https://groups.google.com/d/msgid/go-cd/1e103e59-2494-41fb-864f-c646170e1633%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/go-cd/CAJwF_ef-45JUcEtBA_9OMA2wTdE5dBiZjs9DW4R-Vwmzuyz8yw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to