2

I'm doing quite trivial java build in BitBucket Pipeline. the only twist is that it is in the repository subdirectory.

my bitbucket-pipelines.yml:

pipelines:
  default:
    - step:
        caches:
          - gradle
        script: # Modify the commands below to build your repository.
                # You must commit the Gradle wrapper to your repository
                # https://docs.gradle.org/current/userguide/gradle_wrapper.html
          - bash "./foo bar/gradlew" -p "./foo bar" distTar
          - ls ./foo\ bar/build -R
          - echo 'THE END'
        artifacts:
          - ./foo bar/build/distributions/xxx.tar

My ls confirms that xxx.tar is in the expected location

....

./foo bar/build/distributions:brigitte.tar

.... , but artifact page is empty. empty artifacts

N1ngu
  • 2,862
  • 17
  • 35
MichalMa
  • 1,230
  • 6
  • 14

2 Answers2

3

Extending the existing answer, I'd like to highlight the docs fragment that speaks about this

https://support.atlassian.com/bitbucket-cloud/docs/use-artifacts-in-steps/#Introduction

You can use glob patterns to define artifacts. Glob patterns that start with a * will need to be put in quotes. Note: As these are glob patterns, path segments “.” and “..” won’t work. Use paths relative to the build directory.

So that's it: artifacts can't be outside the build directory and artifact definitions in the pipelines must not contain . and .. path segments.

Absolute paths starting with / will neither work!

It is truly shameful how obscure this is like, why wouldn't the pipelines throw an error if that declaration is invalid? Damn, Bitbucket!

N1ngu
  • 2,862
  • 17
  • 35
2

Found it! It should be

# ...
        artifacts:
          - foo bar/build/distributions/brigitte.tar

artifacts paths are not real path so "dot slash" at the beginning was invalidating my path. Shame that it was not raised as a warning!

N1ngu
  • 2,862
  • 17
  • 35
MichalMa
  • 1,230
  • 6
  • 14