Platformio and SonarQube

Hi there,

We are rather new using PlatformIO (I am writing in behalf of my team), so first of all, forgive me if I am not writing in the right forum place, or it has been previously discussed already in other old topics.

We have successfully developed a tailored-made solution with an ESP32 device using the Visual Code Studio and the PlatformIO framework, and we would like to execute a SonarQube instance through jenkins in order to evaluate the code quality (using CI/CD is not possible due to a gitlab limitations from our company - sad, but true).

We had few ideas so far in order to achieve the mentioned task, and may be summarized below:

  1. We have tried digging into the PlatformIO documentation, and we have seen the following URL that could have helped… but it appears to be broken :frowning:

https://docs.platformio.org/en/latest/integration/ci/jenkins.html

  1. Also, we have tried writing a makefile on our own, because SonarQube for C/C++ projectsd requires the build-wrapper-linux-x86-64 on the make execution… but we have realized that it will drive us to madness, since there are tons of dependencies in multiple paths / folders (which, ideally, those dependencies should not be uploaded to the repository).

  2. We have attempted to research how Visual Studio Code internally executes the make process, but we have seen nothing useful so far.

  3. Furthermore, we have found a CI/CD documentation that does what we want, but as I said before, we will not be able to apply it due to the company restrictions:

Could you guys help us in order to fulfill this Quality Assurance process?

Thank you very much beforehand, our apologies for the inconveniences, and looking forward to hearing from you.

Kind regards.
Daniel.

Good find, but the waybackmachine still has it archived.

https://web.archive.org/web/20230000000000*/http://www.thingforward.io/techblog/2017-11-03-setting-up-a-jenkins-ci-engine-for-embedded-projects.html

https://web.archive.org/web/20200922231607/http://www.thingforward.io/techblog/2017-11-03-setting-up-a-jenkins-ci-engine-for-embedded-projects.html

Maybe this already helps you resolve the issue. An issue will be opened in the documentation repo.

Tracked in

Hi @maxgerhardt

Thank you very much for your quick reply, we are glad to help improving your tool!

Regarding you answer → Great, we will take a look to the link you share!

Additionally → We have found within the SonarQube forum a topic that might be useful:

That guy is using the platformio ci command in its own .yml file like this:

./sonarqube/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir sonarqube-out \
          platformio ci --build-dir="./bin" --keep-build-dir --project-conf=platformio.ini ./src/

Perhaps we could be able to generate the sonarqube reports and upload them directly to the repository, is that possible? I know it is a shame we are not able to use CI/CD, but this is what it is sadly :frowning:

Looking forward to hearing from you.

Kind regards.
Daniel.

I’m not a Jenkins expert, but on other CI system I worked on (Github, GitLab), you always had the concept of being able to upload an “Artifact” for a run, so if SonarCube pumps out a report file of some sort, that would be uploadable.

Github also has the conceptions of “gh-pages” where it pushes report files to a certain branch, overriding the last ones. But in my eyes that’s worse than Artifacts in the case, you want to be able to still view per-commit what the report was.

Mabye @ivankravets has more experience?

1 Like

PlatformIO is independent of any operating system or CI service. You just need to have Python installed on the CI instance and run pip install platformio command. Later, you will have access to the pio --help command. The CLI Guide is here.

I recommend using pio run command instead of pio ci. The pio run will give you more advanced control over your project.

Hi @maxgerhardt and @ivankravets

Thank you very much for your responses, we were finally able to execute the SonarQube for our project using the ESP32 board and the platformio framework :slight_smile: (see the picture attached).

For now, we are ignoring the Jenkins instance, but in order to include that part, I am afraid we should talk to our company Jenkins administrador so as to ask if all packages needed might be installed there (that is to say, python, pip, platformio, etc…), but to be honest, I would not put my money on the table for it.

Again, thank you very much for your replies, they were very helpful!

Kind regards.
Daniel.

1 Like