Uploaded image for project: 'PHP Driver: Library'
  1. PHP Driver: Library
  2. PHPLIB-574

Fail CI build if mongo-orchestration cannot start servers

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.7.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      Travis CI builds occasionally fail because setup_mo.sh encounters an error (see: build log):

      $ .travis/setup_mo.sh
      Loading MO for STANDALONE_SSL
      PHP Notice:  Trying to get property 'mongodb_uri' of non-object in Command line code on line 1
      PHP Stack trace:
      PHP   1. {main}() Command line code:0
      MongoDB Test URI: 
      Notice: Trying to get property 'mongodb_uri' of non-object in Command line code on line 1
      
      Call Stack:
          0.0001     410240   1. {main}() Command line code:0
      
      /?ssl=true&sslallowinvalidcertificates=true
      Raw MO Response:
      DBPATH=/home/travis/build/mongodb/mongo-php-library/orchestrations
      LOGPATH=/home/travis/build/mongodb/mongo-php-library/orchestrations
      POST_DATA='{ "name": "mongod", "id" : "STANDALONE_SSL", "procParams": { "dbpath": "/tmp/standalone-ssl/", "ipv6": true, "logappend": true, "logpath": "/tmp/standalone-ssl/m.log", "journal": true, "port": 2100, "bind_ip_all": true, "setParameter": {"enableTestCommands": 1} }, "sslParams": { "sslMode": "requireSSL", "sslCAFile": "/home/travis/build/mongodb/mongo-php-library/mongo-orchestration/ssl/ca.pem", "sslPEMKeyFile": "/home/travis/build/mongodb/mongo-php-library/mongo-orchestration/ssl/server.pem", "sslWeakCertificateValidation": true, "sslAllowInvalidHostnames": true } }'
      
      POST http://localhost:8889/servers HTTP/1.1 500 Internal Server Error
      
      Content-Length: 998
      
      Content-Type: None
      
      Date: Mon, 27 Jul 2020 22:20:42 GMT
      
      Server: travis-job-ecaa35f6-7ddf-4d85-b6d1-e9ad369e4c2f
      
      
      
      Traceback (most recent call last):
        File "/home/travis/.local/lib/python2.7/site-packages/mongo_orchestration/apps/__init__.py", line 66, in wrap
          return f(*arg, **kwd)
        File "/home/travis/.local/lib/python2.7/site-packages/mongo_orchestration/apps/servers.py", line 83, in host_create
          result = _host_create(data)
        File "/home/travis/.local/lib/python2.7/site-packages/mongo_orchestration/apps/servers.py", line 52, in _host_create
          params.get('version', ''))
        File "/home/travis/.local/lib/python2.7/site-packages/mongo_orchestration/servers.py", line 511, in create
          server.start(timeout)
        File "/home/travis/.local/lib/python2.7/site-packages/mongo_orchestration/servers.py", line 373, in start
          LOG_FILE + ' for more details.')
        File "<string>", line 2, in reraise
      TimeoutError: Could not start Server. Please check server log located in /tmp/standalone-ssl/m.log or the mongo-orchestration log in /home/travis/build/mongodb/mongo-php-library/server.log for more details.
      
      travis_time:end:236e6b58:start=1595888142003197777,finish=1595888442232877043,duration=300229679266,event=before_script
      

      This error does not abort the build, which can lead to more confusing errors down the line. In this case, there are many "Undefined index: scheme" errors due to parse_url failing to parse the MONGODB_URI environment variable (presumably it's left empty when setup_mo.sh fails).

      Independent of sorting out why MO failed to start the server, the CI build should immediately fail if the server(s) cannot be started. To help with debugging during such a failure, we can consider dumping the server and MO logs before aborting the build (as suggested in the MO error).

            Assignee:
            andreas.braun@mongodb.com Andreas Braun
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: