2022-03-02 13:10:06 -05:00
|
|
|
name: "Clustering test"
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
pull_request:
|
|
|
|
branches: [main]
|
|
|
|
release:
|
|
|
|
types:
|
|
|
|
- published
|
|
|
|
|
2022-07-11 14:54:49 -05:00
|
|
|
permissions: read-all
|
|
|
|
|
2022-03-02 13:10:06 -05:00
|
|
|
jobs:
|
|
|
|
client-tools:
|
|
|
|
name: Stateless zot with shared reliable storage
|
2024-09-30 13:24:24 -05:00
|
|
|
runs-on: ubuntu-latest
|
2022-03-02 13:10:06 -05:00
|
|
|
# services:
|
|
|
|
# minio:
|
2024-07-24 05:06:29 -05:00
|
|
|
# image: minio/minio:RELEASE.2024-07-16T23-46-41Z
|
2022-03-02 13:10:06 -05:00
|
|
|
# env:
|
|
|
|
# MINIO_ROOT_USER: minioadmin
|
|
|
|
# MINIO_ROOT_PASSWORD: minioadmin
|
|
|
|
# ports:
|
|
|
|
# - 9000:9000
|
|
|
|
# volumes:
|
|
|
|
# - /tmp/data:/data
|
|
|
|
# options: --name=minio --health-cmd "curl http://localhost:9000/minio/health/live"
|
|
|
|
steps:
|
2023-09-05 14:30:49 -05:00
|
|
|
- uses: actions/checkout@v4
|
2023-12-12 05:44:28 -05:00
|
|
|
- uses: actions/setup-go@v5
|
2022-03-02 13:10:06 -05:00
|
|
|
with:
|
2023-03-22 14:33:21 -05:00
|
|
|
cache: false
|
2024-11-08 11:58:55 -05:00
|
|
|
go-version: 1.23.x
|
2022-03-02 13:10:06 -05:00
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
cd $GITHUB_WORKSPACE
|
2024-02-07 13:54:28 -05:00
|
|
|
go install github.com/swaggo/swag/cmd/swag@v1.16.2
|
2022-03-02 13:10:06 -05:00
|
|
|
go mod download
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get -y install rpm uidmap
|
|
|
|
# install skopeo
|
|
|
|
sudo apt-get -y install skopeo
|
|
|
|
|
|
|
|
# install haproxy
|
|
|
|
sudo apt-get install haproxy
|
|
|
|
|
2024-10-01 03:11:27 -05:00
|
|
|
- name: Build binaries
|
|
|
|
run: |
|
|
|
|
cd $GITHUB_WORKSPACE
|
|
|
|
make binary
|
|
|
|
make bench
|
|
|
|
|
2022-03-02 13:10:06 -05:00
|
|
|
- name: Setup minio service
|
|
|
|
run: |
|
|
|
|
docker run -d -p 9000:9000 --name minio \
|
|
|
|
-e "MINIO_ACCESS_KEY=minioadmin" \
|
|
|
|
-e "MINIO_SECRET_KEY=minioadmin" \
|
|
|
|
-v /tmp/data:/data \
|
|
|
|
-v /tmp/config:/root/.minio \
|
|
|
|
--health-cmd "curl http://localhost:9000/minio/health/live" \
|
2024-07-24 05:06:29 -05:00
|
|
|
minio/minio:RELEASE.2024-07-16T23-46-41Z server /data
|
2022-03-02 13:10:06 -05:00
|
|
|
- name: Install py minio
|
|
|
|
run: pip3 install minio
|
2023-08-23 11:21:43 -05:00
|
|
|
|
2022-05-17 11:50:27 -05:00
|
|
|
- name: Wait for minio to come up
|
|
|
|
run: |
|
|
|
|
curl --connect-timeout 5 \
|
2023-06-16 04:24:38 -05:00
|
|
|
--max-time 120 \
|
2022-05-17 11:50:27 -05:00
|
|
|
--retry 12 \
|
|
|
|
--retry-max-time 120 \
|
|
|
|
'http://localhost:9000/minio/health/live'
|
2023-08-23 11:21:43 -05:00
|
|
|
|
2022-03-02 13:10:06 -05:00
|
|
|
- name: Create minio bucket
|
|
|
|
run: |
|
|
|
|
python3 - <<'EOF'
|
|
|
|
from minio import Minio
|
|
|
|
|
|
|
|
try:
|
|
|
|
minio = Minio(
|
|
|
|
'localhost:9000',
|
|
|
|
access_key='minioadmin',
|
|
|
|
secret_key='minioadmin',
|
|
|
|
secure=False
|
|
|
|
)
|
|
|
|
except Exception as ex:
|
|
|
|
raise
|
|
|
|
|
|
|
|
minio.make_bucket('zot-storage')
|
|
|
|
print(f'{minio.list_buckets()}')
|
|
|
|
EOF
|
|
|
|
|
|
|
|
- name: Run haproxy
|
|
|
|
run: |
|
|
|
|
sudo haproxy -d -f examples/cluster/haproxy.cfg -D
|
|
|
|
sleep 10
|
2023-08-23 11:21:43 -05:00
|
|
|
|
2022-03-02 13:10:06 -05:00
|
|
|
- name: Prepare configuration files
|
|
|
|
run: |
|
|
|
|
cp test/cluster/config-minio.json test/cluster/config-minio1.json
|
2024-10-01 03:11:27 -05:00
|
|
|
sed -i 's/8081/8081/g' test/cluster/config-minio1.json
|
|
|
|
sed -i 's/\/tmp\/zot/\/tmp\/zot1/g' test/cluster/config-minio1.json
|
2022-03-02 13:10:06 -05:00
|
|
|
cp test/cluster/config-minio.json test/cluster/config-minio2.json
|
2024-10-01 03:11:27 -05:00
|
|
|
sed -i 's/8081/8082/g' test/cluster/config-minio2.json
|
|
|
|
sed -i 's/\/tmp\/zot/\/tmp\/zot2/g' test/cluster/config-minio2.json
|
2022-03-02 13:10:06 -05:00
|
|
|
cp test/cluster/config-minio.json test/cluster/config-minio3.json
|
2024-10-01 03:11:27 -05:00
|
|
|
sed -i 's/8081/8083/g' test/cluster/config-minio3.json
|
|
|
|
sed -i 's/\/tmp\/zot/\/tmp\/zot3/g' test/cluster/config-minio3.json
|
|
|
|
|
|
|
|
- name: Free up disk space
|
|
|
|
uses: jlumbroso/free-disk-space@main
|
|
|
|
with:
|
|
|
|
# This might remove tools that are actually needed, if set to "true" but frees about 6 GB
|
|
|
|
tool-cache: true
|
|
|
|
# All of these default to true, but feel free to set to "false" if necessary for your workflow
|
|
|
|
android: true
|
|
|
|
dotnet: true
|
|
|
|
haskell: true
|
|
|
|
large-packages: true
|
|
|
|
swap-storage: true
|
2023-08-23 11:21:43 -05:00
|
|
|
|
2022-03-02 13:10:06 -05:00
|
|
|
- name: Run push-pull tests
|
|
|
|
run: |
|
|
|
|
./bin/zot-linux-amd64 serve test/cluster/config-minio1.json &
|
|
|
|
./bin/zot-linux-amd64 serve test/cluster/config-minio2.json &
|
|
|
|
./bin/zot-linux-amd64 serve test/cluster/config-minio3.json &
|
2024-09-30 12:37:53 -05:00
|
|
|
sleep 20
|
2022-03-02 13:10:06 -05:00
|
|
|
# run tests
|
2023-04-27 02:09:46 -05:00
|
|
|
skopeo --debug copy --format=oci --dest-tls-verify=false docker://ghcr.io/project-zot/golang:1.20 docker://localhost:8080/golang:1.20
|
|
|
|
skopeo --debug copy --src-tls-verify=false docker://localhost:8080/golang:1.20 oci:golang:1.20
|
2022-03-02 13:10:06 -05:00
|
|
|
echo "{\"name\":\"foo\",\"value\":\"bar\"}" > config.json
|
|
|
|
echo "hello world" > artifact.txt
|
2022-07-12 09:21:49 -05:00
|
|
|
oras push --plain-http localhost:8080/hello-artifact:v2 \
|
2022-08-30 11:29:39 -05:00
|
|
|
--config config.json:application/vnd.acme.rocket.config.v1+json \
|
2022-03-02 13:10:06 -05:00
|
|
|
artifact.txt:text/plain -d -v
|
|
|
|
rm -f artifact.txt # first delete the file
|
2022-07-12 09:21:49 -05:00
|
|
|
oras pull --plain-http localhost:8080/hello-artifact:v2 -d -v
|
2022-03-02 13:10:06 -05:00
|
|
|
grep -q "hello world" artifact.txt # should print "hello world"
|
|
|
|
if [ $? -ne 0 ]; then \
|
|
|
|
killall -r zot-*; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
killall -r zot-*
|
|
|
|
env:
|
|
|
|
AWS_ACCESS_KEY_ID: minioadmin
|
|
|
|
AWS_SECRET_ACCESS_KEY: minioadmin
|
2023-08-23 11:21:43 -05:00
|
|
|
|
2022-04-21 08:56:21 -05:00
|
|
|
- name: Run benchmark with --src-cidr arg
|
2022-03-02 13:10:06 -05:00
|
|
|
run: |
|
|
|
|
./bin/zot-linux-amd64 serve test/cluster/config-minio1.json &
|
|
|
|
./bin/zot-linux-amd64 serve test/cluster/config-minio2.json &
|
|
|
|
./bin/zot-linux-amd64 serve test/cluster/config-minio3.json &
|
2024-09-30 12:37:53 -05:00
|
|
|
sleep 20
|
2022-04-21 08:56:21 -05:00
|
|
|
# run zb with --src-cidr
|
|
|
|
bin/zb-linux-amd64 -c 10 -n 50 -o ci-cd --src-cidr 127.0.0.0/8 http://localhost:8080
|
|
|
|
|
|
|
|
killall -r zot-*
|
|
|
|
|
|
|
|
# clean zot storage
|
|
|
|
sudo rm -rf /tmp/data/zot-storage/zot
|
|
|
|
env:
|
|
|
|
AWS_ACCESS_KEY_ID: minioadmin
|
|
|
|
AWS_SECRET_ACCESS_KEY: minioadmin
|
2023-08-23 11:21:43 -05:00
|
|
|
|
2022-04-21 08:56:21 -05:00
|
|
|
- name: Run benchmark with --src-ips arg
|
|
|
|
run: |
|
|
|
|
./bin/zot-linux-amd64 serve test/cluster/config-minio1.json &
|
|
|
|
./bin/zot-linux-amd64 serve test/cluster/config-minio2.json &
|
|
|
|
./bin/zot-linux-amd64 serve test/cluster/config-minio3.json &
|
2024-09-30 12:37:53 -05:00
|
|
|
sleep 20
|
2022-04-21 08:56:21 -05:00
|
|
|
# run zb with --src-ips
|
|
|
|
bin/zb-linux-amd64 -c 10 -n 50 -o ci-cd --src-ips 127.0.0.2,127.0.0.3,127.0.0.4,127.0.0.5,127.0.0.6,127.0.12.5,127.0.12.6 http://localhost:8080
|
2023-08-23 11:21:43 -05:00
|
|
|
|
2022-04-21 08:56:21 -05:00
|
|
|
killall -r zot-*
|
2022-03-02 13:10:06 -05:00
|
|
|
env:
|
|
|
|
AWS_ACCESS_KEY_ID: minioadmin
|
|
|
|
AWS_SECRET_ACCESS_KEY: minioadmin
|
2023-08-23 11:21:43 -05:00
|
|
|
|
2022-03-02 13:10:06 -05:00
|
|
|
# Download previous benchmark result from cache (if exists)
|
|
|
|
- name: Download previous benchmark data
|
2024-01-29 18:30:41 -05:00
|
|
|
uses: actions/cache@v4
|
2022-03-02 13:10:06 -05:00
|
|
|
with:
|
|
|
|
path: ./cache
|
2022-08-30 10:38:56 -05:00
|
|
|
key: ${{ runner.os }}-gen1-benchmark-stateless-cluster
|
2022-03-02 13:10:06 -05:00
|
|
|
# Run `github-action-benchmark` action
|
|
|
|
- name: Store benchmark result
|
2024-10-30 06:09:36 -05:00
|
|
|
uses: benchmark-action/github-action-benchmark@v1.20.4
|
2022-03-02 13:10:06 -05:00
|
|
|
with:
|
|
|
|
# What benchmark tool the output.txt came from
|
|
|
|
tool: 'customBiggerIsBetter'
|
|
|
|
# Where the output from the benchmark tool is stored
|
|
|
|
output-file-path: ci-cd.json
|
|
|
|
# Where the previous data file is stored
|
|
|
|
external-data-json-path: ./cache/benchmark-data.json
|
|
|
|
# Workflow will fail when an alert happens
|
|
|
|
fail-on-alert: true
|
|
|
|
# Upload the updated cache file for the next job by actions/cache
|