Kaniko --destination parameter not recognized even though it is valid
I have a Gitlab-CI pipeline and I am facing an error on kaniko push despite the fact that the destination is valid :
Checking cache for kaniko-cache-non_protected... No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted. Successfully extracted cache Downloading artifacts 00:01 Downloading artifacts for publish_job (37473)... Downloading artifacts from coordinator... ok id=37473 responseStatus=200 OK token=dthzyEd- Executing "step_script" stage of the job script 00:02 $ echo "checking dockerfile existence" # collapsed multi-line command checking dockerfile existence dockerfile doesn't exist. Trying to create a new dockerfile from csproj. /builds/group1/devops/labs /builds/group1/devops/labs/src RegistrationAPI.dll dockerfile created /builds/group1/devops/labs/src dockerfile successfully generated. Proceeding with kaniko push starting kaniko push dockerfile successfully copied registry.zw.golide.com/group1/devops/labs:dev-latest
This is the accompanying script :
`docker_build_dev: tags: - labs image: name: gcr.io/kaniko-project/executor:v1.6.0-debug entrypoint: [""] only: - ingress cache: key: kaniko-cache paths: - ./cache/ stage: docker before_script:
-
'' script: | echo "checking dockerfile existence" if ! [ -e Dockerfile ]; then echo "dockerfile doesn't exist. Trying to create a new dockerfile from csproj." pwd cd ./src echo "$PWD" docker_entrypoint=$(grep -m 1 AssemblyName $PWD/.csproj | sed -r 's/\s<[^>]*>//g' | sed -r 's/\r$//g').dll echo "${docker_entrypoint}" cat > Dockerfile << EOF FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base WORKDIR /app COPY ./publish .
RUN apt-get update && apt-get install -y wget
ENTRYPOINT dotnet $docker_entrypoint EOF echo "dockerfile created" else echo "dockerfile exists" fi
if [ -e Dockerfile ]; then echo "$PWD" echo "dockerfile successfully generated. Proceeding with kaniko push" echo "starting kaniko push" DEVTAG="dev-latest" cp Dockerfile ${CI_PROJECT_DIR}/Dockerfile cd ${CI_PROJECT_DIR} if [ -e Dockerfile ]; then echo "dockerfile successfully copied" fi mkdir -p /kaniko/.docker destination="${CI_REGISTRY_IMAGE}:$DEVTAG" echo "$destination" echo "{"auths":{"${CI_REGISTRY}":{"auth":"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')"}}}" > /kaniko/.docker/config.json
/kaniko/executor --context "${CI_PROJECT_DIR}" --dockerfile "${CI_PROJECT_DIR}/Dockerfile" --destination "$destination" fi
`
What is baffling is that the destination that is being output is valid and it was working(pushing successfully) before on this slightly configuration:
docker_build_dev: tags: - orion image: name: gcr.io/kaniko-project/executor:v1.6.0-debug entrypoint: [""] only: - develop - unittests stage: docker before_script: - echo "Docker build" variables: DEV_TAG: dev-latest script: - echo "${CI_PROJECT_DIR}" - cp ./src/Dockerfile /builds/group1/devops/labs/Dockerfile - mkdir -p /kaniko/.docker - echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json - >- /kaniko/executor --context "${CI_PROJECT_DIR}" --dockerfile "${CI_PROJECT_DIR}/Dockerfile" --destination "${CI_REGISTRY_IMAGE}:${DEV_TAG}"
Is there anything I am missing in the updated script that could now be making the destination to be invalid ?
The only changes I have made is to dynamically generate the Dockerfile and to alter the script a bit .
What exactly am I missing ?