Process not started

using withEnv, trying to login & perform some activity i azure environment.
pipelineSteps.withEnv([‘PATH=$env.PATH:/usr/bin/az’]) { “”"
az version
Getting an error on process:
process apparently never started in /var/lib/jenkins/workspace/my-test-deployment@tmp/durable-3f57ca09

Plugins installed for az.

Can you try something like this?

pipelineSteps.withEnv(['PATH+AZURE=/usr/bin/az']) { """
    az version

got an error for az :
az: not found

Next step should be to do an ls to see if the command is there. Otherwise, we’ll need a lot more information in order to help.

yes, for “ls” also getting the same error

process apparently never started 

If /usr/bin/az is a command, not a directory, you probably don’t need to add it to the path, since the PATH is for directories, not specific commands. Please try removing with withEnv and just have th command and see if it works (or try an ls in the sh).

without Env, I can able to see ls or pwd .
If I try same with az or which az, then getting an error

+ az
/var/jenkins_home/workspace/test/my-test-deploy@tmp/durable-6ef509f0/ 3: az: not found

any solution for this ?

tried to install az cli

+ apt install azure-cli

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

You need to look up how to install those tools on your agent. Normally, apt requires root permissions which the agent is probably not running as root (and should not be).

hm, I installed jenkins using helm charts. Is there any way to provide sudo permission while installing via helm charts ?

I don’t often use the word no, but no. The docker container specifically doesn’t run as root, runs as a user. You can tell kubernetes to run it as root (which I won’t help with and strongly discourage), but to add sudo you’d need to be root, and at that point, you don’t need sudo.

The solution is the same as when you asked it in your previous thread.

Extend the container, add what you need, and then use that container in helm.

1 Like