Commit bfe0b0fe authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch '51450-vendor-refactor-registry-login' into 'master'

Vendor Auto-DevOps.gitlab-ci.yml for refactor to create registry_login() function.

Closes #51450

See merge request gitlab-org/gitlab-ce!21714
parents 12688984 97ad3f91
---
title: Vendor Auto-DevOps.gitlab-ci.yml to refactor registry_login
merge_request: 21714
author: Laurent Goderre @LaurentGoderre
type: changed
...@@ -451,12 +451,16 @@ rollout 100%: ...@@ -451,12 +451,16 @@ rollout 100%:
# Extract "MAJOR.MINOR" from CI_SERVER_VERSION and generate "MAJOR-MINOR-stable" for Security Products # Extract "MAJOR.MINOR" from CI_SERVER_VERSION and generate "MAJOR-MINOR-stable" for Security Products
export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/') export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
function container_scanning() { function registry_login() {
if [[ -n "$CI_REGISTRY_USER" ]]; then if [[ -n "$CI_REGISTRY_USER" ]]; then
echo "Logging to GitLab Container Registry with CI credentials..." echo "Logging to GitLab Container Registry with CI credentials..."
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY" docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
echo "" echo ""
fi fi
}
function container_scanning() {
registry_login
docker run -d --name db arminc/clair-db:latest docker run -d --name db arminc/clair-db:latest
docker run -p 6060:6060 --link db:postgres -d --name clair --restart on-failure arminc/clair-local-scan:v2.0.1 docker run -p 6060:6060 --link db:postgres -d --name clair --restart on-failure arminc/clair-local-scan:v2.0.1
...@@ -700,11 +704,7 @@ rollout 100%: ...@@ -700,11 +704,7 @@ rollout 100%:
} }
function build() { function build() {
if [[ -n "$CI_REGISTRY_USER" ]]; then registry_login
echo "Logging to GitLab Container Registry with CI credentials..."
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
echo ""
fi
if [[ -f Dockerfile ]]; then if [[ -f Dockerfile ]]; then
echo "Building Dockerfile-based application..." echo "Building Dockerfile-based application..."
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment