Artifact not being published in bitbucket pipeline
Asked Answered
M

2

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

Monarch answered 18/5, 2019 at 6:12 Comment(0)
A
4

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!

Acanthaceous answered 7/11, 2022 at 14:42 Comment(0)
M
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!

Monarch answered 20/5, 2019 at 9:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.