I'm unable to execute some commands however I have installed their packages but in different steps, the same commands are working fine if I'm installing their packages in the same step
the yml script below is throwing an error in the second step, as
bash: curl: command not found
if i moved curl installation to 2nd step it will work fine
name: Install Environment Dependencies
- apt update && DEBIAN_FRONTEND=noninteractive apt install -y curl sudo wget
name: Install Nodejs
curl -sL https://deb.nodesource.com/setup_14.x | bash && \
apt-get -qqy install nodejs && \
exit 0 && \
npm cache clean && \
apt-get remove --purge -y npm && \
apt-get autoremove --purge -y
Hi @Amr Salem and welcome to the community.
For each Pipelines step in your yaml file, a Docker container starts with the image you specify (if you don't, the default image https://hub.docker.com/r/atlassian/default-image/ will be used), then the commands in the script of this step are executed, and then this Docker container gets destroyed.
The reason why curl is not found if you install it in a separate step is because curl will be installed in the Docker container of that specific step. Then the container for this step will get destroyed, and a new one will start for the next step.
If you need a specific tool in a step that is not already pre-installed in the Docker image you use, you will need to install it in the step that uses it.
I hope this helps to clarify things. Please feel free to let me know if you have any questions!
Hi @Amr Salem,
Thank you for your reply.
I'm afraid that we don't have a way to label or name specific commands.
Bitbucket Pipelines uses YAML. With YAML anchors, you can label/name a step and reuse it, you can see an example here:
However, it is not possible to have multiple anchors in one step, i.e. one anchor for each command, and then reference multiple anchors in the same step.
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...
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