ppodgorsek / docker-robot-framework

Robot Framework in Docker
https://cloud.docker.com/repository/docker/ppodgorsek/robot-framework
MIT License
333 stars 235 forks source link

Need help in passing AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_SESSION_TOKEN to run tests on AWS Kubernetes Cluster #428

Closed parameswarank closed 1 year ago

parameswarank commented 1 year ago

Hello,

I need to run tests on Kubernetes cluster and it works with your docker image when i try on local machine as i have all the AWS config, credentials file and KUBECTL config stored on my local machine but when i try to run the same on Jenkins pipeline it fails as the docker image is not having AWS config file and KUBECTL config on the image. So as per the suggestion from this link https://awslimitchecker.readthedocs.io/en/latest/docker.html#aws-credential-environment-variables i tried using the below command but it is unable to run kubectl commands.

Docker command

docker run --rm --user=root -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
    -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
    -e AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN \
    -v /var/lib/jenkins/workspace/reports:/opt/robotframework/reports:Z \
    -v /var/lib/jenkins/workspace/tests:/opt/robotframework/tests:Z \
    -v /var/lib/jenkins/workspace/resources:/opt/robotframework/resources:Z \
         1234.dkr.ecr.us-east-1.amazonaws.com/tests/robot:latest

Error

+ docker run --rm --user=root -e AWS_ACCESS_KEY_ID=ABCDEFGHIJKNL
"docker run" requires at least 1 argument.
See 'docker run --help'.

Usage:  docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

Run a command in a new container

Any help on this is really appreciated.

Thanks in advance.

parameswarank commented 1 year ago

Finally i found the issue and it was due to additional line added to AWS ACCESS KEY variable.

Here is the solution amazon web services - aws s3 ls: An HTTP Client raised an unhandled exception: Invalid header value - Stack Overflow