All components had been installed correctly (helm, ingress, certmanager…etc) but when i try to run the pipeline and deploy i get the error.
The namespace was created in rancher with that config.
You are following the AutoDevOps template from Gitlab.
You have to know that you need to put all the necessary variables available for your jobs to succeed like an kubernetes integration per project.
Or you can tweak it a bit to fit your need in a smallest way.
Recently i managed to have an image update on a deployement using another docker image with Rancher_url et Rancher_token (for example) in order to first log into the rancher than to run my kubectl command.
I used this link from Stackoverflow as reference than i build two new function on the gitlab-ci.yml file named rancher_connect and rancher_update.
function rancher_connect() {
if [[ "$RANCHER_API_TOKEN" && "$RANCHER_SERVER_URL" && "$RANCHER_SERVER_CONTEXT" ]]; then
echo "Logging to Rancher with CI credentials..."
rancher login "$RANCHER_SERVER_URL" -t "$RANCHER_API_TOKEN" --context "$RANCHER_SERVER_CONTEXT"
echo ""
else
echo "Error during login - check that you have variables set on the project level"
fi
}
function rancher_update() {
rancher kubectl YOUR STUFF HERE (from a file or full command line)
sleep 15
rancher kubectl YOUR STUFF HERE (from a file or full command line)
}
Hi, that solutions doesn’t work for me, i pass project id in context, like “c-42fm9:p-gdr2q”, if i don’t pass context fail with a message showing me the list of projects…anyone can help me please.
My use case is using this inside a .gitlab-ci.yml, like this: