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

How to resolve error 'Incorrect Type. Expected "build execution unit"' in bitbucket-pipelines.yml

Deepesh Belani
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Oct 15, 2023

Hi All, I am now to Bitbucket pipeline. I am trying to use the YAML anchors to create build steps for dev and qa environments. I am running into an issue 'Incorrect Type. Expected "build execution unit"'. Looking for any help on how to resolve this.

Branches in Repo: dev(MAIN, DEVELOPMENT, PRODUCTION), test

 

# Template to deploy builds
image: google/cloud-sdk:latest

definitions:
caches:
# Cache zip cli
zip: /usr/bin
steps:
- step: &zipfile
name: zip files
caches:
- zip
max-time: 2
script:
- apt-get update && apt-get install -y zip
- zip -r function-source.zip . -x *.git* *.yml *.md
- ls -l
- gcloud config set project my-first-project
- echo $GCLOUD_API_KEYFILE_NPROD > gcloud-api-key.json
- gcloud auth activate-service-account --key-file=gcloud-api-key.json
- gcloud storage cp function-source.zip gs://my-first-bucket/bitbucket-pipeline
- step:
name: deploy to CF
max-time: 10
script:
- gcloud config set project my-first-project
- echo $GCLOUD_API_KEYFILE_NPROD > gcloud-api-key.json
- gcloud auth activate-service-account --key-file=gcloud-api-key.json
- gcloud functions deploy Hello_World
--gen2
--region=us-east4
--runtime=python311
--source=gs://my-first-bucket/bitbucket-pipeline/function-source.zip
--entry-point=hello_http
--run-service-account=myfirstsa@my-first-project.iam.gserviceaccount.com
--trigger-http
--no-allow-unauthenticated

pipelines:
branches:
dev:
- step: *zipfile

 

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Oct 17, 2023

Hi Deepesh and welcome to the community!

I tried using a yml file similar to yours, but I cannot reproduce this error. I see that the second step in your definitions (with the name 'deploy to CF') is missing an anchor, but this shouldn't be an issue if you are not using it anywhere. If you want to use it, you will need to specify an anchor, as you did for the first step.

  • Is this the whole yml file you are using or is there additional content you haven't posted here?

  • Where exactly do you see the error you mentioned?

  • Can you please ensure you are using indentation as below (with spaces for indentation, not tabs) and try running another build?
# Template to deploy builds
image: google/cloud-sdk:latest

definitions:
caches:
# Cache zip cli
zip: /usr/bin
steps:
- step: &zipfile
name: zip files
caches:
- zip
max-time: 2
script:
- apt-get update && apt-get install -y zip
- zip -r function-source.zip . -x *.git* *.yml *.md
- ls -l
- gcloud config set project my-first-project
- echo $GCLOUD_API_KEYFILE_NPROD > gcloud-api-key.json
- gcloud auth activate-service-account --key-file=gcloud-api-key.json
- gcloud storage cp function-source.zip gs://my-first-bucket/bitbucket-pipeline
- step:
name: deploy to CF
max-time: 10
script:
- gcloud config set project my-first-project
- echo $GCLOUD_API_KEYFILE_NPROD > gcloud-api-key.json
- gcloud auth activate-service-account --key-file=gcloud-api-key.json
- gcloud functions deploy Hello_World --gen2 --region=us-east4 --runtime=python311 --source=gs://my-first-bucket/bitbucket-pipeline/function-source.zip --entry-point=hello_http --run-service-account=myfirstsa@my-first-project.iam.gserviceaccount.com --trigger-http --no-allow-unauthenticated

pipelines:
branches:
dev:
- step: *zipfile

Kind regards,
Theodora

Deepesh Belani
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Oct 17, 2023

Hello Theodora,

Thanks for your reply. The code above is the whole yml file. I am sorry I did not mention the line giving error. It is at below line in the VS code editor. I checked the indentation(VS code) it is using space  and not tabs. I think we can ignore this as this is the editor reported issue and not by the pipeline. I have put the new error below.

- step: &zipfile

 Per your suggestion I have used online in editor to format it again and used the BB Validator to confirm the file is valid. After running the pipeline it is giving the error as below though there is a step defined.

-------------------------

Configuration error

There is an error in your bitbucket-pipelines.yml at [pipelines > branches > dev > 0]. Step is empty, null, or missing.

-------------------------

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Oct 18, 2023

Hi Deepesh,

Thank you for the update.

The new error you see is most likely related to indentation. Unfortunately, the validator doesn't report errors when yaml anchors are used (this is a bug: https://jira.atlassian.com/browse/BCLOUD-18299).

If you edit the file online on Bitbucket website, do you see an orange circle next to a line number that indicates where the issue is?

If you cannot figure it out, could you please post a screenshot of the file from the website? If you copy-paste the content here, the indentation will be lost. With a screenshot, I can see if there are any issues with indentation.

Kind regards,
Theodora

Like Sabine Mayer likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events