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

This widget could not be displayed.

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

This widget could not be displayed.

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

This widget could not be displayed.

does anyone have a suggestion for me?

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

97 views 1 2
Join discussion

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