Sweta,
On Thu, Aug 29, 2024 at 6:19 AM sweta.ghosh@nagarro.com wrote:
Hi, I want clone a gitlab repo with id and token during job execution. To hide the token I am passing the value in my job. How can I export the value of GIT_TOKEN in environment file of LAVA? So that whenever job is executed it will read the value from its environment file. I tried to use export and tried to add "GIT_TOKEN=abcd" in env.yaml file. But I guess its not correct format. I couldn't find what kind of values we can add in env.yaml in documents. I also added GIT_TOKEN value in /etc/profile of the LAVA server still the job didn't pick it. Could you please suggest how can we clone the repo in LAVA job without exposing its password. Also I understand that ssh key of root will work but I want to avoid using ssh key of root. Kindly suggest
Jobs are executed on the dispatcher. Unless your server and dispatcher run on the same machine, setting environment on server won't do the trick.
- test: timeout: minutes: 15 definitions:
- repository: https://gitid:%24GIT_TOKEN@gitlab.com/lava-tests.git from: git path: tests/cisscan/cis.yaml branch: pipeline name: cis-benchmark
The docs say that you can override some env variables of the job using env.yaml file: https://validation.linaro.org/static/docs/v2/proxy.html There are 2 options: - /etc/lava-server/env.yaml - for all workers - /etc/lava-server/dispatcher.d/<name>/env.yaml - for selected worker only In this case it talks about HTTP_PROXY, but I believe you can set GIT_TOKEN there. I don't know if it's going to work. Best to try and report back :)
Your only other option is limiting the job visibility to "personal" or "group". This way the job data won't be available to the world and you can use the token in the definition. It's not an ideal solution, but I don't think there is a better one available.
Best Regards, Milosz
lava-users mailing list -- lava-users@lists.lavasoftware.org To unsubscribe send an email to lava-users-leave@lists.lavasoftware.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s