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

Can we use pipe inside custom pipe ?

Narendra
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!
December 14, 2022

Hi Team, 

 

We are creating our custom pipe using Python/Bash.

We want push images to ecr as one of task which we have in our custom pipe, there is aws-ecr-push pipe is available.

Can I use existing pipe inside my custom pipe. If yes, Can you please point me. 

 

 

 

Appreciate your help.

Thanks

Narendra  

1 answer

0 votes
Oleksandr Kyrdan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 16, 2022

Hi @Narendra 

Thank you for your question!

If I understand you correct, there could be the next cases:

1) implement your workflow logic in multiple files and combine them with the pipe accordingly:

- step:
    oidc: true
    script:
# <do some pre-build logic> # build the image - docker build -t my-docker-image .

# <do some additional logic here>
# <./run.sh execute some shell scripts here> # use the pipe to push the image to AWS ECR - pipe: atlassian/aws-ecr-push-image:1.6.2 variables: AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION AWS_OIDC_ROLE_ARN: 'arn:aws:iam::123456789012:role/role_name' IMAGE_NAME: my-docker-image

2) or if you want to extend/modify the pipe functionality you could write own custom pipe and use inheritance. A good example is here.

 

Welcome to share your experience with the community.

 

Best regards,
Oleksandr Kyrdan

Narendra
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!
December 18, 2022

Hi Oleksandr, 

 

  Thank you for your response, Im looking in following way as my custom pipe. 

1.   bitbucket-pipeline.yml 

====================

- pipe: <company_repo>/<company-ecr-custom-name-pipe>:<version>
        variables:
          AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
          AWS_OIDC_ROLE_ARN: 'arn:aws:iam::123456789012:role/role_name'
          IMAGE_NAME: my-docker-image
OPERATIONS : ["PUSH", "RESTART"]
KEY1 : VALUE1
KEY2 : VALUE2

 

 

2. Custom Pipe should able to do push when user:

Ex: 

    My custom pipe should use internally, aws-ecr-push-image:1.6.1 pipe, if user given PUSH in OPERATIONS variable. 

- pipe: atlassian/aws-ecr-push-image:1.6.2

 

I hope above example gives what I'm looking. Please let me know in case if you require more details. 

 

Appreciate your pointers 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events