Skip to content

Commit

Permalink
Update e2e engine image (#17793)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
YangJiao0817 authored Nov 14, 2022
1 parent 6b46b8b commit 484abd6
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 65 deletions.
4 changes: 2 additions & 2 deletions tests/apitests/python/library/oras.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
2 changes: 1 addition & 1 deletion tests/ci/api_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
52 changes: 25 additions & 27 deletions tests/resources/Harbor-Pages/Verify.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/Util.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
5 changes: 2 additions & 3 deletions tests/test-engine-image/Dockerfile.api_test
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# photon based image
FROM photon:4.0
ENV LANG C.UTF-8
Expand All @@ -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

Expand Down
34 changes: 12 additions & 22 deletions tests/test-engine-image/Dockerfile.common
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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 && \
Expand All @@ -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/ && \
Expand All @@ -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/ && \
Expand All @@ -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 ---
17 changes: 9 additions & 8 deletions tests/test-engine-image/Dockerfile.ui_test
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 && \
Expand Down
2 changes: 1 addition & 1 deletion tests/test-engine-image/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 .

0 comments on commit 484abd6

Please sign in to comment.