Hello community,
I'm trying to configure bitbucket-pipelines.yml to deploy to another remote. The file is Valid according to the https://bitbucket-pipelines.prod.public.atl-paas.net/validator.
However, I'm getting "Configuration error".
Here's the yml:
# Ideally use an image with php, php extensions & composer.
# i.e. image: imagexmedia/ci:latest
# See: https://confluence.atlassian.com/bitbucket/php-with-bitbucket-pipelines-873907835.html
image: lbausch/laravel-ci:php81
# Defines single re-usable scripts.
script_definitions:
scripts:
env-setup: &env-setup
- export BIN_DIR=$BITBUCKET_CLONE_DIR/vendor/bin
composer-tasks: &composer-tasks
- composer self-update --2
- composer install --no-interaction --optimize-autoloader
compile-assets-dev: &compile-assets-dev
- npm install
- npm run dev
compile-assets-prod: &compile-assets-prod
- npm install
- npm run prod
remote-push: &remote-push
- git config --global user.name bitbucket-pipelines
- git config --global user.email commits-noreply@bitbucket.org
- git remote add platformsh q4wbvsyds6mfm@git.ca-1.platform.sh:q4wbvsyds6mfm.git
- git checkout $BITBUCKET_BRANCH
- git add --all
- git commit -m"Bitbucket build - $BITBUCKET_BUILD_NUMBER, Commit $BITBUCKET_COMMIT"
- git push platformsh $BITBUCKET_BRANCH
# Defines re-usable steps.
step_definitions:
- validate: &validate
name: 'Validation Tasks.'
caches:
- composer
script:
- *env-setup
- *composer-tasks
- ${BIN_DIR}/phpcs --standard=./phpcs.xml -p
- deploy-branch: &deploy-branch
name: 'Deploy branch to remote.'
caches:
- composer
script:
- *env-setup
- *composer-tasks
- *compile-assets-dev
- *remote-push
- deploy-prod: &deploy-prod
name: 'Deploy branch to remote (PROD).'
caches:
- composer
script:
- *env-setup
- *composer-tasks
- *compile-assets-prod
- *remote-push
# Bitbucket pipeline definitions.
pipelines:
default:
- step: *validate
pull-requests:
'**':
- step: *validate
branches:
main:
- step: *validate
- step: *deploy-prod
stage:
- step: *validate
- step: *deploy-branch
develop:
- step: *validate
- step: *deploy-branch
Can you please help me to create some reusable "steps" under the "script"?
Thanks,
Carol
It works fine for me. I think the problem is how you're defining the anchors.
Instead of this:
script_definitions:
scripts:
env-setup: &env-setup
- export BIN_DIR=$BITBUCKET_CLONE_DIR/vendor/bin
Try this:
script_definitions:
scripts:
- &env-setup export BIN_DIR=$BITBUCKET_CLONE_DIR/vendor/bin
Hi, @Carol, welcome to the community!
Currently, script definitions are not supported. We do have a feature request to add the ability to use script entity for YAML anchors as you can see here:
I would suggest that you add your vote there (by selecting the Vote for this issue link) as the number of votes helps the development team and product managers better understand the demand for new features.
You are more than welcome to leave any feedback, and you can also add yourself as a watcher (by selecting the Start watching this issue link) if you'd like to get notified via email on updates.
Implementation of new features is done as per our policy here and any updates will be posted in the feature request.
With that said, I believe the following link might help you to change your YAML file:
I hope this helps!
Kind regards,
Caroline
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is the error on the Pipelines UI
There is an error in your bitbucket-pipelines.yml at [pipelines > branches > main > 0 > step > script > 0]. To be precise: This section should be a string or a map (it is currently defined as a list).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.