Modify Bamboo inline scripts directly in the database

I know this is not supported, but since Bamboo lack of templates, I'm sure someone else has already tried this.

In my case I have a large number of plans that have been created by cloning a master "template". Now I need to do a minor adjustment in some of the inline scripts of these plans. I know inline scripts are not a "good practice", but the inline scripts are basically something like this:

python27 myPythonScript.py -a A -b B

and now I need to add more parameter to this call.

The below SQL query returns the XML definition for the job (Bamboo 5.6.0):

SELECT xml_definition_data
FROM build_definition
INNER JOIN build
ON build_definition.build_id = build.build_id
WHERE build.full_key='FULL-JOB-KEY';

So my idea is to update the corresponding bit in the XML:

<buildTasks>
    <taskDefinition>
		...
    </taskDefinition>
	...
    <taskDefinition>
		...
        <item>
          <key>scriptBody</key>
          <value>python MyPythonScript.py -a A -b B</value>
		  ...
        </item>
        ...
    </taskDefinition>
  </buildTasks>

I think you get the idea.

 

My question is, am I going to break something else by doing this change directly in the DB? I have already tried it and it seems to work, but not entirely sure if I'm breaking something I'm not aware of when doing this.

BTW, I seem to have to restart Bamboo after modifying the DB so the new values are picked up. Is that possible?

 

If anyone has tried it, feedback will be welcome wink

1 answer

1 accepted

0 vote

You'll not going to break anything if you're careful.

The only problem is caching, you'll need to restart Bamboo or trigger cache invalidation using com.atlassian.bamboo.plan.cache.ImmutablePlanCacheService.

Is there any way to trigger the cache invalidation from REST? If not, how would you suggest to do it?

No, can't be done via REST, you'd need to write a plugin to do it. It's probably easier to just restart the server.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,561 views 0 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you