Skip to content

Improve Travis Builds (inc. additional warnings) #376

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

Merged
merged 3 commits into from
Nov 8, 2019

Conversation

henrygab
Copy link
Collaborator

@henrygab henrygab commented Nov 5, 2019

This includes a few improvements. Summarized:

  • Disable lots of noisy output from build logs caused by Arduino mDNS
  • Enable an environment variable to request a build with additional warnings enabled

Details follow, with line numbers referring to new line numbers.

In file .travis.yml:

  1. lines 12-29: friendly names given to each job
  2. lines 12-29: add second build per board that enables additional warnings (as Arduino user might)
  3. lines 30-33: list jobs with additional warnings as 'allow_failures'; these jobs can fail without causing the build as a whole to fail, allowing addressing of warnings over time
  4. lines 56-66L: enable firewall rules to remove all the really noisy output from Arduino's mDNS code, just before build starts

In file tools/build_all.py:

  1. lines 11-17: detects environment variable to enable additional warnings
  2. lines 31-49: define a filter to ignore some output that is, for unknown reasons, sent to STDERR instead of STDOUT
  3. lines 62-65: if additional warnings requested, set Arduino preference to enable them
  4. lines 73-79: if additional warnings requested, pipe STDERR separate from STDOUT
  5. lines 80-86: apply the filter (see lines 31-49) to get list of only those lines having actual errors from the process's STDERR output
  6. lines 91-94: set the variables to indicate the build failed when there is unfiltered output on STDERR
  7. line 106: fix bug that would output prior build's results for a skipped build.
  8. lines 107-113: output filtered warning lines when they exist

Workaround for Arduino mDNS output noise using IPTABLES.
    See https://forum.arduino.cc/index.php?topic=469428.0
    See per1234/arduino-ci-script#1
    Arduino IDE adds a lot of noise caused by network traffic (mDNS?),
    because it's listening for network-attached devices.
    Firewall it in the TravisCI environment to cleanup logs.

Allow jobs with all warnings enabled to fail.
    This enables the build to occur, and review of warnings,
    without requiring these builds to be clean of warnings.
    Also, only outputs the error logs (not full build logs)
    for these build options.  This is a critical step
    towards getting to 100% warning-free builds, without
    interrupting current processes.
When skipping a sketch, would previously show the build output
from the prior sketch.  This may also have caused a build error
if the first sketch was skipped (unverified).
@ladyada
Copy link
Member

ladyada commented Nov 5, 2019

ooh the DNS thing has been a thorn in my side. we should add it to our generic arduino library travis.yml - this is my reminder!

@henrygab
Copy link
Collaborator Author

henrygab commented Nov 5, 2019

@ladyada -- Yes! Me too!

But please be careful! The commands look to me like a big hammer / quick fix. I've not tested if this impacts other network traffic... so be extra careful before expecting other network functionality (updates, downloads) to work after those commands are used.

It probably better would be to block only mDNS traffic, or at least limit only traffic from the Arduino process. But I haven't the time to dig into what ports / protocols / etc. are used, for example, and thus just used the solution from the URIs I included in the .travis.yml.

@henrygab
Copy link
Collaborator Author

henrygab commented Nov 5, 2019

Odd, same commit worked in my TravisCI build.

TravisCI appears to have had a transient error, but I can't request the build to restart?

@ladyada
Copy link
Member

ladyada commented Nov 5, 2019

hmm you're using travis.org but i think that site has been deprecated?

@henrygab
Copy link
Collaborator Author

henrygab commented Nov 5, 2019

? It's unclear why this failed ?
The same commit built successfully for me.

I believe this is a transient error, but don't seem to have a button that allows me to request the build restart....

@ladyada
Copy link
Member

ladyada commented Nov 5, 2019

i kicked it - yeek at 2 hour runtime. thats so looong

@henrygab
Copy link
Collaborator Author

henrygab commented Nov 5, 2019

The 2 hours is only total compute time. Each job should take ~30 minutes. The same error … but not for any reason that I can fathom, unless TravisCI.com allows the iptables changes from one build to affect another build (which would be a major bug, imho). I don't know what to say about that error, other than to note that Commit 157ac15 built successfully on TravisCI.org, just before I submitted this PR.

TravisCI.org is still the primary site for free/OSS projects. While there is a beta to enable having both OSS + private projects accessible via TravisCI.com, it's not only unclear what the benefits would be, doing so may be a downgrade: TravisCI.com says it will limit free/OSS projects to 3 simultaneous jobs, while currently TravisCI.org allows more simultaneous jobs (I've seen six running).

Based on this, I may keep at TravisCI.org for as long as I can....

@henrygab
Copy link
Collaborator Author

henrygab commented Nov 6, 2019

The installation command is failing without any apparent reason for feather 52832:

Job Name Full Log Cmd Line Relevant lines
345.1 Feather 52840 Log 275 453
345.2 Circuit Playground 52840 Log 275 455
345.3 Feather 52832 Log 275 634

From the above, it appears that a successful task would have a line similar to the following:

2019-11-05T20:23:00.712Z INFO c.a.c.p.ContributionInstaller:324 [main] Check unknown files. Additional package index folder files=[package_adafruit_index.json, package_index.json], Additional package index url downloaded=[/home/travis/.arduino15/package_adafruit_index.json]

While the failing build has the following output line, just before crashing with a null de-ref:

2019-11-05T20:24:50.204Z INFO c.a.c.p.ContributionInstaller:324 [main] Check unknown files. Additional package index folder files=[package_adafruit_index.json, package_index.json], Additional package index url downloaded=[]

Walking backwards, the download failed at line 478.

This is definitely a bug in Arduino, as it should NOT crash simply because it failed to download a file.

https://travis-ci.com/adafruit/Adafruit_nRF52_Arduino/jobs/253218220#L455

This modification reduces the IPTABLES rules to the minimum needed.
Specifically, it does NOT create default rules, or edit any existing rules.
Instead, it only adds rules to drop mDNS at 5353/udp, and to drop all
incoming traffic that's addressed to the mDNS multicast IP address.
@henrygab
Copy link
Collaborator Author

henrygab commented Nov 8, 2019

The evidence showed the the prior failures to be an arduino bug. In any case, they were unrelated to my changes as they occurred prior to any commands I had added (and the same build with all warnings enabled got past that point).

However, I wanted a narrower, more focused set of iptable commands anyways, so I tested a reduced set that only drops incoming mDNS traffic, and added that to this branch. It not only worked on travis-ci.org, it has now passed the prior failure points that were occurring for travis-ci.com.

@ladyada , As requested, I've submitted this PR to enable you to build with additional warnings. The build will still take ~35 minutes, but will now also have builds with additional warnings enabled and only outputs the error lines, allowing focused review of the remaining issues, without causing any CI builds to fail.

@hathach
Copy link
Member

hathach commented Nov 8, 2019

Thank you very much @henrygab for your great work again !! I really like a warning-free complication as possible as well. Ideally we should just run only All Warnings job but warnings can come from other library that we have no control over. I am happy with the current solution.

@ladyada If you are also happy with the PR, we could merge it :)

@ladyada
Copy link
Member

ladyada commented Nov 8, 2019

@hathach yes sounds good!

@ladyada ladyada merged commit 32f3b29 into adafruit:master Nov 8, 2019
@henrygab henrygab deleted the TravisAllWarnings branch November 8, 2019 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants