shubhamagiwal92
shubhamagiwal92

Reputation: 1432

aws command not found error even after installing aws cli on jenkins windows slave when running a jenkins job

I have installed AWS CLI on my windows slave in Jenkins. To verify the same, I run the following command in the command line of the windows machine and get this as the output

C:> aws --version
aws-cli/1.11.122 Python/2.7.9 Windows/2008ServerR2 botocore/1.5.85

I am running an aws cli command in the execute windows batch command in the jenkins job and the job is failing for the following reason

C:\Users\ADMINI~1\AppData\Local\Temp\2\hudson1929374596375903011.sh: line 6: 
aws: command not found
Build step 'Execute shell' marked build as failure

The aws command I am running is

aws cloudformation validate-template --template-body file://file1.json

I also checked the PATH variable on the windows machine and it contains AWSCLI path.

My goal is to run AWS CLI command via Jenkins job. Can somebody help me with this?

Upvotes: 2

Views: 8099

Answers (1)

Hammett
Hammett

Reputation: 385

It's possible that Jenkins has a different %PATH% than when you are logged in.

Try finding your path via jenkins. Create a job and in the script that runs echo out your %PATH% to see what jenkins' thinks your path is.

You can modify Jenkins' environment variables, including %PATH%, see https://stackoverflow.com/a/5819768/8207662

Upvotes: 3

Related Questions