Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Mount volume in custom pipe Edited

I have a bunch of microservices and they all need to go through the same basic steps of format code, build, test and deploy. 

I'm trying to create a custom pipe for formatting all the code as a starting point.

The thing I'm getting stuck on is how do you get the src code mounted in the Pipe that you are trying to use? Is there a way to mount a volume when creating a Pipe?

Sorry if that's not very clear, I am a little new to all this.

So in my python-formatting-pipe repo I have:

Dockerfile

FROM python:3.6-slim 
WORKDIR /app/
COPY pipe.py requirements.txt ./
RUN pip install -r requirements.txt 
ENTRYPOINT ["python3", "pipe.py"]

pipe.py

src_dir = pipe.get_variable("DIRECTORY")

subprocess.check_call(["autoflake""-r"f"{src_dir}""--in-place""--remove-all-unused-imports""--exclude=__init__.py"])

and in a separate repo I have a bitbucket pipeline that calls

pipe: python-formatting-pipe
variables:
DIRECTORY"."

 

1 answer

1 accepted

0 votes
Answer accepted

Take a look at the variables that you can use, in your case $BITBUCKET_CLONE_DIR will be probably the most interesting.

You can also take a look at other official-pipelines source code how they do it, for instance snyk-scan.

Ah that was exactly what I needed, thank you for that!

Suggest an answer

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

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

1,326 views 0 3
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