Thanks a lot Milosz, I was able to troubleshoot the issue. The value was picking up extra space, due to which I was getting the error. All in all the updating the env.yaml with variable helps. ________________________________ From: Milosz Wasilewski milosz.wasilewski@foundries.io Sent: Thursday, August 29, 2024 3:09 PM To: Sweta Ghosh sweta.ghosh@nagarro.com Cc: lava-users@lists.lavasoftware.org lava-users@lists.lavasoftware.org Subject: Re: [lava-users] Not able to set variable
[Email from a non-Nagarro source: please exercise caution with links and attachments]
On Thu, Aug 29, 2024 at 10:29 AM Sweta Ghosh sweta.ghosh@nagarro.com wrote:
Thanks Milosz, I am not getting error anymore. But my job is still not able to take the value. Please find the test action I tried :
- test: timeout: minutes: 5 definitions:
- repository: https://lava_test_token:%24%7BGIT_TOKEN%7D@gitlab.com/testing/lava-tests.githttps://lava_test_token:$%7BGIT_TOKEN%7D@gitlab.com/testing/lava-tests.git from: git path: tests/cisscan/cis.yaml branch: lava-pipeline name: cis-benchmark
Is there way to call the value in job like in context or environment?
I hoped this line did the trick: https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.com...https://gitlab.com/lava/lava/-/blob/master/lava_dispatcher/utils/vcs.py?ref_type=heads#L57
In your job log you should see the line: Running '/usr/bin/git clone --depth=1 https://apc01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgithub.com%...http://github.com/linaro/test-definitions.git /var/lib/lava/dispatcher/tmp/50453/lava-overlay-eysulgb5/home/ Obviously the URL and path will be different, but this should print the command _before_ variable substitution. You can experiment with vcs.py and move the debug line below the substitution. This way you will know whether the environment was passed properly to the GitHelper.
I don't know any other tricks, sorry.
Best Regards, Milosz
Thanks, Sweta
From: Milosz Wasilewski milosz.wasilewski@foundries.io Sent: Thursday, August 29, 2024 2:04 PM To: Sweta Ghosh sweta.ghosh@nagarro.com Cc: lava-users@lists.lavasoftware.org lava-users@lists.lavasoftware.org Subject: Re: [lava-users] Not able to set variable
[Email from a non-Nagarro source: please exercise caution with links and attachments]
On Thu, Aug 29, 2024 at 9:31 AM Sweta Ghosh sweta.ghosh@nagarro.com wrote:
Hello Milosz,
Thanks for replying.
I have a single node setup, so worker and server is same. I updated /etc/lava-server/env.yaml file with GIT_TOKEN value like below. But I get error Invalid yaml when I execute job: root@debian:~# cat /etc/lava-server/env.yaml # Configure the environment that will be used within the server and the dispatcher.
# If set to true, all variables inherited by the process will be dropped. # The process environment is then fully controlled but you should then list all # variables that your process needs. purge: true
# List the variables that will be removed from the inherited environment. # If purge is 'true', this list is useless. # default: empty list #removes: #- HTTP_PROXY #- HTTPS_PROXY #- FTP_PROXY #- NO_PROXY
# A dictionary of (key, value) that will be added to the inherited environment. # If a key does not already exist in the inherited environment, it's added. # default: an empty dictionary overrides: LC_ALL: C.UTF-8 LANG: C # http_proxy: http://lava-lab-proxy # https_proxy: http://lava-lab-proxy # ftp_proxy: http://lava-lab-proxy PATH: /usr/local/bin:/usr/local/sbin:/bin:/usr/bin:/usr/sbin:/sbin GIT_TOKEN=abcd
It needs to be a valid YAML. You need to align the indentation with other variables in "overrides" section. Also use GIT_TOKEN: "<token value>" instead of "="
Best Regards, Milosz