[tracker-oci-images/sam/podman: 6/7] Use correct credentials to push the image



commit aae0685621ab816088e8a1477f4a691b0ace1ea0
Author: Sam Thursfield <sam afuera me uk>
Date:   Wed Dec 11 11:42:07 2019 +0100

    Use correct credentials to push the image
    
    Following GitLab's documentation, the 'gitlab-ci-token' user only has
    read access to the registry.  Let's use $CI_REGISTRY_USER instead.
    
    Based on https://gitlab.gnome.org/help/ci/docker/using_docker_build.md#container-registry-examples
    
    For some reason, using `buildah login` doesn't work, but specifying
    the credentials when we run `podman push` does.

 .gitlab-ci.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 90a7ad4..4bd046c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -13,14 +13,14 @@ variables:
 .base:
   script:
     - dnf install -y buildah podman
-    - buildah login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
+    - buildah login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
 
     # Newer versions of podman/buildah try to set overlayfs mount options when
     # using the vfs driver, and this causes errors.
     - sed -i '/^mountopt =.*/d' /etc/containers/storage.conf
 
     - podman build --cgroup-manager=cgroupfs --format=docker --pull -f ${DOCKERFILE} -t ${IMAGE} 
${CONTEXT_DIR}
-    - podman push ${IMAGE}
+    - podman push --creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD ${IMAGE}
 
 # Expects $ARCH variable which should be the architexcture of the image ex. x86_64
 # Expects $DISTRO_NAME variable which should be the name of the distro image ex. ubuntu


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]