diff --git a/documentation/chapters/templates/container/container-publish.adoc b/documentation/chapters/templates/container/container-publish.adoc index 32bf360..744ceb3 100644 --- a/documentation/chapters/templates/container/container-publish.adoc +++ b/documentation/chapters/templates/container/container-publish.adoc @@ -8,9 +8,10 @@ Needs a build container on the path `image.tar`. Use one of the Container build .Variables |=== |Name |Description | Default Value -| CONTAINER_REGISTRY | Url to the remote Registry | $CI_REGISTRY_IMAGE +| CONTAINER_REGISTRY | The address of the Container Registry | $CI_REGISTRY +| CONTAINER_REGISTRY_IMAGE | The address of the project’s Container Registry. | $CI_REGISTRY_IMAGE | CONTAINER_REGISTRY_USER | the user that should be used | $CI_REGISTRY_USER -| CONTAINER_REGISTRY_PASSWORD | the passwort for the remote registry | $CI_REGISTRY_PASSWORD +| CONTAINER_REGISTRY_PASSWORD | the password for the remote registry | $CI_REGISTRY_PASSWORD | EXTRA_PATH | Extra path that should be between the registry path and the image tag | "" | IMAGE_TAG | the Tag the image should be found on | Depends on the current path. Look at the rules of the Job. |=== diff --git a/templates/container/container-build.gitlab-ci.yml b/templates/container/container-build.gitlab-ci.yml index 33a776d..e24c162 100644 --- a/templates/container/container-build.gitlab-ci.yml +++ b/templates/container/container-build.gitlab-ci.yml @@ -30,8 +30,14 @@ entrypoint: [ "" ] variables: DOCKERFILE_LOCATION: $CI_PROJECT_DIR/Dockerfile - REGISTRY_MIRROR: --registry-mirror nexus.corp.exxcellent.de:18000 --skip-tls-verify-registry nexus.corp.exxcellent.de:18000 --skip-tls-verify + REGISTRY_MIRROR: --registry-mirror nexus.corp.exxcellent.de:18000 --skip-tls-verify-registry nexus.corp.exxcellent.de:18000 script: - - mkdir -p /kaniko/.docker - - echo "{\"auths\":{\"$DOCKER_REGISTRY\":{\"username\":\"$DOCKER_REGISTRY_USER\",\"password\":\"$DOCKER_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json - - /kaniko/executor --context $CONTEXT_LOCATION --dockerfile $DOCKERFILE_LOCATION --no-push --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA $EXTRA_ARGS $REGISTRY_MIRROR --tarPath image.tar + - >- + /kaniko/executor + --context $CONTEXT_LOCATION + --dockerfile $DOCKERFILE_LOCATION + --no-push + --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA + $EXTRA_ARGS + $REGISTRY_MIRROR + --tarPath image.tar diff --git a/templates/container/container-publish.gitlab-ci.yml b/templates/container/container-publish.gitlab-ci.yml index b249aba..2de3b57 100644 --- a/templates/container/container-publish.gitlab-ci.yml +++ b/templates/container/container-publish.gitlab-ci.yml @@ -4,7 +4,8 @@ name: quay.io/containers/skopeo:v1.5.2 entrypoint: [ "" ] variables: - CONTAINER_REGISTRY: $CI_REGISTRY_IMAGE + CONTAINER_REGISTRY: $CI_REGISTRY + CONTAINER_REGISTRY_IMAGE: $CI_REGISTRY_IMAGE CONTAINER_REGISTRY_USER: $CI_REGISTRY_USER CONTAINER_REGISTRY_PASSWORD: $CI_REGISTRY_PASSWORD EXTRA_PATH: "" @@ -22,7 +23,7 @@ EXTRA_PATH: "/feat/$CI_COMMIT_REF_NAME" - when: never script: - - skopeo login --username $CONTAINER_REGISTRY_USER --password $CONTAINER_REGISTRY_PASSWORD $CONTAINER_REGISTRY --tls-verify=false - - skopeo copy "docker-archive:image.tar" "docker://${CONTAINER_REGISTRY}${EXTRA_PATH}:${IMAGE_TAG}" --dest-tls-verify=false + - skopeo login --username $CONTAINER_REGISTRY_USER --password $CONTAINER_REGISTRY_PASSWORD $CONTAINER_REGISTRY_IMAGE --tls-verify=false + - skopeo copy "docker-archive:image.tar" "docker://${CONTAINER_REGISTRY_IMAGE}${EXTRA_PATH}:${IMAGE_TAG}" --dest-tls-verify=false #TODO wir müssen noch den aktuell Tag bekommen damit wir den setzen können. (in default oder feat ausgeführt wird) \ No newline at end of file