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

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 Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

143 views 1 12
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