I'm running Jenkins Configuration as code using Kubernetes
I'm trying to find a way to run commands right after the pod starts.
- I have tried adding the commands using CMD/RUN using && and it didn't work.
- I have tried to change the ENTRYPOINT of the image, but in jenkins kubernetes it overrides the entrypoint with SLEEP command.
- I have tried to add PostStart commands to the pod, I couldn't find any way to add it since Jenkins Kubernetes doesn't support it.
Image layer I tried -
RUN OUT=$(aws sts assume-role --role-arn arn:aws:iam:::role/jenkins-role-session-name jenkins) && \
AWS_ACCESS_KEY_ID=$(echo $OUT | jq -r '.Credentials''.AccessKeyId') && \
AWS_SECRET_ACCESS_KEY=$(echo $OUT | jq -r '.Credentials''.SecretAccessKey') && \
AWS_SESSION_TOKEN=$(echo $OUT | jq -r '.Credentials''.SessionToken') && \
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID && \
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY && \
aws configure set aws_session_token $AWS_SESSION_TOKEN && \