1

I need to set an environment variable from a Groovy script, the value of the env var should be produced with the AWS CLI, my command

def proc ='aws codeartifact get-authorization-token --region=eu-central-1 --domain companyname --domain-owner accountnumber --query authorizationToken --output text'.execute()
env.CODEARTIFACT_AUTH_TOKEN = proc.in.text

But I get an error message

10:59:47  Caused: java.io.IOException: Cannot run program "aws": error=2, No such file or directory

I am new to Groovy and looking around for solutions, any tips in the meanwhile?

1
  • What is your operating system? AWS CLI version? Commented Mar 2, 2022 at 14:47

1 Answer 1

0

Your path variable maybe wrong. Check it by

println System.getenv('PATH')

then fix it.

Sign up to request clarification or add additional context in comments.

1 Comment

its already in the path, if i ssh to the host and try running aws commands it works

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.