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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Consume API service from Bash in Docker

Edited

Hello to all,

 

My problem is that I need to use Powershell with an specific modul that don't have compatibility with Linux os. Also, I can't use Windows os to build my own Pipelines.

Then I'm thinking into create a API Services and consume that through Bash. Can I consume API from docker for Bitbucket Pipeline?

 

@Galyna Zholtkevych can you help me?

 

Thanks! :)

1 answer

0 votes

@sergibarca hello!

Okay, let's go in details.

Am I right that you need to use an API?

What exactly you want to do?

 

You can actually defaine firstly your api as service definition (see here how to define a service in definitions block https://support.atlassian.com/bitbucket-cloud/docs/databases-and-service-containers/ )


definitions:
    services:
         my-awesome-api:

               image: my-dockerhub/my-repository
         mongo:

               image: mongo

And then you can use it in step:

step: 
image : ...
...
script:
   - # execute bash command here
services:


   - my-awesome-api

 

As bash command you actually can also execute some powershell commands using in your step

image: mcr.microsoft.com/powershell, and put in script lines like

pwsh -Command {your command}

but it may be limited somehow and this depends on what you're trying to do in powershell.

Perhaps in bash it would be easier for you, but this depends on what you need exactly.

 

How are you supposed to use API? If you just need to check urls, you can write bash script, it will be much easier, for example, using curl utility , e.g. like 

curl <your_api_url>:<port>/v1/users/

 

Let's talk about your case.

Regards, Galyna

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

🍂📹 Apptoberfest demo contest roundup: vote for your favorite demos!

Hi Community! The submissions are in (and listed below) for the 🍻🍂Apptoberfest🍂🍻 Demo Competition and it’s time for you to place your votes for the best: Analytics & reporting app demo ...

258 views 6 17
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you