I think I am narrowing in on the issue a bit, the size of the config.xml 
file might be a factor here when submitted to the config.xml endpoint.

I spun up a local version of GoCD 20.2 using Docker, I copied over the 
config.xml from my production GoCD (cleaning up where needed) and applied 
my Gomatic config, I got the same errors locally as in production. I then 
deleted a large amount of config that is not controlled by Gomatic and then 
re-ran my Gomatic config, this time everything worked without error. I then 
started adding some dummy pipeline groups to config.xml via the GoCD UI, 
after I had added a few hundred extras lines Gomatic started to fail again.

As I said earlier all of this worked just fine in version 19.9, so have 
there been any changes to how the data is parsed for the config.yml 
endpoint? Limitations on the field sizes or anything along those lines?

Here is the relevant code in Gomatic that handles saving the config to GoCD:


   - 
   
https://github.com/gocd-contrib/gomatic/blob/master/gomatic/go_cd_configurator.py#L296
   - 
   
https://github.com/gocd-contrib/gomatic/blob/master/gomatic/go_cd_configurator.py#L358



On Friday, 7 August 2020 11:52:50 UTC+1, Bob Shazbot wrote:
>
> The strange thing is that I am sending several config changes to GoCD via 
> Gomatic, most of them work but a few fail and I cannot figure out why, this 
> was all working fine with version 19.9.
>
> For example, I have a bit of code that ensures a few templates exist in 
> GoCD, each template is ensured in GoCD individually (so the config is sent 
> for each template), about 5 of these templates are POST'd to GoCD without 
> issue but 2 of them fail with a 400 BadMessage error in the logs. I can 
> take the XML generated by Gomatic and pop it straight into the UI without 
> issue, but when sent via POST to the config.xml endpoint I get the 400 bad 
> request error.
>
> I have used tcpdump to get the entire request sent to the server and it 
> looks fine, nothing is truncated or anything like, yet GoCD throws the 
> error; I have even extracted the XML from the request that I captured via 
> tcpdump and popped that into the UI and it saved without issue.
>
> Is there anyway to see more detail on the error thrown by the server?
>
>
>
> On Friday, 7 August 2020 11:37:10 UTC+1, Aravind SV wrote:
>>
>> Hello Bob, ,
>>
>> Actually I don’t think this is the issue, Gomatic dumps the XML that it is
>> going to post, I can take this XML and enter it directly into GoCD via the
>> UI without error, it just doesn’t work when POST’d to the config.yml
>> endpoint.
>>
>> Yes, I found something similar in 
>> https://github.com/gocd/gocd/issues/7991. But, I found that I could post 
>> it via curl as well, and it was ok.
>>
>> It doesn’t look like a GoCD issue but something wrong with *how* it is 
>> POSTed? Can you make sure that you used the POST just as I did in that 
>> issue, using the md5 param, etc.
>>
>> 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/d354c673-449d-4e15-bf0a-e9b6363cb2c0o%40googlegroups.com.

Reply via email to