Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Merge requests
  • !2820
An error occurred while fetching the assigned milestone of the selected merge_request.

[travis] Avoiding build timeouts

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Jim Schubert requested to merge travis-timeout-fixes into master 6 years ago
  • Overview 0
  • Commits 8
  • Pipelines 0
  • Changes 3

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh, ./bin/openapi3/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\. If contributing template-only or documentation-only changes which will change sample output, be sure to build the project first.
  • Filed the PR against the correct branch: master, 3.4.x, 4.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

Travis CI will timeout if there is no activity printed to stdout or stderr for 10 minutes. Running our mvn commands with --quiet option may hit this limit for any number of reasons (more code, network conditions). To avoid this, we remove --quiet and adjust some other Maven configuration options.

One, specifically, is the cached .m2/repository directory. We bind this to a non-user home location due to the -u binding found in run-in-docker.sh. We then provide a settings.xml and CLI option to tell maven where to look for our cached repository directory. This should allow both users and CI to run the script in a consistent way, but most importantly should allow Travis to continue to cache artifacts across builds.

Compare
  • master (base)

and
  • latest version
    8ec7b6ad
    8 commits, 2 years ago

3 files
+ 22
- 3

    Preferences

    File browser
    Compare changes
C‎I‎
run-in-docker‎-settings.xml‎ +7 -0
.trav‎is.yml‎ +8 -2
run-in-d‎ocker.sh‎ +7 -1
CI/run-in-docker-settings.xml 0 → 100644
+ 7
- 0
  • View file @ 8ec7b6ad

  • Edit in single-file editor

  • Open in Web IDE

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<!-- This directory matches what is defined in run-in-docker.sh -->
<localRepository>/var/maven/.m2/repository</localRepository>
</settings>
\ No newline at end of file
.travis.yml
+ 8
- 2
  • View file @ 8ec7b6ad

  • Edit in single-file editor

  • Open in Web IDE


@@ -3,6 +3,10 @@ language: java
jdk:
- openjdk8
# See https://docs.travis-ci.com/user/languages/java/#caching
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache:
directories:
- $HOME/.m2
@@ -121,8 +125,9 @@ script:
# fail if generators contain tab '\t'
- /bin/bash ./bin/utils/detect_tab_in_java_class.sh
# run integration tests defined in maven pom.xml
- mvn --quiet --batch-mode clean install
- mvn --quiet --batch-mode verify -Psamples
# WARN: Travis will timeout after 10 minutes of no stdout/stderr activity, which is problematic with mvn --quiet.
- mvn --quiet --batch-mode --show-version clean install
- mvn --quiet --batch-mode --show-version verify -Psamples
after_success:
# push to maven repo
- if [ $SONATYPE_USERNAME ] && [ -z $TRAVIS_TAG ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
@@ -162,3 +167,4 @@ after_success:
env:
- DOCKER_GENERATOR_IMAGE_NAME=openapitools/openapi-generator-online DOCKER_CODEGEN_CLI_IMAGE_NAME=openapitools/openapi-generator-cli NODE_ENV=test CC=gcc-5 CXX=g++-5
run-in-docker.sh
+ 7
- 1
  • View file @ 8ec7b6ad

  • Edit in single-file editor

  • Open in Web IDE


@@ -7,12 +7,18 @@ maven_cache_repo="${HOME}/.m2/repository"
mkdir -p "${maven_cache_repo}"
# !! The -u option below needs to be defined so we don't write to a user's bound ~/.m2/repository as root.
# !! but using this also means we either need to setup a user with the same id, or we execute without a username and home directory.
# !! This means we can't bind the .m2 directory to any user's directory (like /root/.m2).
# !! We _must_ define $MAVEN_CONFIG explicitly as a location that is not /root/.m2; the user executing this may not have access to the container's user's directory.
docker run --rm -it \
-w /gen \
-e GEN_DIR=/gen \
-e MAVEN_CONFIG=/var/maven/.m2 \
-e MAVEN_OPTS="-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=/var/maven/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true" \
-u "$(id -u):$(id -g)" \
-v "${PWD}:/gen" \
-v "$HOME/.m2":/root/.m2 \
-v "${PWD}/CI/run-in-docker-settings.xml:/var/maven/.m2/settings.xml" \
-v "${maven_cache_repo}:/var/maven/.m2/repository" \
--entrypoint /gen/docker-entrypoint.sh \
maven:3-jdk-8 "$@"
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 participants
Reference:
Source branch: travis-timeout-fixes

Menu

Explore Projects Groups Snippets