Merge pull request #8530 from danfengliu/get-ca-from-harbor-api

After helm cli test was added to nightly, ca was get by reading from …
This commit is contained in:
Wang Yan 2019-08-06 14:00:41 +08:00 committed by GitHub
commit 4f7e225e69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 28 deletions

View File

@ -8,7 +8,7 @@ import replication
import repository
import swagger_client
class Harbor(project.Project, label.Label,
class Harbor(project.Project, label.Label,
registry.Registry, replication.Replication,
repository.Repository):
pass

View File

@ -51,7 +51,7 @@ def _get_string_from_unicode(udata):
return result
class Base:
def __init__(self,
def __init__(self,
server = Server(endpoint="http://localhost:8080/api", verify_ssl=False),
credential = Credential(type="basic_auth", username="admin", password="Harbor12345"),
debug = True):

View File

@ -14,7 +14,7 @@ class Registry(base.Base):
username=username, password=password, insecure=insecure)
_, _, header = client.targets_post_with_http_info(registry)
return base._get_id_from_header(header), name
def get_registry_id_by_endpoint(self, endpoint, **kwargs):
client = self._get_client(**kwargs)
registries = client.targets_get()

View File

@ -6,31 +6,6 @@ import base
import swagger_client
class Replication(base.Base):
def create_replication_rule(self,
projectIDList, targetIDList, name=None, desc="",
filters=[], trigger=swagger_client.RepTrigger(kind="Manual"),
replicate_deletion=True,
replicate_existing_image_now=False,
expect_status_code = 201,
**kwargs):
if name is None:
name = base._random_name("rule")
projects = []
for projectID in projectIDList:
projects.append(swagger_client.Project(project_id=int(projectID)))
targets = []
for targetID in targetIDList:
targets.append(swagger_client.RepTarget(id=int(targetID)))
for filter in filters:
filter["value"] = int(filter["value"])
client = self._get_client(**kwargs)
policy = swagger_client.RepPolicy(name=name, description=desc,
projects=projects, targets=targets, filters=filters,
trigger=trigger, replicate_deletion=replicate_deletion,
replicate_existing_image_now=replicate_existing_image_now)
_, status_code, header = client.policies_replication_post_with_http_info(policy)
base._assert_status_code(expect_status_code, status_code)
return base._get_id_from_header(header), name
def get_replication_rule(self, param = None, rule_id = None, expect_status_code = 200, **kwargs):
client = self._get_client(**kwargs)

View File

@ -18,6 +18,9 @@ Library OperatingSystem
Library Process
*** Keywords ***
Prepare Helm Cert
Wait Unitl Command Success cp harbor_ca.crt /helm_ca/server.crt
Helm Repo Add
[Arguments] ${harbor_url} ${user} ${pwd} ${project_name}=library ${helm_repo_name}=myrepo
${rc} ${output}= Run And Return Rc And Output helm repo remove ${project_name}

View File

@ -32,6 +32,7 @@ CA Setup
Run mv ${cert} harbor_ca.crt
Generate Certificate Authority For Chrome ${HARBOR_PASSWORD}
Prepare Docker Cert ${ip}
Prepare Helm Cert
Collect Nightly Logs
[Arguments] ${ip} ${SSH_PWD} ${ip1}==${EMPTY}