How do I upload a zip file from bamboo ondemand to confluence ondeman

I attempted to do this with a python script that I run as the final step of plan but the script just hangs. Does anyone have an ideas on what I have done wrong in my script? I do see the artifcate and able to download it manually.

This is what my code looks like

#!/usr/bin/python

from __future__ import with_statement
import sys, string, xmlrpclib, re, os, logging

logging.warning('running upload-attachment') 

    #Space key of the page where you want to attach the file. For example, "KEY".
spacekey = 'SIM';

    #Page title of the page where you want to attach the file. The page must already exist. You may need to escape or quote special characters in the file name. For example, "Page title".
pagetitle = "Simpoint Downloads";

    #Content type of the attachment. See below for more information about content types. For example, "text/plain".
contentType = 'application/zip';

    #File name of the file to attach. This will also be used as the name of the attachment within Confluence. For example, "somefile.txt".
filename = 'simpoint/package/target/SimPoint_trunk.zip';

logging.warning('opening file') 
with open(filename, 'rb') as f:
    data = f.read(); # slurp all the data

logging.warning('after openning file') 
server = xmlrpclib.ServerProxy('https://myurl.atlassian.net/wiki');
logging.warning('after server connect') 

token = server.confluence1.login('MyUser', 'MyPassword');
logging.warning('after login') 

page = server.confluence1.getPage(token, spacekey, pagetitle);

logging.warning('getPage') 
if page is None:
    exit("Could not find page " + spacekey + ":" + pagetitle);

attachment = {};
attachment['fileName'] = os.path.basename(filename);
attachment['contentType'] = contentType;

logging.warning('before addAttachment') 
server.confluence1.addAttachment(token, page['id'], attachment, xmlrpclib.Binary(data));
logging.warning('after addAttachment')

3 answers

Bamboo for automatic uploads to Confluence is another way to solve this problem :), but only if you are host your own Bamboo :(.

thanks, but I am using ondemand confluence and ondemand bamboo. Any suggestions on how I can solve this problem with that setup?

does anyone have a suggestion for me?

Suggest an answer

Log in or Sign up to answer
Community showcase
Asked Dec 06, 2018 in Jira Ops

I'm John Allspaw, Ask Me Anything about incident analysis and postmortems

I'm John Allspaw, co-founder of   Adaptive Capacity Labs, where we help teams use their incidents to learn and improve. We bring research-driven methods and approaches to drive effective inciden...

5,515 views 21 17
View question

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