Skip to content

Commit

Permalink
Merge pull request #11 from goharbor/feat/e2e-support-arm
Browse files Browse the repository at this point in the history
feat: harbor-e2e-engine: 3.0.0-api adds support for arm architecture
  • Loading branch information
Jeremy-boo authored Mar 4, 2022
2 parents 33b8a34 + 542cbcf commit 4f49eed
Show file tree
Hide file tree
Showing 10 changed files with 359 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/ca.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test for ca.crt.
32 changes: 32 additions & 0 deletions tests/harbor_ca.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
-----BEGIN CERTIFICATE-----
MIIFizCCA3OgAwIBAgIUSaokQeug3hbGAQwSPjjIl2eujIwwDQYJKoZIhvcNAQEL
BQAwVDELMAkGA1UEBhMCQ04xDDAKBgNVBAgMA1BFSzERMA8GA1UEBwwIQmVpIEpp
bmcxETAPBgNVBAoMCGdvaGFyYm9yMREwDwYDVQQDDAhIYXJib3JDQTAgFw0yMDA4
MTIxMDUyNDNaGA8yMTIwMDcxOTEwNTI0M1owVDELMAkGA1UEBhMCQ04xDDAKBgNV
BAgMA1BFSzERMA8GA1UEBwwIQmVpIEppbmcxETAPBgNVBAoMCGdvaGFyYm9yMREw
DwYDVQQDDAhIYXJib3JDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIB
AOZRZYkFmVBNabEU4cDaqa27k5+OuUHg1ooScCnbbBFxNB22/7CzXIWOWmFCVPjX
LwAV13u6pQkMMajDqPA/7ldz8ajYm9VTDg8/qGboa6aoNO4GLLdyili66GLmHpWk
B6/JZ3JaEvpz3948vMioGCupcBqExl8gHqrgsyjR9ueqS9le66/g1gDqVmSAU3pP
wKkwdRMOiQsxSL9TY/IXbCdUepslICeGLGjv4/UCtd9YUhiIRV97KsgKDn0BO29c
V+W3ICqmrP5lQCXyBP/IOen3sEhJPCU1neCY9c687JNRICeDXe2LbRRtAqB/nSW/
u8cscy0XWzB8bpsvve6wHN2cBSkaM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hnF7+5YTL6gE7+zkYMsNvE6l9E9MLanSyE9nxOH4J8w4UAnU1vdviC
pB+W5xluZos6c2u0mY4wE/veWWIWDWWt1eOruFPXPg==
-----END CERTIFICATE-----
52 changes: 52 additions & 0 deletions tests/harbor_ca.key
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
-----BEGIN PRIVATE KEY-----
MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQDmUWWJBZlQTWmx
FOHA2qmtu5OfjrlB4NaKEnAp22wRcTQdtv+ws1yFjlphQlT41y8AFdd7uqUJDDGo
w6jwP+5Xc/Go2JvVUw4PP6hm6GumqDTuBiy3copYuuhi5h6VpAevyWdyWhL6c9/e
PLzIqBgrqXAahMZfIB6q4LMo0fbnqkvZXuuv4NYA6lZkgFN6T8CpMHUTDokLMUi/
U2PyF2wnVHqbJSAnhixo7+P1ArXfWFIYiEVfeyrICg59ATtvXFfltyAqpqz+ZUAl
8gT/yDnp97BISTwlNZ3gmPXOvOyTUSAng13ti20UbQKgf50lv7vHLHMtF1swfG6b
L73usBzdnAUpGjLfdHL+0atmSurY9fZqbOecYSdm5dSzQiZem1Okhf+c2n+P7wMy
EYUWa9gWgvaLYPUnz9cr07wJmU/1cjocRjT7Y2LjZH6F+VEQnWNMO4rShA3zutOS
IrLiyRbiGmEizvOWm0eo+wuzAclV86kxOYWrrVXmc+h7DPZZKLr09c+GGaGjE/tD
djhjaZEL8izXyt4HFfq5B3eQwCYCV5oOlInscECiHUdev3cnTg+w8yS+UkihJ7AY
dOerYwufOBmlYnAlOWD1Lj4h5cLw0QxCgvhOONLi6AedDKuC/PEfXK2GyJV2P7UM
slhf0A5qq4N9cuSBdKVq4ffIWaL8iwIDAQABAoICAEzbsNRu5+CiVLjhTQy8a48s
X3EJgcz4KN/ek0uEi6Wub0PTQ7RFxoRTItn99rkrpeWTZFtHx7cjOJcm5AN4ciMA
8A32atpfYvu3tIzS1snArBkaOmXldUFy7gXC4UXyfRYuUb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TGlWgXYqcNqRfsmhUj
7Vc1BOoTl0ozOSmIFjrAJwGJMf1nC0n8292K6XDr7KCl2Wk3v8/hW3iG2zqnyhPG
Iws64/CKaM797HsDueyAMNoQRWPy9wb7avjfR6L3F9g3KizsZUn1mQg0sBlATSSd
TCzHlmv6jAQjcDqW7qCr4HtEMrA62FY=
-----END PRIVATE KEY-----
47 changes: 47 additions & 0 deletions tests/test-engine-image/Dockerfile.api_test
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

# photon based image
FROM photon:4.0
ENV LANG C.UTF-8

COPY --from=tool_builder /tool/tools.tar.gz /usr/local/bin

COPY --from=tool_builder /usr/local/etc/singularity/singularity.conf /usr/local/etc/singularity/singularity.conf

RUN tdnf install -y \
wget \
git \
openjdk8 \
iproute2 \
iptables \
build-essential \
sed \
openssl-devel \
tar \
which \
procps-ng \
gzip && \
tdnf erase -y toybox && \
tdnf install -y python3 python3-pip python3-setuptools httpd python3-PyNaCl && \
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-JSONLibrary hurry.filesize --upgrade && \
tdnf clean all

RUN pwd && ls && \
# Install docker
DOCKER_VERSION=20.10.3 && wget https://download.docker.com/linux/static/stable/aarch64/docker-$DOCKER_VERSION.tgz && \
tar --strip-components=1 -xvzf docker-$DOCKER_VERSION.tgz -C /usr/bin && \
rm docker-$DOCKER_VERSION.tgz

COPY containerd_config.toml /etc/containerd/config.toml
COPY busybox.tar /
# This container needs to be run in privileged mode(run with --privileged option) to make it work
COPY dockerd-entrypoint.sh /usr/local/bin/dockerd-entrypoint.sh

RUN chmod +x /usr/local/bin/dockerd-entrypoint.sh && \
mkdir -p $HOME/.pki/nssdb && \
echo Harbor12345 > password.ca && \
certutil -d sql:$HOME/.pki/nssdb -N -f password.ca

VOLUME /var/lib/docker
81 changes: 81 additions & 0 deletions tests/test-engine-image/Dockerfile.common
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
FROM ubuntu:18.04 as tool_builder
ENV LANG C.UTF-8
WORKDIR /tool

#RUN tdnf install -y \
RUN apt-get update && apt-get install -y \
build-essential \
wget \
git \
tar \
#go
#ubuntu
curl \
libssl-dev \
uuid-dev
#ubuntu
RUN apt-get update && apt-get install -y software-properties-common && \
add-apt-repository -y ppa:longsleep/golang-backports && \
apt-get install -y golang-go

RUN pwd && mkdir /tool/binary && \
# Install CONTAINERD
wget https://github.com/Jeremy-boo/Notes/releases/download/v2.3.0/containerd.tar.gz && \
tar zxvf containerd.tar.gz && \
cd containerd/bin && cp -f containerd ctr /tool/binary/ && \
# docker compose
curl -L "https://github.com/docker/compose/releases/download/v2.0.1/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-arm64.tar.gz && \
tar zxvf helm-v$HELM2_VERSION-linux-arm64.tar.gz && \
cp linux-arm64/helm /tool/binary/helm && \
cp linux-arm64/helm /tool/binary/helm2 && \
# Install helm v3
HELM3_VERSION=3.3.3 && wget https://get.helm.sh/helm-v$HELM3_VERSION-linux-arm64.tar.gz && \
tar zxvf helm-v$HELM3_VERSION-linux-arm64.tar.gz && \
ls || pwd && \
mv linux-arm64/helm /tool/binary/helm3 && \
# Install ORAS
curl -LO https://github.com/Jeremy-boo/Notes/releases/download/v2.3.0/oras.tar.gz && \
mkdir -p oras-install/ && \
tar -zxf oras.tar.gz -C oras-install/ && \
chmod 755 oras-install/oras/arm64/oras && \
mv oras-install/oras/arm64/oras /tool/binary/ && \
# Install notary
wget https://github.com/Jeremy-boo/Notes/releases/download/v2.3.0/notary.tar.gz && \
tar -zxf notary.tar.gz && \
cd notary && \
chmod +x notary && \
mv notary /tool/binary/notary && \
# 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.1-beta1 && \
go list && \
make build && \
mv bin/cnab-to-oci /tool/binary/ && \
# Install DIND
DIND_COMMIT=3b5fac462d21ca164b3778647420016315289034 && \
wget "https://raw.githubusercontent.com/docker/docker/${DIND_COMMIT}/hack/dind" -O /tool/binary/dind \
&& chmod +x /tool/binary/dind && \
pwd

#ubuntu
RUN wget https://github.com/sylabs/singularity/releases/download/v3.7.3/singularity-3.7.3.tar.gz && \
tar -xzf singularity-3.7.3.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 ---




60 changes: 60 additions & 0 deletions tests/test-engine-image/Dockerfile.ui_test
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@

#ubuntm based image
FROM ubuntu:18.04
ENV LANG C.UTF-8
RUN apt-get update && apt-get install -y --no-install-recommends wget curl gnupg2
RUN apt-get install libseccomp2
RUN wget --no-check-certificate -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN sh -c 'echo "deb [arch=aarch64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'

COPY --from=tool_builder /tool/tools.tar.gz /usr/local/bin

RUN apt-get update && apt-get install -y --no-install-recommends \
git \
openjdk-8-jdk \
iproute2 \
iptables \
build-essential \
sed \
libssl-dev \
tar \
unzip \
gzip \
# certutil
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 && \
python -m pip install 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-JSONLibrary hurry.filesize --upgrade && \
apt-get clean all

RUN wget -N http://chromedriver.storage.googleapis.com/2.40/chromedriver_linux64.zip && \
unzip chromedriver_linux64.zip && \
chmod +x chromedriver && \
mv -f chromedriver /usr/local/share/chromedriver && \
ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver && \
ln -s /usr/local/share/chromedriver /usr/bin/chromedriver

RUN pwd && ls && \
# Install docker
DOCKER_VERSION=20.10.3 && wget https://download.docker.com/linux/static/stable/aarch64/docker-$DOCKER_VERSION.tgz && \
tar --strip-components=1 -xvzf docker-$DOCKER_VERSION.tgz -C /usr/bin && \
rm docker-$DOCKER_VERSION.tgz

COPY containerd_config.toml /etc/containerd/config.toml
COPY busybox.tar /
# This container needs to be run in privileged mode(run with --privileged option) to make it work
COPY dockerd-entrypoint.sh /usr/local/bin/dockerd-entrypoint.sh

RUN chmod +x /usr/local/bin/dockerd-entrypoint.sh && \
mkdir -p $HOME/.pki/nssdb && \
echo Harbor12345 > password.ca && \
certutil -d sql:$HOME/.pki/nssdb -N -f password.ca

VOLUME /var/lib/docker
32 changes: 32 additions & 0 deletions tests/test-engine-image/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
set -x
set -e

IMAGE_FOR=$1
VERSION=$2

CMD_BASE="cat Dockerfile.common"
SRC_FILE=""
DST_FILE=Dockerfile

echo "Starting to prepare Dockerfile for $IMAGE_FOR ..."
if [ "$IMAGE_FOR" == "api" ]; then
SRC_FILE=Dockerfile.api_test
else
SRC_FILE=Dockerfile.ui_test
fi

if [ ! -r $SRC_FILE ]; then
echo "File $SRC_FILE does not exists at all!"
exit -1
fi

if [ -f $DST_FILE ]; then
rm $DST_FILE
fi
$CMD_BASE $SRC_FILE >> $DST_FILE

echo "Starting to build image ..."
TARGET_IMAGE=goharbor/harbor-e2e-engine:${VERSION}-${IMAGE_FOR}
docker buildx build --platform linux/arm64 --progress plain --output=type=docker -t $TARGET_IMAGE .

Binary file added tests/test-engine-image/busybox.tar
Binary file not shown.
12 changes: 12 additions & 0 deletions tests/test-engine-image/containerd_config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[plugins]
[plugins.cri]
stream_server_address = ""
stream_server_port = "10010"
enable_selinux = false
sandbox_image = ""
stats_collect_period = 10
systemd_cgroup = false
[plugins.cri.containerd]
snapshotter = "native"
[plugins.cri.containerd.default_runtime]
runtime_type = "io.containerd.runtime.v1.linux"
42 changes: 42 additions & 0 deletions tests/test-engine-image/dockerd-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/sh
# Copyright Project Harbor Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

set -e

# Only give socker support by default, use bash arguments to add dockerd parameters
# Use unix:///var/run/docker-local.sock to avoid collision with /var/run/docker.sock

# no arguments passed
# or first arg is `-f` or `--some-option`
IP=`ip addr s eth0 |grep "inet "|awk '{print $2}' |awk -F "/" '{print $1}'`

if [ "$#" -eq 0 -o "${1#-}" != "$1" ]; then
# add our default arguments
set -- dockerd \
--storage-driver=vfs \
--insecure-registry=0.0.0.0/0 \
--pidfile=/var/run/docker-local.pid \
"$@"
fi

if [ "$1" = 'dockerd' ]; then
# if we're running Docker, let's pipe through dind
# (and we'll run dind explicitly with "sh" since its shebang is /bin/bash)
set -- sh "$(which dind)" "$@" "--insecure-registry=0.0.0.0/0"
fi

echo "$@"
exec "$@"

0 comments on commit 4f49eed

Please sign in to comment.