Looking for Feedback on My Bitbucket Pipeline YAML Configuration

0
0
Asked By CuriousCoder42 On

Hey everyone! 👋 I'm currently setting up a Bitbucket pipeline for my Node.js project and would love to hear your thoughts on my `bitbucket-pipelines.yml` file. It triggers on pull requests and involves steps like installing dependencies, performing ESLint and formatting checks, validating commit messages, and building the app. Does my configuration look good? Are there any improvements or best practices I might be overlooking? I really appreciate any tips! 🙏

```yaml
image: node:22

options:
size: 2x

pipelines:
pull-requests:
"**":
- step:
name: Install Dependencies
caches:
- node
script:
- echo "Installing dependencies..."
- npm ci
- echo "Dependencies installed successfully!"
artifacts:
- node_modules/**
- parallel:
- step:
name: Code Quality Checks
script:
- echo "Running ESLint..."
- npm run eslint
- echo "Checking code formatting..."
- npm run format:check
- step:
name: Validate Commit Messages
script:
- echo "Validating commit messages in PR..."
- npm run commitlint -- --from origin/$BITBUCKET_PR_DESTINATION_BRANCH --to HEAD --verbose
- step:
name: Build Application
script:
- echo "Building production application..."
- npm run buildProd
```

2 Answers

Answered By CodeCritiqueQueen On

I'm curious why you wouldn't want to build on PRs. In my experience, building on every PR has been standard practice across the various projects I've worked on. It helps catch issues that might not show up in other checks. Your project probably only takes a few seconds to build anyway, so it could be worth it!

Answered By DevOpsDude99 On

I wouldn’t recommend building on every pull request; it’s better to only build on PRs to main/master. Other than that, your YAML looks fine! You might want to consider adding code and secret scanning tools like Trivy, just for extra security.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.