Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,463,735
Community Members
 
Community Events
176
Community Groups

Bitbucket Pipeline Now Using Packaged Version

I have a custom Docker image built with PHP 8.1 and a specific version of node (14).  The pipeline executes however error's out that it is using php 8.0 instead of 8.1.  I'm not sure where this older version of PHP is coming from.

 

image: itguy614/gohcl-php-docker-pipeline:php-8.1

pipelines:
  branches:
    develop:
      - step:
          name: Composer Build
          script:
            - cp -v .env.example .env
            - composer config --global --auth http-basic.repo.gohcl.com $PACKAGIST_USER $PACKAGIST_TOKEN
            - composer config repositories.private-packagist composer https://repo.gohcl.com/gohcltech/
            - composer config repositories.packagist.org false
            - composer install --no-interaction --no-progress --prefer-dist
            - php artisan key:generate
          artifacts:
            - vendor/**
            - .env
Build error message:
Problem 1
- Root composer.json requires php ^8.1 but your php version (8.0.16) does not satisfy that requirement.

2 answers

1 accepted

0 votes
Answer accepted

Hi @kurtwolf,

Since the Docker image is public, I ran a Pipelines build using this image as a build container and included the command php --version at the beginning of the build's script. The output shows PHP 8.1.3, same as locally.

Have you perhaps configured a different version of php in the composer.json file or any other configuration file of your repo?

I would suggest debugging the build locally first, so you don't consume Pipelines minutes for that. You can do so the following way:

1. Take a new clone of the develop branch of the repo on your machine

2. Navigate to the directory of that new clone, and do a git reset --hard to the commit of the failed build with the issue (if it's not the latest commit)

3. Afterwards, start a Docker container with the following command

docker run -it --volume=/Users/myUserName/code/my-repo:/localDebugRepo --workdir="/localDebugRepo" --memory=4g --memory-swap=4g --memory-swappiness=0 --cpus=4 --entrypoint=/bin/bash itguy614/gohcl-php-docker-pipeline:php-8.1

Replace /Users/myUserName/code/my-repo in the command with the path of the clone you took on step 1.

After the Docker container starts, you can run the commands of your yml file's script.

If you get the same error, you can check composer.json or any other configuration files where a different version of php may be defined, make changes in these files locally and then run your build's commands again to see if the issue is resolved.

Kind regards,
Theodora

Your information for debugging got me heading down the right path, thank you.  I had installed composer using `apk` which has a built in dependency of php8.0 even though I'm using the official php8.1 image.  I instead manually installed composer into my image and things started clicking.

Thank you very much.

Like Theodora Boudale likes this

Thank you for the update @kurtwolf, you are very welcome and I'm glad that you figured this out.

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

Kind regards,
Theodora

This is from the Docker console for that image so you can see the installed versions.

Screen Shot 2022-03-01 at 9.41.03 AM.png

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events