harbor/tests/robot-cases/Group0-Util/notary-util.sh
danfengliu a2fc1bcfaf Fix quotas test issue in upgrade pipeline
1. Change way for quotas verification in upgrade pipeline, prepare specific size of image, then it's an known value for verifcation;
2. Add notary key rotate test;
3. For issue brought by docker 20, clean containerd cache is the only effective way, so both dockerd and containerd should be cache cleard and restarted;
4. Upgrade E2E Dockerfile for importing readable file size package, and other issues;
5. Uncomment project level robot account test in nightly.
6. Get DNS from local setting, and set it into docker deamon config file;

Signed-off-by: danfengliu <danfengl@vmware.com>
2021-03-10 06:27:22 +00:00

34 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
CMD=$1
HOST=$2
PROJECT=$3
IMAGE=$4
TAG=$5
NOTARY_SERVER_ENDPOINT=$6
USER=$7
PWD=$8
PASSHRASE=$8
export DOCKER_CONTENT_TRUST=1
export NOTARY_ROOT_PASSPHRASE=$PASSHRASE
export NOTARY_TARGETS_PASSPHRASE=$PASSHRASE
export NOTARY_SNAPSHOT_PASSPHRASE=$PASSHRASE
export DOCKER_CONTENT_TRUST_ROOT_PASSPHRASE=$PASSHRASE
export DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE=$PASSHRASE
export DOCKER_CONTENT_TRUST_OFFLINE_PASSPHRASE=$PASSHRASE
export DOCKER_CONTENT_TRUST_TAGGING_PASSPHRASE=$PASSHRASE
export NOTARY_AUTH=$(echo $USER:$PWD | base64)
echo $USER:$PWD
NOTARY_CMD_OPTIONS="notary -s https://$NOTARY_SERVER_ENDPOINT --tlscacert /notary_ca.crt -d /root/.docker/trust"
if [ "$CMD" == "key_rotate" ]; then
echo "$NOTARY_CMD_OPTIONS key rotate $HOST/$PROJECT/$IMAGE snapshot -r"
$NOTARY_CMD_OPTIONS key rotate $HOST/$PROJECT/$IMAGE snapshot -r
elif [ "$CMD" == "remove" ]; then
echo "$NOTARY_CMD_OPTIONS remove -p $HOST/$PROJECT/$IMAGE $TAG"
$NOTARY_CMD_OPTIONS remove -p $HOST/$PROJECT/$IMAGE $TAG
fi