Level of fuckity fuck mood.

After changing dozens of build plans in Bamboo, the build system of poo...

How to verify that nothing has gone wrong?

Poking the database, you'll be surprised that Bamboo stores the buildplan definition as XML.

Another surprise: Some of the keys / values have typos.

Yeah. You read that right. There are typos inside the XML...

Now together with Postgres, we can use XPATH and have some fun.

UNNEST(COALESCE(XPATH('/configuration/buildTasks/taskDefinition[userDescription[contains(text(),"Bleep")]]', build_definition.xml_definition_data::xml)::varchar[], ARRAY['']))

Lovely wrapping via coalesce for some null safety.

Now we get da task definitions for fields having user description text containing bleep.

Wrapping it in two REGEXP_REPLACE to strip out stupid identifiers....

REGEXP_REPLACE(REGEXP_REPLACE(...., '<id>\d+</id>', ''), '<oid>\d+</oid>', ''))

Then wrap that in MD5.

Boom. Lots of MD5 sums to help you identify if the configs are identical for a task or not.

Now wrapping that in another select to group by the MD5 and filter out the non identical ones.

I hate it how sometimes one has to seemingly do a full 2 hour dance for something as stupid as validation.

I'm pretty glad though for XML and XPATH.

Cause otherwise that would have been a whole can of worms I don't wanna think about....

  • 0
    Oh dear lord... You sure are courageous to descend that rabbit hole. Any particular reason you <<have to>> use bamboo?

    Just for atlassian integration?
  • 0
    @NeatNerdPrime it was there since the beginning of time TM.

    I hope to migrate it, but currently I'm drowning in too much bullshit.

    Yes, Bampoo is the worst.
Add Comment