mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-23 02:35:17 +01:00
2bf89e9356
Due to docker-hub pull request rate limitation, we will use registed account to pull image from docker-hub, therefore add docker-hub login in API tests. Signed-off-by: danfengliu <danfengl@vmware.com>
25 lines
975 B
Bash
Executable File
25 lines
975 B
Bash
Executable File
#!/bin/bash
|
|
set -x
|
|
|
|
IP=$1
|
|
USER=$2
|
|
PWD=$3
|
|
TARGET=$4
|
|
BUNDLE_FILE=$5
|
|
DOCKER_USER=$6
|
|
DOCKER_PWD=$7
|
|
echo $DOCKER_USER
|
|
echo $IP
|
|
|
|
TOKEN=$(curl --user "$DOCKER_USER:$DOCKER_PWD" "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq -r .token)
|
|
curl -v -H "Authorization: Bearer $TOKEN" https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest 2>&1 | grep RateLimit
|
|
|
|
docker login -u $DOCKER_USER -p $DOCKER_PWD
|
|
docker login $IP -u $USER -p $PWD
|
|
|
|
cnab-to-oci fixup $BUNDLE_FILE --target $TARGET --bundle fixup_bundle.json --auto-update-bundle
|
|
|
|
TOKEN=$(curl --user "$DOCKER_USER:$DOCKER_PWD" "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq -r .token)
|
|
curl -v -H "Authorization: Bearer $TOKEN" https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest 2>&1 | grep RateLimit
|
|
|
|
cnab-to-oci push fixup_bundle.json --target $TARGET --auto-update-bundle |