Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,368,560
Community Members
 
Community Events
168
Community Groups

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

Atlassian Community Events