I implemented the following setup for gitlab-ci, in my gitlab community environment
I am using version:
I have a “build” stage in which I build a docker image and pushes it to gitlab registry
and I have a “test” stage after the build stage in which I pull the image (I built in previous stage) and test it.
I am using this setup for a while, but recently I started to have some problems, on the build stage I keep getting
unauthorized: authentication required for pushing and the push itself takes a very long time.
My gut feeling is telling me that the reason I am getting the
unauthorized: authentication required is because push takes a lot of time, and the ci-token is getting invalidated.
The push job looks like this:
build_image: stage: build script: - "docker build --pull -t $CONTAINER_REF_IMAGE ." - "docker push $CONTAINER_REF_IMAGE"
I had to solve it, so I started to:
- delete images from the registry
- restart gitlab
- use new runers
I don’t know which of the above helped, if any.
Actually I am kind of lost here,
- Am I doing something wrong? pushing so many images? (we re practicing CD)
- How do I delete old images without using the UI maybe as part of a “cleanup” stage in the gitlab-ci.yml
- And important of all, why am I getting this error
Any help will be appreciated.