Hi.
I just have followed this tutorial: https://confluence.atlassian.com/bitbucket/deploy-build-artifacts-to-bitbucket-downloads-872124574.html.
but i'm getting this error:
+ curl -X POST --user "${BITBUCKET_REPO_OWNER}:${BB_AUTH_STRING}" "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@"target/output.jar"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (26) couldn't open file "target/output.jar"
Here is my .yml:
image: maven:3.3.3 pipelines: default: - step: script: - mvn -B clean install - curl -X POST --user "${BITBUCKET_REPO_OWNER}:${BB_AUTH_STRING}" "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@"target/output.jar"
I have created an app password in my account level, with all permissions set. My Enriromental variable is configured with the generated key (like this: zBre6W************)
We've just released an experimental wagon for maven which deploys directly do bitbucket downloads - https://bitbucket.org/codedoers/maven-bitbucket-download-wagon
it does the same as curl but treats the bitbucket downloads as a maven repository
I figured out the solution. I'll post here if anyone has the same question:
Anything under "script:" it's just unix commands, this means that you can use unix commands to navigate and list the files generated by your build.
My pom.xml generated the jar file with the name "my-project-1.0-SNAPSHOT", but my .yml was looking for a file named "output.jar".
I simply searched in the generated folders to see where my file was, using this command:
ls -R # Will list all files in the directory and subfolders
After finding the right place, i just point the "files" property to the right file in my .yml:
image: maven:3.3.3 pipelines: default: - step: script: - mvn -B clean install
- ls -R # Use this to find your generated jar. Remove it after. - curl -i -X POST --user "${BITBUCKET_REPO_OWNER}:${BB_AUTH_STRING}" "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads/" --form files=@"target/my-project-1.0-SNAPSHOT.jar"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you don't want to hardcode version of your jar in the curl command, I'd suggest to write something like:
--form files=@"target/$(cd ./target/ && ls -1 my-project*.jar)"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.