first of all sorry I come from Jenkins now to gitlab-ci
I have some struggle. I tried to migrate my jenkins pipeline scripts into gitlab ci.
Most of all works great. I want to build an docker image with the existing Dockerfile and push the image to the gitlab registry. All works fine, but how can I delete all content after an run as post tasks.
I want to ensure that every run starts from scratch without old data, artifacty, docker layers or something else.
In Jenkins the functions name cleanWs() https://jenkins.io/doc/pipeline/steps/ws-cleanup/
How can I reach this here …
variables: build_image: stage: build script: - docker login $CI_REGISTRY -u cryptolukas -p $PERS_TOKEN - docker build -t $CI_REGISTRY_IMAGE:$CI_BUILD_ID . - docker push $CI_REGISTRY_IMAGE:$CI_BUILD_ID - docker tag $CI_REGISTRY_IMAGE:$CI_BUILD_ID $CI_REGISTRY_IMAGE:latest - docker push $CI_REGISTRY_IMAGE:latest - docker image prune -fa