Uploaded image for project: 'Bitbucket Cloud'
  1. Bitbucket Cloud
  2. BCLOUD-16728

Ability to prevent a step from downloading artifacts

    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

      Might help save a few CPU cycles and build time.

      Basically we have a few builds where only 2 of the 5 steps require the artifacts, would be nice if you could add a flag to disable these.

      Source: https://twitter.com/jeroendra/status/1019829831377170432

            [BCLOUD-16728] Ability to prevent a step from downloading artifacts

            Sometimes I feel like Bitbucket lacks of a project owner. This is a great feature, but with a little more thought it could be perfect:

            artifacts:
              download:
                - "artifact-only-relevant-for-this-step.txt"

             
             

            Renato Montagna added a comment - Sometimes I feel like Bitbucket lacks of a project owner. This is a great feature, but with a little more thought it could be perfect: artifacts: download: - "artifact-only-relevant- for - this -step.txt"    

            Please correct me if I'm wrong, but this new implementation only allows for either all artifacts to download, or no artifacts to download, correct?

            E.g. for the `Integration Step` step of the example on https://support.atlassian.com/bitbucket-cloud/docs/use-artifacts-in-steps/, it downloads both `dist/*` and `reports/.txt` artifacts, even though it only needs the one.

             

            Ralph Lawrence added a comment - Please correct me if I'm wrong, but this new implementation only allows for either all artifacts to download, or no artifacts to download, correct? E.g. for the `Integration Step` step of the example on https://support.atlassian.com/bitbucket-cloud/docs/use-artifacts-in-steps/,  it downloads both `dist/* ` and `reports/ .txt` artifacts, even though it only needs the one.  

            Nico added a comment -

            Great news !

            Can confirm it's working as expected, it shaved a couple seconds off our deployment process and it's probably saving you guys some bandwidth.

            Nico added a comment - Great news ! Can confirm it's working as expected, it shaved a couple seconds off our deployment process and it's probably saving you guys some bandwidth.

            tina added a comment -

            Hi all,

            Thanks for your interests and discussions on this issue!

            This feature is now shipped! You can find the updated docs for it on Use Artifacts In Steps, and keep an eye out for a post about this feature on Bitbucket's blog page coming next Monday.

            Happy Coding!
            Tina.

            tina added a comment - Hi all, Thanks for your interests and discussions on this issue! This feature is now shipped! You can find the updated docs for it on Use Artifacts In Steps , and keep an eye out for a post about this feature on Bitbucket's blog page coming next Monday. Happy Coding! Tina.

            +1, hackyyy workaround

            Alexander Prams added a comment - +1, hackyyy workaround

            +1, hackyyy workaround

            Alexander Prams added a comment - +1, hackyyy workaround

            Milord added a comment - - edited

            There's a hacky workaroud for this. Instead of artifacts you use a custom cache. You have to clear it before each use to keep it fresh and then use it in subsequent pipeline steps, where needed.

            You have to create a custom cache and a step to clear it:

            definitions: 
              caches:     
                # Whichever folder you usually define as artifact
                artifact-cache: node_modules
            
            step: &clear_artifact_cache
              name: clear_artifact_cache
              script:      
                - pipe: atlassian/bitbucket-clear-cache:3.1.1
                  variables:         
                    BITBUCKET_USERNAME: $CLEAR_CACHE_USERNAME    
                    BITBUCKET_APP_PASSWORD: $CLEAR_CACHE_PASSWORD    
                    CACHES: ["artifact-cache"]
            

            You need to define username and password env variables in your repository settings.

            Then you have to:

            1. Turn on the cache for a pipeline step that generates your artifacts
            2. Call clear_artifact_cache  step before the step that generates artifacts
            3. Turn on artifact-cache for all the following steps that need to use your generated artifacts

            Example:

            definitions: 
            
              step: &yarn_install
                name: yarn_install
                image: mycustom:nodejs14
                caches: 
                  - artifact-cache
                script: 
                  # Code that generates artifacts
                  - yarn
            
            pipelines: 
              custom: 
                my-custom-pipeline: 
                  - step: *clear_artifact_cache
                  - step: *yarn_install
                  # only those of the following steps that use artifact-cache will download artifacts
                  - step: *build_from_artifacts

            Milord added a comment - - edited There's a hacky workaroud for this. Instead of artifacts you use a custom cache. You have to clear it before each use to keep it fresh and then use it in subsequent pipeline steps, where needed. You have to create a custom cache and a step to clear it: definitions:    caches: # Whichever folder you usually define as artifact artifact- cache: node_modules step: &clear_artifact_cache   name: clear_artifact_cache script:       - pipe: atlassian/bitbucket-clear-cache: 3 . 1 . 1       variables:         BITBUCKET_USERNAME: $CLEAR_CACHE_USERNAME          BITBUCKET_APP_PASSWORD: $CLEAR_CACHE_PASSWORD            CACHES: [ "artifact-cache" ] You need to define username and password env variables in your repository settings. Then you have to: Turn on the cache for a pipeline step that generates your artifacts Call  clear_artifact_cache   step before the step that generates artifacts Turn on artifact-cache for all the following steps that need to use your generated artifacts Example: definitions: step: &yarn_install name: yarn_install image: mycustom:nodejs 14 caches: - artifact-cache script: # Code that generates artifacts - yarn pipelines:    custom: my-custom- pipeline: - step: *clear_artifact_cache - step: *yarn_install # only those of the following steps that use artifact-cache will download artifacts - step: *build_from_artifacts

            Olivier added a comment -

            +1

            Olivier added a comment - +1

            +1 we have following build steps for Chat-Ops notifications, tagging of Docker-Images, etc. which absolutely don't need the previews build artefacts. So it would be great to skip them and speed up those steps. 

            Stefan Lemmer added a comment - +1 we have following build steps for Chat-Ops notifications, tagging of Docker-Images, etc. which absolutely don't need the previews build artefacts. So it would be great to skip them and speed up those steps. 

            jmgarciadelmoral added a comment - - edited

            +1 

            As side note, It would be nice if it replicates circleCI strategy which is the ability to decide where and when to mount a desired artifact, providing source and destination. In this approach, just skipping the whole artifacts yml block in a step, would be enough to skip its download.

             

            jmgarciadelmoral added a comment - - edited +1  As side note, It would be nice if it replicates circleCI strategy which is the ability to decide where and when to mount a desired artifact, providing source and destination. In this approach, just skipping the whole artifacts yml block in a step, would be enough to skip its download.  

              Unassigned Unassigned
              2a6be8860cf9 Nick Phillips
              Votes:
              99 Vote for this issue
              Watchers:
              78 Start watching this issue

                Created:
                Updated:
                Resolved: