mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 02:05:41 +01:00
Merge pull request #14124 from danfengliu/reschedule-docker-login-policy-in-build-base-image-in-master
Reschedule docker login policy in base image build process
This commit is contained in:
commit
9e3f0de12c
10
Makefile
10
Makefile
@ -251,8 +251,8 @@ HARBORPKG=harbor
|
||||
# pushimage
|
||||
PUSHSCRIPTPATH=$(MAKEPATH)
|
||||
PUSHSCRIPTNAME=pushimage.sh
|
||||
REGISTRYUSER=user
|
||||
REGISTRYPASSWORD=default
|
||||
REGISTRYUSER=
|
||||
REGISTRYPASSWORD=
|
||||
|
||||
# cmds
|
||||
DOCKERSAVE_PARA=$(DOCKER_IMAGE_NAME_PREPARE):$(VERSIONTAG) \
|
||||
@ -411,8 +411,14 @@ build_standalone_db_migrator: compile_standalone_db_migrator
|
||||
make -f $(MAKEFILEPATH_PHOTON)/Makefile _build_standalone_db_migrator -e BASEIMAGETAG=$(BASEIMAGETAG) -e VERSIONTAG=$(VERSIONTAG)
|
||||
|
||||
build_base_docker:
|
||||
if [ -n "$(REGISTRYUSER)" ] && [ -n "$(REGISTRYPASSWORD)" ] ; then \
|
||||
docker login -u $(REGISTRYUSER) -p $(REGISTRYPASSWORD) ; \
|
||||
else \
|
||||
echo "No docker credentials provided, please make sure enough priviledges to access docker hub!" ; \
|
||||
fi
|
||||
@for name in chartserver trivy-adapter core db jobservice log nginx notary-server notary-signer portal prepare redis registry registryctl; do \
|
||||
echo $$name ; \
|
||||
sleep 30 ; \
|
||||
$(DOCKERBUILD) --pull --no-cache -f $(MAKEFILEPATH_PHOTON)/$$name/Dockerfile.base -t $(BASEIMAGENAMESPACE)/harbor-$$name-base:$(BASEIMAGETAG) --label base-build-date=$(date +"%Y%m%d") . && \
|
||||
if [ -n "$(PUSHBASEIMAGE)" ] ; then \
|
||||
$(PUSHSCRIPTPATH)/$(PUSHSCRIPTNAME) $(BASEIMAGENAMESPACE)/harbor-$$name-base:$(BASEIMAGETAG) $(REGISTRYUSER) $(REGISTRYPASSWORD) || exit 1; \
|
||||
|
@ -99,21 +99,6 @@ set -e
|
||||
# - https://docs.docker.com/reference/commandline/cli/#logout
|
||||
# ---------------------------
|
||||
|
||||
# Login to the registry
|
||||
h2 "Login to the Docker registry"
|
||||
|
||||
DOCKER_LOGIN="docker login --username $USERNAME --password $PASSWORD $REGISTRY"
|
||||
info "docker login --username $USERNAME --password *******"
|
||||
DOCKER_LOGIN_OUTPUT=$($DOCKER_LOGIN)
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
warn "$DOCKER_LOGIN_OUTPUT"
|
||||
error "Login to Docker registry $REGISTRY failed"
|
||||
exit 1
|
||||
else
|
||||
success "Login to Docker registry $REGISTRY succeeded";
|
||||
fi
|
||||
|
||||
# Push the docker image
|
||||
h2 "Pushing image to Docker registry"
|
||||
|
||||
@ -127,16 +112,3 @@ if [ $? -ne 0 ];then
|
||||
else
|
||||
success "Pushing image $IMAGE succeeded";
|
||||
fi
|
||||
|
||||
# Logout from the registry
|
||||
h2 "Logout from the docker registry"
|
||||
DOCKER_LOGOUT="docker logout $REGISTRY"
|
||||
DOCKER_LOGOUT_OUTPUT=$($DOCKER_LOGOUT)
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
warn "$DOCKER_LOGOUT_OUTPUT"
|
||||
error "Logout from Docker registry $REGISTRY failed"
|
||||
exit 1
|
||||
else
|
||||
success "Logout from Docker registry $REGISTRY succeeded"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user