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,363,588
Community Members
 
Community Events
168
Community Groups

ELI5 bitbucket pipelines. Error when running eslint on the project

Edited

Hi there, I'm trying to better  understand  how do pipelines actually work.

I'm guessing a docker image is created for each step on the pipeline, or is it just a single docker image?

 

I'm trying to hook a pipeline with an ubuntu server so it can deploy my react-app on every merge to `master`. The pipeline sort of works, but when there are some steps tha fail.

1. `eslint`

2. `test`

 

Here is my config:

 

 

pipeline-bitbucket.png  

 

1 answer

1 vote

Hi @DS ,

For each step of a pipeline, new Docker container starts, the repo is cloned in this container and then the commands of the script are executed.

If you define an image at the beginning of your bitbucket-pipelines.yml file, like in your screenshot, this image will be used for every step.

However, it is also possible to specify a different image for each step, an example from our docs for that is as follows:

pipelines:
default:
- step:
name: Build and test
image: node:10.15.0
script:
- npm install
- npm test
- npm run build
artifacts:
- dist/**
- step:
name: Deploy
image: python:3.7.2
trigger: manual
script:
- python deploy.py

It's a bit difficult to say why the errors occur without seeing any log info. Could you perhaps let us know:

  1. Which steps are failing from your bitbucket-pipelines.yml file, and specifically which command fails for each step?
  2. Could you share the output of these commands here, sanitizing any private/sensitive data in the output?

Kind regards,
Theodora

Hi @Theodora Boudale I think the problem might be on how i'm structuring my repo ?  I need to test this, but let me know what you think.

Right now the command that fails is 

 

 - step:
name: Running the linter
script:
- yarn run lint # [Error]: Unable to follow eslint


Right now my folder structure is 

 

repo
|
website # where al the code for the app is found including package.json
|
bitbucket.pipeline.yml

 

I think I should tell the pipeline to first go to `website`  and the run all the commands? 

Hi @DS ,

When you run a Pipelines build, a Docket container starts, then the branch is cloned in that Docker container (if it's a build running on a branch) and the commands of the script are executed in the directory of that clone.

If this command needs to run in the directory where you have your source, this might indeed be the culprit.

What you can do is add an extra command to switch to this directory first:

- step:
name: Running the linter
script:
- cd website
- yarn run lint

Could you give this a try and let me know how it goes?

Kind regards,
Theodora

Like DS likes this

@Theodora Boudale never managed to answer you, but   everything running smoothly now. Thanks

Hi @DS,

Thank you for the update, that's good to hear and you are very welcome!

Please feel free to reach out if you ever need anything else.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events