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

Basic support for custom networks #32

Merged
merged 2 commits into from
Apr 8, 2021

Conversation

raul-arabaolaza
Copy link
Contributor

@raul-arabaolaza raul-arabaolaza commented Apr 8, 2021

This change adds limited support for custom networks in docker-fixtures, allowing for example to launch the ATH with a docker compose file like this one:

version: '3'
services:
  firefox:
    image: '${SELENIUM_CONTAINER}:${SELENIUM_CONTAINER_VERSION}'
    networks:
      - ath-network
    ports:
      - '5900:5900'
      - '4444:4444'
    container_name: firefox
    environment:
      - SCREEN_WIDTH:1680
      - SCREEN_HEIGHT:1090
  mvn:
    container_name: mvn
    networks:
      - ath-network
    shm_size: '2gb'
    image: '${MAVEN_CONTAINER}:${MAVEN_CONTAINER_VERSION}'
    ports:
      - '5005:5005'
    working_dir: /src
    command: >
      bash -c "mvn test ${MAVEN_ARGS}"
    volumes:
      - ./pom.xml:/src/pom.xml
      - ./src:/src/src
      - ./.mvn:/src/.mvn
      - ./config.groovy:/src/config.groovy
      - ${WAR_FILE}:/src/jenkins.war
      - ${MAVEN_EXCLUDES_FILE}:${EXCLUDES_DESTINATION}
      - /var/run/docker.sock:/var/run/docker.sock
      - ${MAVEN_FOLDER}:/root/.m2
      - ${MAVEN_SETTINGS_FILE}:${CUSTOM_SETTINGS_DESTINATION}
    environment:
      - DISPLAY=:0
      - RECORDER=off
      - BROWSER=remote-webdriver-firefox
      - REMOTE_WEBDRIVER_URL=http://firefox:4444/wd/hub
      - JENKINS_LOCAL_HOSTNAME=mvn
      - CONFIG=config.groovy
      - MAVEN_OPTS=-Xmx512m -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XshowSettings:vm
      - SHARED_DOCKER_SERVICE=true
      - DOCKER_FIXTURES_NETWORK=ath-network
    depends_on:
      - firefox
networks:
  ath-network:
    name: ath-network
    attachable: true

Compose file copied inspired by @jglick work :trollface:

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your master branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@raul-arabaolaza
Copy link
Contributor Author

I see no test that actually launches the fixtures, I have tested this manually by using the aforementioned docker-compose file with a custom version of the ath

@raul-arabaolaza raul-arabaolaza marked this pull request as ready for review April 8, 2021 16:16
@raul-arabaolaza
Copy link
Contributor Author

cc @olivergondza apparently you are the last one merging things here 😁

Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No objections. Not sure using EnvVars is the best approach, but whatever works

Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure? This will only take effect when the test or harness picks up this PR though, of course.

Consider this lib deprecated in favor of testcontainers.org.

@jglick jglick merged commit 573f023 into jenkinsci:master Apr 8, 2021
@jglick
Copy link
Member

jglick commented Apr 8, 2021

raul-arabaolaza added a commit to raul-arabaolaza/acceptance-test-harness that referenced this pull request Apr 9, 2021
@raul-arabaolaza
Copy link
Contributor Author

:thankyou:

timja pushed a commit to jenkinsci/acceptance-test-harness that referenced this pull request Apr 21, 2021
* Update docker-fixtures to 1.11

So jenkinsci/docker-fixtures#32 can be used

* Update doc

* Temporary revert so I can get a proper test baseline

* Restore back fixtures update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants