Pipeline Artifact not Updated (Overwritten)

Issue #18422 resolved
Alexander Kirilov
created an issue

Hello

I am having a pipeline which has to build my application several times for each environment and it seems that bitbucket is not updating the artifacts in consequent builds.

The result is that I end up trying to publish my testing artifact to staging environment.

Here is my pipeline outline:

--> (build front + build back) --> deploy testing --> (build front + build back) --> deploy staging

The second deploy fails since the artifact it receives is the one from testing.

Is there a way to tell bitbucket to discard previous artifacts ? Is there a way to overwrite the previous artifacts ?

Thank you for your help

"{release/*,hotfix/*}":

      - parallel:
          - step:
              name: "[Back] Lint -> Build -> Test"
              script:
                - export STAGE=integration
                - build.sh
              artifacts:
                - "**/dist/**"
              caches:
                - lerna
          - step:
              name: "[Front] Lint -> Build -> Test"
              script:
                - export STAGE=integration
                - build-front.sh
              artifacts:
                - "**/dist/**"
              caches:
                - lerna

      - step:
          name: "[ALL] Deploy -> integration"
          trigger: manual
          deployment: test
          script:
            - export STAGE=integration
            - deploy.sh
          caches:
            - lerna

      - parallel:
          - step:
              name: "[Back] Build"
              script:
                - export STAGE=preproduction
                - build.sh
              artifacts:
                - "**/dist/**"
              caches:
                - lerna
          - step:
              name: "[Front] Build"
              script:
                - export STAGE=preproduction
                - build-front.sh
              artifacts:
                - "**/dist/**"
              caches:
                - lerna

      - step:
          name: "[ALL] Deploy -> preproduction"
          trigger: manual
          deployment: staging
          script:
            - export STAGE=preproduction
            - deploy.sh

Comments (4)

  1. Alexander Kirilov reporter

    It turns out the problem was due to having the same artifact definition for two parallel builds. Both "build front" and "build back" had the following line:

    artifacts:
                    - "**/dist/**"
    

    Which means that front will pack the dist folders of back and vice versa and since they run in parallel the first one to finish will take the "dist" folder of the previous build.

    The solution was to add

                  artifacts:
                    - "src/back/**/dist/**"
    

    and respectively for the front:

                  artifacts:
                    - "src/frontend/**/dist/**"
    
  2. Log in to comment