From aa0ce5b75eed65fc7ce009da76c68bc66613e91f Mon Sep 17 00:00:00 2001 From: Tigran Mkrtchyan Date: Fri, 11 Aug 2023 14:58:46 +0200 Subject: [PATCH] ci: add publishing to github --- .gitlab-ci.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b0bd86114c3..841ec4caab5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,6 +11,11 @@ # PKG_UPLOAD_USER: user name to use for authorization # PKG_UPLOAD_PASS: password # +# DOCKER_HUB_USER: user name on docker hub +# DOCKER_HUB_ACCESS_KEY: Access Key or Password of the docker user +# +# +# # KUBECONFIG: env file that contains kubernetes configuration to access the cluster # # dCache deplyment in kubernetes managed by helm chart @@ -255,6 +260,33 @@ upload_tar: - VERSION=`echo $TAR_NAME | cut -d'-' -f 2 | cut -d'.' -f 1,2` - curl -u $PKG_UPLOAD_USER:$PKG_UPLOAD_PASS --upload-file packages/tar/target/$TAR_NAME --ftp-create-dirs "$PKG_UPLOAD_URL/$VERSION/$TAR_NAME" + +upload_container: + stage: upload + # Cache downloaded dependencies and plugins between builds. + # To keep cache across branches add 'key: "$CI_JOB_NAME"' + # For latest releases see https://github.com/GoogleContainerTools/kaniko/releases + # Only debug/*-debug versions of the Kaniko image are known to work within Gitlab CI + image: gcr.io/kaniko-project/executor:debug + needs: ["tar"] + when: manual + script: + - |- + tag=$CI_COMMIT_SHORT_SHA + if [[ -n "$CI_COMMIT_TAG" ]]; then + tag=$CI_COMMIT_TAG + fi + - mkdir maven + - tar -C maven --strip-components=1 -xzvf packages/tar/target/dcache-*.tar.gz + - cp $CI_PROJECT_DIR/packages/tar/src/main/container/* . + - ls -l + - mkdir -p /kaniko/.docker + - echo "{\"auths\":{\"https://index.docker.io/v1/\":{\"username\":\"$DOCKER_HUB_USER\",\"password\":\"$DOCKER_HUB_ACCESS_KEY\"}}}" > /kaniko/.docker/config.json + - > + /kaniko/executor + --context $CI_PROJECT_DIR + --dockerfile $CI_PROJECT_DIR/Dockerfile + --destination dcache/dcache:$tag # # prepare kubernetes env for the build #