Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

K8S Backend - Ability to add a side container to a step (pod) #3977

Open
3 tasks done
eliasscosta opened this issue Jul 25, 2024 · 0 comments
Open
3 tasks done

K8S Backend - Ability to add a side container to a step (pod) #3977

eliasscosta opened this issue Jul 25, 2024 · 0 comments
Labels
backend/kubernetes enhancement improve existing features

Comments

@eliasscosta
Copy link
Contributor

eliasscosta commented Jul 25, 2024

Clear and concise description of the problem

Sometimes we have a test step where they need to run inside a docker image (dind), because a few tests are written with the TestContainer library.

To achieve it, we need to configure one step like this:

  allTests:
    image: docker:24.0.9
    commands:
      - apk add openjdk17
      - dockerd-entrypoint.sh --registry-mirror=http://myprivate-mirror.ior:5000 1> /dev/null 2> /dev/null &
      - ./gradlew test myTEST
    when:
      event: push

This example is in the easy mode, but sometimes we need to install more than one jdk or the dind image doesn't have the library in the OS packages.

Suggested solution

The solution was to add into the backend_options a way to create a side container with the main step container.

  allTests:
    image: openjdk17
    commands:
      - ./gradlew test myTEST
    when:
      event: push
    backend_options:
      kubernetes:
        container: 
          - image: docker:dind
            env: []

Then both containers can start and we can access the docker in the local host and execute the tests with the TestContainers.

Alternative

No response

Additional context

No response

Validations

  • Checked that the feature isn't part of the next version already [https://woodpecker-ci.org/faq#which-version-of-woodpecker-should-i-use]
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
@eliasscosta eliasscosta added the feature add new functionality label Jul 25, 2024
@qwerty287 qwerty287 added enhancement improve existing features backend/kubernetes and removed feature add new functionality labels Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend/kubernetes enhancement improve existing features
Projects
None yet
Development

No branches or pull requests

2 participants