From 484abd62131b2303d1a036b247a8e7f63c3530f8 Mon Sep 17 00:00:00 2001 From: Yang Jiao <72076317+YangJiao0817@users.noreply.github.com> Date: Mon, 14 Nov 2022 14:02:23 +0800 Subject: [PATCH] Update e2e engine image (#17793) 1. Update ubuntu version to 20.04 2. Update containerd version to 1.6.9 3. Update docker-compose version to 2.12.2 4. Update helm version to 3.10.1 5. Update ORAS version to 0.16.0 6. Update CNAB version to 0.3.7 7. Update imgpkg version to 0.33.0 8. Update cosign version to 1.13.1 9. Remove singularity Signed-off-by: Yang Jiao --- tests/apitests/python/library/oras.py | 4 +- tests/ci/api_run.sh | 2 +- tests/resources/Harbor-Pages/Verify.robot | 52 ++++++++++----------- tests/resources/Util.robot | 2 +- tests/test-engine-image/Dockerfile.api_test | 5 +- tests/test-engine-image/Dockerfile.common | 34 +++++--------- tests/test-engine-image/Dockerfile.ui_test | 17 +++---- tests/test-engine-image/build.sh | 2 +- 8 files changed, 53 insertions(+), 65 deletions(-) diff --git a/tests/apitests/python/library/oras.py b/tests/apitests/python/library/oras.py index 66ed8c0fc..e862a54ef 100644 --- a/tests/apitests/python/library/oras.py +++ b/tests/apitests/python/library/oras.py @@ -35,7 +35,7 @@ def oras_push(harbor_server, user, password, project, repo, tag): def oras_push_cmd(harbor_server, project, repo, tag): try: ret = base.run_command( [oras_cmd, "push", harbor_server + "/" + project + "/" + repo+":"+ tag, - "--manifest-config", "config.json:application/vnd.acme.rocket.config.v1+json", \ + "--config", "config.json:application/vnd.acme.rocket.config.v1+json", \ file_artifact+":application/vnd.acme.rocket.layer.v1+txt", \ file_readme +":application/vnd.acme.rocket.docs.layer.v1+json"] ) return None @@ -56,7 +56,7 @@ def oras_pull(harbor_server, user, password, project, repo, tag): os.chdir(cwd) except Exception as e: raise Exception('Error: Exited with error {}',format(e)) - ret = base.run_command([oras_cmd, "pull", harbor_server + "/" + project + "/" + repo+":"+ tag, "-a"]) + ret = base.run_command([oras_cmd, "pull", harbor_server + "/" + project + "/" + repo+":"+ tag]) assert os.path.exists(file_artifact) assert os.path.exists(file_readme) return base.run_command( ["md5sum", file_artifact] ).split(' ')[0], base.run_command( [ "md5sum", file_readme] ).split(' ')[0] diff --git a/tests/ci/api_run.sh b/tests/ci/api_run.sh index bf1b6f495..6b4844984 100755 --- a/tests/ci/api_run.sh +++ b/tests/ci/api_run.sh @@ -8,7 +8,7 @@ sudo gsutil version -l harbor_logs_bucket="harbor-ci-logs" DIR="$(cd "$(dirname "$0")" && pwd)" -E2E_IMAGE="goharbor/harbor-e2e-engine:4.2.1-api" +E2E_IMAGE="goharbor/harbor-e2e-engine:latest-api" # GS util function uploader { diff --git a/tests/resources/Harbor-Pages/Verify.robot b/tests/resources/Harbor-Pages/Verify.robot index a6ad2fd40..ff61742e9 100644 --- a/tests/resources/Harbor-Pages/Verify.robot +++ b/tests/resources/Harbor-Pages/Verify.robot @@ -58,7 +58,7 @@ Verify Project Metadata Verify Checkbox ${json} $.projects[?(@.name=${project})].configuration.prevent_vul ${project_config_prevent_vulnerable_images_from_running_checkbox} ${ret} Get Selected List Value ${project_config_severity_select} @{severity}= Get Value From Json ${json} $.projects[?(@.name=${project})].configuration.severity - Should Contain ${ret} @{severity}[0] + Should Contain ${ret} ${severity}[0] Navigate To Projects END Close Browser @@ -86,7 +86,7 @@ Verify Checkbox [Arguments] ${json} ${key} ${checkbox} ${is_opposite}=${false} @{out}= Get Value From Json ${json} ${key} ${value}= Set Variable If '${is_opposite}'=='${true}' 'false' 'true' - Run Keyword If '@{out}[0]'==${value} Checkbox Should Be Selected ${checkbox} + Run Keyword If '${out}[0]'==${value} Checkbox Should Be Selected ${checkbox} ... ELSE Checkbox Should Not Be Selected ${checkbox} @@ -224,15 +224,13 @@ Verify Tag Immutability Rule ${has_image} Set Variable If ${out_has_image}[0] == ${true} ${true} ${false} Go Into Project ${project} has_image=${has_image} Switch To Tag Immutability - @{repo_decoration}= Get Value From Json ${json} $.projects[?(@.name=${project})].tag_immutability_rule.repo_decoration + ${repo_decoration}= Get Value From Json ${json} $.projects[?(@.name=${project})].tag_immutability_rule.repo_decoration @{tag_decoration}= Get Value From Json ${json} $.projects[?(@.name=${project})].tag_immutability_rule.tag_decoration @{repo_pattern}= Get Value From Json ${json} $.projects[?(@.name=${project})].tag_immutability_rule.repo_pattern @{tag_pattern}= Get Value From Json ${json} $.projects[?(@.name=${project})].tag_immutability_rule.tag_pattern - Log To Console '@{repo_decoration}[0]' - #Page Should Contain @{repo_decoration}[0] - #Page Should Contain @{tag_decoration}[0] - Page Should Contain @{repo_pattern}[0] - Page Should Contain @{tag_pattern}[0] + Log To Console '${repo_decoration}[0]' + Page Should Contain ${repo_pattern}[0] + Page Should Contain ${tag_pattern}[0] Navigate To Projects END Close Browser @@ -346,26 +344,26 @@ Verify Replicationrule @{dest_namespace}= Get Value From Json ${json} $.replicationrule[?(@.rulename=${replicationrule})].dest_namespace @{cron}= Get Value From Json ${json} $.replicationrule[?(@.rulename=${replicationrule})].cron @{is_src_registry}= Get Value From Json ${json} $.replicationrule[?(@.rulename=${replicationrule})].is_src_registry - Log To Console -----is_src_registry-----@{is_src_registry}[0]------------ + Log To Console -----is_src_registry-----${is_src_registry}[0]------------ @{endpoint}= Get Value From Json ${json} $.replicationrule[?(@.rulename=${replicationrule})].endpoint Log To Console -----endpoint-----@{endpoint}------------ - ${endpoint0}= Set Variable @{endpoint}[0] + ${endpoint0}= Set Variable ${endpoint}[0] Log To Console -----endpoint0-----${endpoint0}------------ @{endpoint_type}= Get Value From Json ${json} $.endpoint[?(@.name=${endpoint0})].type @{endpoint_url}= Get Value From Json ${json} $.endpoint[?(@.name=${endpoint0})].url - Retry Textfield Value Should Be ${filter_name_id} @{name_filters}[0] - Retry Textfield Value Should Be ${filter_tag_id} @{tag_filters}[0] + Retry Textfield Value Should Be ${filter_name_id} ${name_filters}[0] + Retry Textfield Value Should Be ${filter_tag_id} ${tag_filters}[0] Retry Textfield Value Should Be ${rule_name_input} ${replicationrule} - Retry Textfield Value Should Be ${dest_namespace_xpath} @{dest_namespace}[0] - Log To Console -----endpoint_type-----@{endpoint_type}[0]------------ - ${registry}= Set Variable If "@{endpoint_type}[0]"=="harbor" ${endpoint0}-@{endpoint_url}[0] ${endpoint0}-https://hub.docker.com + Retry Textfield Value Should Be ${dest_namespace_xpath} ${dest_namespace}[0] + Log To Console -----endpoint_type-----${endpoint_type}[0]------------ + ${registry}= Set Variable If "${endpoint_type}[0]"=="harbor" ${endpoint0}-${endpoint_url}[0] ${endpoint0}-https://hub.docker.com Log To Console -------registry---${registry}------------ - Run Keyword If '@{is_src_registry}[0]' == '${true}' Retry List Selection Should Be ${src_registry_dropdown_list} ${registry} + Run Keyword If '${is_src_registry}[0]' == '${true}' Retry List Selection Should Be ${src_registry_dropdown_list} ${registry} ... ELSE Retry List Selection Should Be ${dest_registry_dropdown_list} ${registry} #Retry List Selection Should Be ${rule_resource_selector} ${resource_type} - Retry List Selection Should Be ${rule_trigger_select} @{trigger_type}[0] - Run Keyword If '@{trigger_type}[0]' == 'scheduled' Log To Console ----------@{trigger_type}[0]------------ - Run Keyword If '@{trigger_type}[0]' == 'scheduled' Retry Textfield Value Should Be ${targetCron_id} @{cron}[0] + Retry List Selection Should Be ${rule_trigger_select} ${trigger_type}[0] + Run Keyword If '${trigger_type}[0]' == 'scheduled' Log To Console ----------${trigger_type}[0]------------ + Run Keyword If '${trigger_type}[0]' == 'scheduled' Retry Textfield Value Should Be ${targetCron_id} ${cron}[0] END Reload Page @@ -382,7 +380,7 @@ Verify Interrogation Services Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Switch To Vulnerability Page Page Should Contain Custom - Page Should Contain @{cron}[0] + Page Should Contain ${cron}[0] Close Browser Verify System Setting @@ -398,14 +396,14 @@ Verify System Setting Init Chrome Driver Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Switch To Configure - Page Should Contain @{authtype}[0] - Run Keyword If @{selfreg}[0] == 'True' Checkbox Should Be Checked //clr-checkbox-wrapper[@id='selfReg']//label - Run Keyword If @{selfreg}[0] == 'False' Checkbox Should Not Be Checked //clr-checkbox-wrapper[@id='selfReg']//label + Page Should Contain ${authtype}[0] + Run Keyword If ${selfreg}[0] == 'True' Checkbox Should Be Checked //clr-checkbox-wrapper[@id='selfReg']//label + Run Keyword If ${selfreg}[0] == 'False' Checkbox Should Not Be Checked //clr-checkbox-wrapper[@id='selfReg']//label Switch To System Settings ${ret} Get Selected List Value xpath=//select[@id='proCreation'] - Should Be Equal As Strings ${ret} @{creation}[0] - Token Must Be Match @{token}[0] - Robot Account Token Must Be Match @{robot_token}[0] + Should Be Equal As Strings ${ret} ${creation}[0] + Token Must Be Match ${token}[0] + Robot Account Token Must Be Match ${robot_token}[0] Close Browser Verify Project-level Allowlist @@ -423,7 +421,7 @@ Verify Project-level Allowlist Go Into Project ${project} has_image=${has_image} Switch To Project Configuration @{is_reuse_sys_cve_allowlist}= Get Value From Json ${json} $.projects[?(@.name=${project})].configuration.reuse_sys_cve_allowlist - Run Keyword If "@{is_reuse_sys_cve_allowlist}[0]" == "true" Retry Wait Element Should Be Disabled ${project_config_project_wl_add_btn} + Run Keyword If "${is_reuse_sys_cve_allowlist}[0]" == "true" Retry Wait Element Should Be Disabled ${project_config_project_wl_add_btn} ... ELSE Retry Wait Element ${project_config_project_wl_add_btn} @{cve_ids}= Get Value From Json ${json} $.projects[?(@.name=${project})].configuration.cve Loop Verifiy CVE_IDs @{cve_ids} diff --git a/tests/resources/Util.robot b/tests/resources/Util.robot index 51d84b1f9..13ee72778 100644 --- a/tests/resources/Util.robot +++ b/tests/resources/Util.robot @@ -324,7 +324,7 @@ Log All New Tab Execute Javascript window.open('') - Select Window title=undefined + Switch Window title=undefined Click Link New Tab And Switch [Arguments] ${element_xpath} diff --git a/tests/test-engine-image/Dockerfile.api_test b/tests/test-engine-image/Dockerfile.api_test index f8a483a6f..2ba40a34c 100644 --- a/tests/test-engine-image/Dockerfile.api_test +++ b/tests/test-engine-image/Dockerfile.api_test @@ -1,4 +1,3 @@ - # photon based image FROM photon:4.0 ENV LANG C.UTF-8 @@ -23,8 +22,8 @@ RUN tdnf install -y \ tdnf erase -y toybox && \ tdnf install -y python3 python3-pip python3-setuptools httpd && \ pip3 install --upgrade pip pyasn1 google-apitools==0.5.31 gsutil python-dateutil \ - robotframework==3.2.1 robotframework-sshlibrary robotframework-httplibrary \ - requests dbbot robotframework-seleniumlibrary==4.3.0 robotframework-pabot \ + robotframework==6.0.1 robotframework-sshlibrary robotframework-httplibrary \ + requests dbbot robotframework-seleniumlibrary robotframework-pabot \ robotframework-JSONLibrary hurry.filesize --upgrade && \ tdnf clean all diff --git a/tests/test-engine-image/Dockerfile.common b/tests/test-engine-image/Dockerfile.common index 6eb406e85..1bc2d9d00 100644 --- a/tests/test-engine-image/Dockerfile.common +++ b/tests/test-engine-image/Dockerfile.common @@ -1,4 +1,6 @@ -FROM ubuntu:18.04 as tool_builder +FROM ubuntu:20.04 as tool_builder +ENV TZ=Asia/Shanghai \ + DEBIAN_FRONTEND=noninteractive ENV LANG C.UTF-8 WORKDIR /tool @@ -20,12 +22,12 @@ RUN apt-get update && apt-get install -y software-properties-common && \ RUN pwd && mkdir /tool/binary && \ # Install CONTAINERD - CONTAINERD_VERSION=1.4.4 && \ + CONTAINERD_VERSION=1.6.9 && \ wget https://github.com/containerd/containerd/releases/download/v$CONTAINERD_VERSION/containerd-$CONTAINERD_VERSION-linux-amd64.tar.gz && \ tar zxvf containerd-$CONTAINERD_VERSION-linux-amd64.tar.gz && \ cd bin && cp -f containerd ctr /tool/binary/ && \ # docker compose - curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /tool/binary/docker-compose && \ + curl -L "https://github.com/docker/compose/releases/download/v2.12.2/docker-compose-$(uname -s)-$(uname -m)" -o /tool/binary/docker-compose && \ chmod +x /tool/binary/docker-compose && \ # Install helm v2 HELM2_VERSION=2.16.12 && wget https://get.helm.sh/helm-v$HELM2_VERSION-linux-amd64.tar.gz && \ @@ -37,13 +39,13 @@ RUN pwd && mkdir /tool/binary && \ tar zxvf helm-v$HELM3_VERSION-linux-amd64.tar.gz && \ ls || pwd && \ mv linux-amd64/helm /tool/binary/helm3 && \ - # Install helm v3.7 - HELM3_7_VERSION=3.7.0 && wget https://get.helm.sh/helm-v$HELM3_7_VERSION-linux-amd64.tar.gz && \ - tar zxvf helm-v$HELM3_7_VERSION-linux-amd64.tar.gz && \ + # Install helm v3.10 + HELM3_10_VERSION=3.10.1 && wget https://get.helm.sh/helm-v$HELM3_10_VERSION-linux-amd64.tar.gz && \ + tar zxvf helm-v$HELM3_10_VERSION-linux-amd64.tar.gz && \ ls || pwd && \ mv linux-amd64/helm /tool/binary/helm3.7 && \ # Install ORAS - ORAS_VERSION=0.12.0 && curl -LO https://github.com/deislabs/oras/releases/download/v$ORAS_VERSION/oras_${ORAS_VERSION}_linux_amd64.tar.gz && \ + ORAS_VERSION=0.16.0 && curl -LO https://github.com/deislabs/oras/releases/download/v$ORAS_VERSION/oras_${ORAS_VERSION}_linux_amd64.tar.gz && \ mkdir -p oras-install/ && \ tar -zxf oras_${ORAS_VERSION}_*.tar.gz -C oras-install/ && \ mv oras-install/oras /tool/binary/ && \ @@ -54,7 +56,7 @@ RUN pwd && mkdir /tool/binary && \ # Install CNAB CNAB_PATH=$(go env GOPATH)/src/github.com/cnabio && \ mkdir -p $CNAB_PATH && cd $CNAB_PATH && git clone https://github.com/cnabio/cnab-to-oci.git && \ - cd cnab-to-oci && git checkout v0.3.3 && \ + cd cnab-to-oci && git checkout v0.3.7 && \ go list && \ make build && \ mv bin/cnab-to-oci /tool/binary/ && \ @@ -66,24 +68,12 @@ RUN pwd && mkdir /tool/binary && \ WASM_TO_OCI_VERSION=0.1.2 && wget https://github.com/engineerd/wasm-to-oci/releases/download/v${WASM_TO_OCI_VERSION}/linux-amd64-wasm-to-oci && \ chmod +x linux-amd64-wasm-to-oci && mv linux-amd64-wasm-to-oci /tool/binary/wasm-to-oci && \ # Install imgpkg - IMGPKG_VERSION=0.29.0 && wget https://github.com/vmware-tanzu/carvel-imgpkg/releases/download/v$IMGPKG_VERSION/imgpkg-linux-amd64 && \ + IMGPKG_VERSION=0.33.0 && wget https://github.com/vmware-tanzu/carvel-imgpkg/releases/download/v$IMGPKG_VERSION/imgpkg-linux-amd64 && \ mv imgpkg-linux-amd64 /tool/binary/imgpkg && chmod +x /tool/binary/imgpkg && \ # Install cosign - COSIGN_VERSION=1.9.0 && wget https://github.com/sigstore/cosign/releases/download/v$COSIGN_VERSION/cosign-linux-amd64 && \ + COSIGN_VERSION=1.13.1 && wget https://github.com/sigstore/cosign/releases/download/v$COSIGN_VERSION/cosign-linux-amd64 && \ mv cosign-linux-amd64 /tool/binary/cosign && chmod +x /tool/binary/cosign && \ pwd -#ubuntu -RUN wget https://github.com/hpcng/singularity/releases/download/v3.3.0/singularity-3.3.0.tar.gz && \ - tar -xzf singularity-3.3.0.tar.gz && \ - cd singularity && \ - ./mconfig && \ - make -C builddir && \ - make -C builddir install -RUN pwd && \ - ls -l /usr/local/bin && \ - rm -rf singularity && \ - mv /usr/local/bin/singularity /tool/binary/ - RUN cd /tool/binary/ && tar czvf tools.tar.gz * && cp tools.tar.gz /tool # --- End of base file --- \ No newline at end of file diff --git a/tests/test-engine-image/Dockerfile.ui_test b/tests/test-engine-image/Dockerfile.ui_test index 397a989fb..c97f07467 100644 --- a/tests/test-engine-image/Dockerfile.ui_test +++ b/tests/test-engine-image/Dockerfile.ui_test @@ -1,6 +1,7 @@ - #ubuntm based image -FROM ubuntu:18.04 +FROM ubuntu:20.04 +ENV TZ=Asia/Shanghai \ + DEBIAN_FRONTEND=noninteractive ENV LANG C.UTF-8 ENV HELM_EXPERIMENTAL_OCI=1 ENV COSIGN_PASSWORD=Harbor12345 @@ -27,17 +28,17 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libnss3-tools \ google-chrome-stable -RUN apt-get update -y ; apt-get install -y python3.6 && \ - rm /usr/bin/python ; ln -s /usr/bin/python3.6 /usr/bin/python ; apt-get install -y python3-pip && \ +RUN apt-get update -y; apt-get install -y python3.9 && \ + rm /usr/bin/python; ln -s /usr/bin/python3.9 /usr/bin/python; apt-get install -y python3-pip && \ python -m pip install --upgrade pip RUN pip3 install --upgrade pip pyasn1 google-apitools==0.5.31 gsutil \ - robotframework==3.2.1 robotframework-sshlibrary robotframework-httplibrary \ - requests dbbot robotframework-seleniumlibrary==4.3.0 robotframework-pabot \ + robotframework==6.0.1 robotframework-sshlibrary robotframework-httplibrary \ + requests dbbot robotframework-seleniumlibrary robotframework-pabot \ robotframework-JSONLibrary hurry.filesize --upgrade && \ apt-get clean all -# Upgrade chromedriver version to 102.0.5005.61 -RUN wget -N https://chromedriver.storage.googleapis.com/102.0.5005.61/chromedriver_linux64.zip && \ +# Upgrade chromedriver version to 107.0.5304.62 +RUN wget -N https://chromedriver.storage.googleapis.com/107.0.5304.62/chromedriver_linux64.zip && \ unzip chromedriver_linux64.zip && \ chmod +x chromedriver && \ mv -f chromedriver /usr/local/share/chromedriver && \ diff --git a/tests/test-engine-image/build.sh b/tests/test-engine-image/build.sh index ba9c5c1a7..673637e1c 100644 --- a/tests/test-engine-image/build.sh +++ b/tests/test-engine-image/build.sh @@ -28,5 +28,5 @@ $CMD_BASE $SRC_FILE >> $DST_FILE echo "Starting to build image ..." TARGET_IMAGE=goharbor/harbor-e2e-engine:${VERSION}-${IMAGE_FOR} -docker build -t $TARGET_IMAGE . +docker build -t $TARGET_IMAGE .