Pipeliene clear cache does not work with access_token

Simona Grigoras
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 10, 2025

Hello!

I have configured a step in our bitbucket pipeline for clearing the cache for node in case there are any changes in package.json.

The issue is that the script is throwing an error regarding app username & pass,  although I've set the Access token in the env variables in bitbucket and used the access token in the pipeline step.

Pipeline step:

 

 

- step: 

          name: 'Clear cache if dependency changed'

          script:

            - pipe: atlassian/bitbucket-clear-cache:3.1.1

              variables:

                BITBUCKET_ACCESS_TOKEN: $BITBUCKET_ACCESS_TOKEN

                CACHES: ["bff-node"]

                DEBUG: "true"

          condition:

            changesets:

                includePaths:

                  # only if bff package.json file has changed

                  - "apps/api/package.json"

 

Error:

✖ Validation errors:

BITBUCKET_APP_PASSWORD: - required field

BITBUCKET_USERNAME: - required field

1 answer

1 vote
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 11, 2025

Hey @Simona Grigoras ,

and welcome to the Community!

The support for access tokens in the atlassian/bitbucket-clear-cache was released in a more recent version of the pipe.

We can verify which exact version by checking that pipe's CHANGELOG file where it can be confirmed that token-based authentication was introduced in version 3.3.0 : 

3.3.0

  • minor: Add support for token based authentication.
  • patch: Internal maintenance: update docker image and packages.

Since you're currently using version 3.1.1, the pipe does not recognize the access token variable and throws an error.

In this case, for the usage of access token to work, you'll need to update your YAML to use a more recent version of the pipe >= 3.3.0.

I'd strongly recommend using the latest version as it includes bugfixes and enhancements. By the time I write this message, the latest version is 3.6.2:

script:
  - pipe: atlassian/bitbucket-clear-cache:3.6.2
    variables:
      BITBUCKET_ACCESS_TOKEN: $BITBUCKET_ACCESS_TOKEN
<rest of variables>

I hope that information helps! Let us know in case you have any questions.

Thank you, @Simona Grigoras !

Patrik S

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events