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

Composer install application dependencies

Edited

I used to work with Jenkins but I'm trying bitbucket pipelines now. The only thing I can not figure out is if I have the possibility to run composer install.

 

My goal

I have an Codeigniter application with various composer dependencies. In my repository I don't have the dependencies, only the composer.json file telling composer to install these dependencies. I want to make a pipeline to install the composer dependencies and than push it all over FTP to my server. How can I do that?

 

What I do now:

  • I use the docker image phpunit/phpunit
  • The first step is composer install
  • For the second step I use atlassian/ftp-deploy:0.3.6 to push it all to my server.

 

Everything ends up on my server but not my vendor map with the dependencies. What is going wrong?

 

I'm sorry if it's a dumb question, I'm new to both pipelines as to docker.

 

1 answer

0 votes

Hi @Jelle Tempelman and welcome to the community!

Just to give some context first: for every step that you define in your bitbucket-pipelines.yml file, a Docker container starts with the image you have specified, the branch of the repo that triggered the pipeline gets cloned in that Docker container (if you are running pipelines on branches), and then the script of that step runs. When this is finished, the Docker container gets destroyed.

If directories/files are generated or modified in one step and you would like to use them in one of the subsequent steps, you'll need to define them as artifacts in your bitbucket-pipelines.yml file:

Otherwise, they won't be available for the next step, since the Docker container of the first step gets destroyed, and then a new one starts with a fresh clone.

I believe that composer install writes in an existing directory, or generates a new directory, depending on the configuration.

What you can do is

1. either use the atlassian/ftp-deploy:0.3.6 pipe in the same step where you run composer install

2. or define in the first step of your bitbucket-pipelines.yml file any directories/files that are generated or altered by composer install as artifacts, so that they will be available during the second step when you do the deploy.

E.g. if the dependencies are installed in the vendor directory, you can define it as an artifact as follows:

- step:
script:
- composer install
artifacts:
- vendor/**

If there are other directories or files that are generated or modified during this step and you'd like to deploy them as well, you can add them in the artifacts section.

I hope this helps, please feel free to let me know if you have any questions!

Kind regards,
Theodora

Suggest an answer

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

📣 Calling Bitbucket Data Center customers to participate in research

Hi everyone, Are you Bitbucket DC customer? If so, we'd love to talk to you! Our team wants to dive deep to understand your long-term plans regarding Bitbucket DC and Atlassian Cloud. Do you plan...

172 views 2 4
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