This repository has been archived on 2025-08-13. You can view files and clone it, but cannot push or open issues or pull requests.
wangdepei 7e4f138c10
Some checks failed
e2e / build (AWS ECR Public, AWS_SECRET_ACCESS_KEY, public.ecr.aws, public.ecr.aws/q3b5f1u4/test-docker-action, remote, AWS_ACCESS_KEY_ID) (push) Has been cancelled
e2e / build (AWS ECR, AWS_SECRET_ACCESS_KEY, 175142243308.dkr.ecr.us-east-2.amazonaws.com, 175142243308.dkr.ecr.us-east-2.amazonaws.com/sandbox/test-docker-action, remote, AWS_ACCESS_KEY_ID) (push) Has been cancelled
e2e / build (Artifactory, ARTIFACTORY_TOKEN, infradock.jfrog.io, infradock.jfrog.io/test-ghaction/build-push-action, remote, ARTIFACTORY_USERNAME) (push) Has been cancelled
e2e / build (Azure Container Registry, AZURE_CLIENT_SECRET, officialgithubactions.azurecr.io, officialgithubactions.azurecr.io/test-docker-action, remote, AZURE_CLIENT_ID) (push) Has been cancelled
e2e / build (Docker Hub, DOCKERHUB_TOKEN, , ghactionstest/ghactionstest, remote, DOCKERHUB_USERNAME) (push) Has been cancelled
e2e / build (GitHub, GHCR_PAT, ghcr.io, ghcr.io/docker-ghactiontest/test, remote, GHCR_USERNAME) (push) Has been cancelled
e2e / build (GitLab, GITLAB_TOKEN, registry.gitlab.com, registry.gitlab.com/test1716/test, remote, GITLAB_USERNAME) (push) Has been cancelled
e2e / build (Google Artifact Registry, GAR_JSON_KEY, us-east4-docker.pkg.dev, us-east4-docker.pkg.dev/sandbox-298914/docker-official-github-actions/test-docker-action, remote, GAR_USERNAME) (push) Has been cancelled
e2e / build (Quay, QUAY_TOKEN, quay.io, quay.io/docker_build_team/ghactiontest, remote, QUAY_USERNAME) (push) Has been cancelled
e2e / build (distribution, Distribution, local) (push) Has been cancelled
e2e / build (harbor, Harbor, local) (push) Has been cancelled
e2e / build (nexus, Nexus, local) (push) Has been cancelled
ci / minimal (push) Has been cancelled
ci / git-context (push) Has been cancelled
ci / git-context-secret (push) Has been cancelled
ci / path-context (push) Has been cancelled
ci / example (push) Has been cancelled
ci / error (push) Has been cancelled
ci / error-buildx (push) Has been cancelled
ci / docker-driver (push) Has been cancelled
ci / export-docker (push) Has been cancelled
ci / secret (push) Has been cancelled
ci / secret-envs (push) Has been cancelled
ci / network (push) Has been cancelled
ci / shm-size (push) Has been cancelled
ci / ulimit (push) Has been cancelled
ci / cgroup-parent (push) Has been cancelled
ci / add-hosts (push) Has been cancelled
ci / no-cache-filters (push) Has been cancelled
ci / attests-compat (moby/buildkit:buildx-stable-1, latest) (push) Has been cancelled
ci / attests-compat (moby/buildkit:buildx-stable-1, v0.9.1) (push) Has been cancelled
ci / attests-compat (moby/buildkit:latest, edge) (push) Has been cancelled
ci / attests-compat (moby/buildkit:v0.10.6, latest) (push) Has been cancelled
ci / provenance (, /tmp/buildx-build, binary) (push) Has been cancelled
ci / provenance (, type=image,name=localhost:5000/name/app:latest,push=true, image) (push) Has been cancelled
ci / provenance (mode=max, /tmp/buildx-build, binary) (push) Has been cancelled
ci / provenance (mode=max, type=image,name=localhost:5000/name/app:latest,push=true, image) (push) Has been cancelled
ci / sbom (/tmp/buildx-build, binary) (push) Has been cancelled
ci / sbom (type=image,name=localhost:5000/name/app:latest,push=true, image) (push) Has been cancelled
ci / multi (multi) (push) Has been cancelled
ci / multi (multi-sudo) (push) Has been cancelled
ci / digest (docker, false, false) (push) Has been cancelled
ci / digest (docker, false, true) (push) Has been cancelled
ci / digest (docker, true, false) (push) Has been cancelled
ci / digest (docker-container, false, false) (push) Has been cancelled
ci / digest (docker-container, false, true) (push) Has been cancelled
ci / digest (docker-container, true, false) (push) Has been cancelled
ci / registry-cache (push) Has been cancelled
ci / github-cache (push) Has been cancelled
ci / local-cache (push) Has been cancelled
ci / standalone (push) Has been cancelled
ci / named-context-pin (push) Has been cancelled
ci / named-context-docker (push) Has been cancelled
ci / named-context-container (push) Has been cancelled
ci / docker-config-malformed (push) Has been cancelled
ci / proxy-docker-config (push) Has been cancelled
ci / proxy-buildkitd (push) Has been cancelled
ci / annotations (push) Has been cancelled
ci / multi-output (push) Has been cancelled
ci / load-and-push (push) Has been cancelled
ci / summary-disable (push) Has been cancelled
ci / summary-disable-deprecated (push) Has been cancelled
ci / summary-not-supported (push) Has been cancelled
ci / record-upload-disable (push) Has been cancelled
ci / record-retention-days (0) (push) Has been cancelled
ci / record-retention-days (2) (push) Has been cancelled
ci / export-legacy (false) (push) Has been cancelled
ci / export-legacy (true) (push) Has been cancelled
ci / checks (edge) (push) Has been cancelled
ci / checks (latest) (push) Has been cancelled
ci / checks (v0.14.1) (push) Has been cancelled
ci / annotations-disabled (push) Has been cancelled
ci / call-check (push) Has been cancelled
ci / no-default-attestations (push) Has been cancelled
init
2025-06-05 13:09:30 +08:00

80 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
set -eu
: "${HARBOR_VERSION:=v2.7.0}"
: "${HARBOR_HOST:=localhost}"
: "${HARBOR_PORT:=49154}"
: "${REGISTRY_USER:=admin}"
: "${REGISTRY_PASSWORD:=Harbor12345}"
: "${HARBOR_PROJECT:=test-docker-action}"
project_post_data() {
cat <<EOF
{
"project_name": "$HARBOR_PROJECT",
"public": true
}
EOF
}
export TERM=xterm
# download
echo "::group::Downloading Harbor $HARBOR_VERSION"
(
cd /tmp
set -x
wget -q "https://github.com/goharbor/harbor/releases/download/${HARBOR_VERSION}/harbor-offline-installer-${HARBOR_VERSION}.tgz" -O harbor-online-installer.tgz
tar xvf harbor-online-installer.tgz
)
echo "::endgroup::"
# config
echo "::group::Configuring Harbor"
(
cd /tmp/harbor
set -x
cp harbor.yml.tmpl harbor.yml
harborConfig="$(harborHost="$HARBOR_HOST" harborPort="$HARBOR_PORT" harborPwd="$REGISTRY_PASSWORD" yq --no-colors '.hostname = env(harborHost) | .http.port = env(harborPort) | .harbor_admin_password = env(harborPwd) | del(.https)' harbor.yml)"
tee harbor.yml <<<"$harborConfig" >/dev/null
yq --no-colors harbor.yml
)
echo "::endgroup::"
# install and start
echo "::group::Installing Harbor"
(
cd /tmp/harbor
set -x
./install.sh
sleep 10
netstat -aptn
)
echo "::endgroup::"
# compose config
echo "::group::Compose config"
(
cd /tmp/harbor
set -x
docker compose config
)
echo "::endgroup::"
# create project
echo "::group::Creating project"
(
set -x
curl --fail -v -k --max-time 10 -u "$REGISTRY_USER:$REGISTRY_PASSWORD" -X POST -H "Content-Type: application/json" -d "$(project_post_data)" "http://$HARBOR_HOST:$HARBOR_PORT/api/v2.0/projects"
)
echo "::endgroup::"
# list projects
echo "::group::List projects"
(
set -x
curl --fail -s -k --max-time 10 -u "$REGISTRY_USER:$REGISTRY_PASSWORD" -H "Content-Type: application/json" "http://$HARBOR_HOST:$HARBOR_PORT/api/v2.0/projects" | jq
)
echo "::endgroup::"