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: "."
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.