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

Mount volume in custom pipe

Lockie Richter June 2, 2020

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
Radek Antoniuk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 3, 2020

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.

Lockie Richter June 3, 2020

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events