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:${GIT_TOKEN}@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%2Flava%2Flava%2F-%2Fblob%2Fmaster%2Flava_dispatcher%2Futils%2Fvcs.py%3Fref_type%3Dheads%23L57&data=05%7C02%7Csweta.ghosh%40nagarro.com%7C7b3d2b70d5f14b750e8208dcc80e936e%7Ca45fe71af4804e42ad5eaff33165aa35%7C0%7C0%7C638605212156722386%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=4ZrSv6MBZITeCCzmQlOXz2v6wnmisUd62%2FCaenVnlKk%3D&reserved=0

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%2Flinaro%2Ftest-definitions.git&data=05%7C02%7Csweta.ghosh%40nagarro.com%7C7b3d2b70d5f14b750e8208dcc80e936e%7Ca45fe71af4804e42ad5eaff33165aa35%7C0%7C0%7C638605212156734717%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=k5BM2k6nZ%2FuuYOdIcuy0vIhCHoZJFbLoug2LNXZrHYs%3D&reserved=0
/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