[ad_1]
I’m running a pipeline on gitlab which uses .gitlab-ci.yml and Dockerfile to build a image and push it to GCP container repository. Then I use that image to make deployment on Kubernetes.
I’m using CI/CD private variables to inject username(service_now_qa_username) and password(service_now_qa_password) and passing it as arguments to docker build command which are then used in Dockerfile
This is what my gitlab-ci.yml file looks like
variables:
BUILD_ARGS: "--build-arg USERNAME=$service_now_qa_username --build-arg PASSWORD=$service_now_qa_password"
script:
- docker build -t "$IMAGE_NAME:$CI_COMMIT_REF_NAME" -t "$IMAGE_NAME:latest" $BUILD_ARGS .
This is what my Dockerfile looks like:
ARG USERNAME
ARG PASSWORD
ENV USER=$USERNAME
ENV PASS=$PASSWORD
ENTRYPOINT java -jar servicenowapi.jar -conf config.json -username ${USER} -password ${PASS}
Now I want to override these arguments of username and password using Kubernetes Deployment.yml and use Deployment.yaml file to override these arguments.
My end goal is to use Kubernetes Deployment.yaml for username and password and passed as arguments to Dockerfile.
[ad_2]