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

Testing a client using a service container running the application

David Engelmann February 1, 2023

I have an application called doccano that's built with docker/docker compose and spins up a series of different containers to run the application. I have a package that is a client for interacting with the doccano application that I wish to test. I'm looking at spinning up the doccano application as a service for the pipeline. In the steps, I would like to be able to build my client package and test it against the running doccano service. If someone can just get me to being able to ping the service container from the step, the rest is trivial. This was very simple with github actions. 

....

  services:
    doccano:
      image:
        name: doccano/doccano
...

 - step:

    name: test

    services:
      - doccano
    script: 
      - export COMPOSER_ALLOW_SUPERUSER=1
      - apt-get update -qq
      - apt-get install apt-transport-https ca-certificates gnupg lsb-release git curl iputils-ping -y
      - ping -c 1 doccano

1 answer

1 accepted

1 vote
Answer accepted
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 14, 2023

Hi @David Engelmann,

Welcome to the community.

I do believe the Docker image doccano/doccano is not intended to be used as a service on Pipelines as compared to MySQL Docker image here.
This is why you can't use the Docker image as a service directly.

What you could try differently is to run a Docker container directly on Pipelines using Docker commands (e.g. docker run).
Alternatively, you can also try using docker-compose as mentioned on the doccano Docker hub overview page.

Regards,
Mark C

David Engelmann February 15, 2023

I use the doccano image as a service in Github Actions without any issue, here is the workflow file - https://github.com/david-engelmann/DoccanoClient.jl/blob/main/.github/workflows/doccano_init.yml. I've tried installing it from docker run and docker compose and I'm not able to find a way to test interacting with it.

Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 20, 2023

Hi @David Engelmann,

After further testing, instead of pinging the service, you can access it via the localhost on the specified port 8000.
Here's the exact YAML configuration that I used:

definitions:
  services:
    test-service:
      image: doccano/doccano
      variables:
        ADMIN_USERNAME: admin
        ADMIN_EMAIL: test123@gmail.com
        ADMIN_PASSWORD: password
        PORT: 8000

pipelines: 
  default: 
    - step: 
        script: 
          - curl http://127.0.0.1:8000/
        services:
          - docker
          - test-service

Hope it helps and do let me know if you have further questions.

Regards,
Mark C

David Engelmann February 22, 2023

Hi Mark, thank you for all your help. I've been able to see the presence of the services but my issue comes when trying to interact with it. Such as a POST request to test the login and csrf token mechanics. There isn't a technical/security reason why this would be impossible correct?

Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 22, 2023

Hi @David Engelmann,

You'll just need to be aware of the limitations for services on Pipelines as highlighted in this documentation.

Regards,
Mark C

Suggest an answer

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

Atlassian Community Events