Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

What's the Path to Downloads? (For Maven settings.xml)

walkerca October 4, 2018

Hi,

I've uploaded a settings.xml file to the repository Downloads area.  I'd like to specify that with a -s option in a Pipeline.  There's a post recommending a cp command to bring the file in the workspace. 

Is there an environment variable or path that I can use to find the file?  I get a "no such file" when I try the suggested path (starting w. /opt/atlassian).

https://community.atlassian.com/t5/Bitbucket-questions/settings-xml-configuration-on-Pipelines/qaq-p/167693

Thanks,

Carl

1 answer

1 accepted

0 votes
Answer accepted
Philip Hodder
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 4, 2018

Hi Carl,

When you say you've uploaded a file to the repository Downloads are. Do you mean the downloads section (listed in the sidebar)?

Screen Shot 2018-10-05 at 2.46.32 pm.png

If so, these aren't copied into your pipelines. Only the repository itself. You need to manually download these. You can have a look a the REST API docs for how to do this: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/downloads/%7Bfilename%7D

If you don't mean that, can you clarify what you mean by "repository Downloads area"?

Can you also include your bitbucket-pipelines.yml for additional context?

An additional debugging trick you could try is:

ls -Rhl ~ | grep settings.xml # This will check to see if the file exists.

Just for some extra information: There's a default environment variable called BITBUCKET_CLONE_DIR which points at /opt/atlassian/pipelines/agent/build. However that's the directory you seem to be using already, so don't need to do anything.

Thanks,

Phil

walkerca October 12, 2018

Hi Phil,

Associated with a BitBucket Repository, there is a Downloads tab (your screenshot) which takes you to a Downloads page.  I've uploaded a settings.xml to this page that I would like to use in my build.  I would also like to upload a code signing cert.

I don't want to store the settings.xml or the cert in the repository itself as they contain credentials.

In Jenkins, I'm using "Settings file in filesystem" in the build definition and WebDAV to maintain the artifact.  It sounds like I'll need to issue a curl call prior to issuing any Maven commands in my YAML.

Thanks,

Carl

walkerca October 12, 2018

The REST API suggested by Phil is working for me.  I have my settings.xml file uploaded to Downloads in the Repository (but not checked into the source code).  I'm using masked environment variables to hold the account information needed for the curl: BB_USER, BB_PASS.

My mvn uses the file downloaded in a curl step like this

          - curl --user $BB_USER:$BB_PASS -o settings-demo.xml -L https://api.bitbucket.org/2.0/repositories/MYORG/demo-repo/downloads/settings-demo.xml
          - mvn -B -s settings-demo.xml verify # -B batch mode makes Maven less verbose

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events