add environment variable add network_type env

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
This commit is contained in:
stonezdj 2025-06-17 15:20:20 +08:00
parent f46ef3b38d
commit e84fd0da4d
No known key found for this signature in database
GPG Key ID: 869A6492598C9031
2 changed files with 19 additions and 2 deletions

View File

@ -3,5 +3,6 @@
HARBOR_SRC_FOLDER=$(realpath ../../)
echo ${HARBOR_SRC_FOLDER}
docker run -it --privileged -v /var/log/harbor:/var/log/harbor -v /etc/hosts:/etc/hosts -v ${HARBOR_SRC_FOLDER}:/drone -v ${HARBOR_SRC_FOLDER}/tests/harbor_ca.crt:/ca/ca.crt -v /dev/shm:/dev/shm -w /drone registry.goharbor.io/harbor-ci/goharbor/harbor-e2e-engine:latest-ui /bin/bash
# If the testbed network type is private need to set NETWORK_TYPE private, default is public
docker run -it --privileged -v /var/log/harbor:/var/log/harbor -v /etc/hosts:/etc/hosts -v ${HARBOR_SRC_FOLDER}:/drone -v ${HARBOR_SRC_FOLDER}/tests/harbor_ca.crt:/ca/ca.crt -v /dev/shm:/dev/shm -e NETWORK_TYPE=public -w /drone registry.goharbor.io/harbor-ci/goharbor/harbor-e2e-engine:latest-ui /bin/bash

View File

@ -17,6 +17,12 @@ Documentation This resource provides helper functions for docker operations
Library OperatingSystem
Library Process
*** Variables ***
# Define variables for start dockerd within private network
${DOCKERD_CMD} dockerd
${DOCKERD_ARGS} --iptables=false
${LOG_FILE} ./docker-daemon.log
*** Keywords ***
Run Docker Info
[Arguments] ${docker-params}
@ -115,12 +121,22 @@ Get Container IP
# docker:1.13-dind
# If you are running this keyword in a container, make sure it is run with --privileged turned on
Start Docker Daemon Locally
${test_network_type}= Get Environment Variable NETWORK_TYPE public
Log To Console current ${test_network_type}
${pid}= Run pidof dockerd
#${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/docker_config.sh
#Log ${output}
#Should Be Equal As Integers ${rc} 0
#Should Be Equal As Integers ${rc} 0ex
Return From Keyword If '${pid}' != '${EMPTY}'
OperatingSystem.File Should Exist /usr/local/bin/dockerd-entrypoint.sh
${handle}= Set Variable ""
IF '${test_network_type}' == 'private'
Log To Console network type is private
${handle}= Start Process ${DOCKERD_CMD} ${DOCKERD_ARGS} stdout=${LOG_FILE} stderr=${LOG_FILE} shell=Tr
ELSE IF '${test_network_type}' == 'public'
Log To Console network type is public
${handle}= Start Process /usr/local/bin/dockerd-entrypoint.sh dockerd>./daemon-docker-local.log 2>&1 shell=True
END
${handle}= Start Process /usr/local/bin/dockerd-entrypoint.sh dockerd>./daemon-local.log 2>&1 shell=True
Process Should Be Running ${handle}
FOR ${IDX} IN RANGE 5