Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Bitbucket pipeline/artifactory: environmental variables in file not recognized


I have a bitbucket pipeline script and a bash script that are playing nicely. The pipeline will call the version script and there are environment variables inside that are referenced correctly by bitbucket (I added the variables in settings for the repo).

However, I also have variables now in my file, but these keep giving me errors in the pipeline when I try a gradle build.

The error I keep getting is could not get unknown property '$context_url' for root project 'my_project' of type org.gradle.api.Project.

The variables are in the artifactory/publish section:

artifactory {    
= $context_url publish {
= 'repo'
= $artifactory_user password = $artifactory_password }
= true
= true } } }

I've tried different syntax in the file, such as:

  • $context_url
  • '$context_url'
  • "$context_url"

The variables work locally, I have the variables stored in my personal ~/gradle/ file.

Not sure what else to try.

2 answers

In bitbucket, I defined a workspace variable


which gradle interprets as the 'artifactory_user' property.

0 votes

Hi @Matt Takao,

Take a look at this tutorial: (specifically the last section: "In case you want to be able to provide the token in both ways ...). 

This should give you a way to use the variables from your local file when you are developing on your local machine - or from environment variables when running in the Bitbucket Pipelines environment. 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,265 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you