Is there a way to configure an IDF project when running a GitLab CI/CD pipeline?

Frowly
Posts: 2
Joined: Mon Feb 10, 2020 3:20 pm

Is there a way to configure an IDF project when running a GitLab CI/CD pipeline?

Postby Frowly » Mon Feb 10, 2020 4:14 pm

Hi, I have a configured IDF project in a Git repository on a GitLab server. Configured means I ran

Code: Select all

idf.py menuconfig
and the sdkconfig file is check into the repository. When building (aka running the pipeline) though, I want to assign the value of a GitLab environment variable to an entry that's purposely not been set. Basically I want to "run menuconfig without the interactive ui to set some remaining value".

I could write a simple script and set the entry in sdkconfig directly, but at the top of the file it clearly states:
# Automatically generated file. DO NOT EDIT.
Is there there a tool to do this or how is it usually done?

Thanks,
Frow

ESP_Angus
Posts: 2011
Joined: Sun May 08, 2016 4:11 am

Re: Is there a way to configure an IDF project when running a GitLab CI/CD pipeline?

Postby ESP_Angus » Mon Feb 10, 2020 11:20 pm

Hi Frowly,

Despite the stern warning in the comment, it is possible to edit this file (just need to be careful when doing so). Appending a NAME=VALUE to the end may be enough, depending on what the other settings or requirements are. Or you could use a tool like "sed" to replace the old value with the new value.

If the config variable is one that you've added in your project then to is also possible to define a KConfig entry that says "this entry should have the value of environment variable X", like this:
https://github.com/espressif/esp-idf/bl ... Kconfig#L9


Angus

Frowly
Posts: 2
Joined: Mon Feb 10, 2020 3:20 pm

Re: Is there a way to configure an IDF project when running a GitLab CI/CD pipeline?

Postby Frowly » Fri Feb 14, 2020 11:20 am

Thanks for the quick answer Angus!

Using sed was what I was thinking. So it's nice, that it's actually "allowed" to just replace values in sdkconfig.

The second alternative you described seems very intriguing, though. So I tried it, but it doesn't work properly the way I do it. When I change my Kconfig.projbuild from

Code: Select all

config MY_VARIABLE
        string
to

Code: Select all

config MY_VARIABLE
        string
        option env="MY_VARIABLE"
the value of the environment variable "MY_VARIABLE" appears when running menuconfig, but after closing menuconfig it doesn't get written to sdkconfig. In fact the entire variable doesn't appear. Not even

Code: Select all

CONFIG_MY_VARIABLE=""
without a value. Am I doing something wrong?

Frow

Who is online

Users browsing this forum: amunamun and 19 guests