On Thu, 12 Sep 2019 at 16:44, Aravind SV <[email protected]> wrote:
> Hello Ilari, > > On Thu, Sep 12, 2019 at 04:14:55 -0700, Ilari Mäkimattila wrote: > > I'm looking for a way to prevent anyone from manually running a pipeline > > that is not the newest version, for example by going to the pipeline > > history page and clicking the rerun button. The reason for this is that > > we're using Go to run infrastructure changes and running an old > > configuration could lead to a broken state that is hard to resolve. > > > > I've read through the manual and I didn't anything relevant and so I > > believe this feature doesn't exist but I would be happy with a > workaround > > of making the build fail if it detects that it's not the latest one. I'd > > really appreciate any hints on how to achieve this. > > I think one way would be to use the pipeline history API to verify that > the instance you're on right now (based on the GO_PIPELINE_COUNTER > environment variable) is the latest one. And, having the script which > checks this be the first task in the job. > > Another, slightly easier approach might be to fail the script if the > GO_STAGE_COUNTER environment variable is not 1. On a re-run, it will be a > number higher than 1. > > Pipeline history API: https://api.gocd.org/current/#get-pipeline-history > > Environment variables: > https://docs.gocd.org/current/faq/dev_use_current_revision_in_build.html#standard-gocd-environment-variables > > Cheers, > Aravind > > -- > 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/20190912144445.ahf3m73vaumimqbw%40arvindsv.com > . > Thanks Aravind. I figured as much. Looking at the GO_STAGE_COUNTER is not an option because rerunning the latest pipeline instance should stay possible. Does the API require authentication when called from the agent? Best, Ilari -- 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/CANch5bz7APYbgEOuqGHjcMtybPhS75cKSKXRiMVsp4g7wwRj8g%40mail.gmail.com.
