tokens
This commit is contained in:
parent
aa76386700
commit
e83076e35d
1 changed files with 38 additions and 16 deletions
54
pidd.sh
54
pidd.sh
|
@ -352,12 +352,17 @@ Acquire::https::Verify-Peer False;
|
||||||
if [ -n "${GITHUB_ACTIONS}" ] ; then
|
if [ -n "${GITHUB_ACTIONS}" ] ; then
|
||||||
# github → gitea → forgejo
|
# github → gitea → forgejo
|
||||||
if [ -n "${GITHUB_SERVER_URL}" ] ; then
|
if [ -n "${GITHUB_SERVER_URL}" ] ; then
|
||||||
PIDD_SERVER_URL="${GITHUB_SERVER_URL}"
|
if [ -n "${GITHUB_TOKEN}" ] ; then
|
||||||
|
PIDD_PROJECT_ROOT="$(dirname "${GITHUB_SERVER_URL}")\
|
||||||
|
/${GITHUB_TOKEN}@$(basename "${GITHUB_SERVER_URL}")"
|
||||||
|
else
|
||||||
|
pidd_error_ci "GITHUB_TOKEN"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
pidd_error_ci "GITHUB_SERVER_URL"
|
pidd_error_ci "GITHUB_SERVER_URL"
|
||||||
fi
|
fi
|
||||||
if [ -n "${GITHUB_REPOSITORY}" ] ; then
|
if [ -n "${GITHUB_REPOSITORY}" ] ; then
|
||||||
PIDD_PROJECTS_GROUP="$(dirname "${GITHUB_REPOSITORY}")"
|
PIDD_PROJECT_PATH="$(dirname "${GITHUB_REPOSITORY}")"
|
||||||
PIDD_PROJECT_NAME="$(basename "${GITHUB_REPOSITORY}")"
|
PIDD_PROJECT_NAME="$(basename "${GITHUB_REPOSITORY}")"
|
||||||
else
|
else
|
||||||
pidd_error_ci "GITHUB_REPOSITORY"
|
pidd_error_ci "GITHUB_REPOSITORY"
|
||||||
|
@ -369,16 +374,33 @@ Acquire::https::Verify-Peer False;
|
||||||
fi
|
fi
|
||||||
elif [ -n "${GITLAB_CI}" ] ; then
|
elif [ -n "${GITLAB_CI}" ] ; then
|
||||||
# gitlab
|
# gitlab
|
||||||
if [ -n "${CI_SERVER_URL}" ] ; then
|
if [ -n "${CI_SERVER_PROTOCOL}" ] ; then
|
||||||
PIDD_SERVER_URL="${CI_SERVER_URL}"
|
if [ -n "${CI_REGISTRY_USER}" ] ; then
|
||||||
|
if [ -n "${CI_REGISTRY_PASSWORD}" ] ; then
|
||||||
|
if [ -n "${CI_SERVER_FQDN}" ] ; then
|
||||||
|
PIDD_PROJECT_ROOT="${CI_SERVER_PROTOCOL}\
|
||||||
|
://${CI_REGISTRY_USER}:${CI_REGISTRY_PASSWORD}@${CI_SERVER_FQDN}"
|
||||||
|
if [ -n "${CI_PROJECT_NAMESPACE}" ] ; then
|
||||||
|
PIDD_PROJECT_PATH="${CI_PROJECT_NAMESPACE}"
|
||||||
|
if [ -n "${CI_PROJECT_NAME}" ] ; then
|
||||||
|
PIDD_PROJECT_NAME="${CI_PROJECT_NAME}"
|
||||||
|
else
|
||||||
|
pidd_error_ci "CI_PROJECT_NAME"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
pidd_error_ci "CI_PROJECT_NAMESPACE"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
pidd_error_ci "CI_SERVER_FQDN"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
pidd_error_ci "CI_REGISTRY_PASSWORD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
pidd_error_ci "CI_REGISTRY_USER"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
pidd_error_ci "CI_SERVER_URL"
|
pidd_error_ci "CI_SERVER_PROTOCOL"
|
||||||
fi
|
|
||||||
if [ -n "${CI_PROJECT_PATH}" ] ; then
|
|
||||||
PIDD_PROJECTS_GROUP="$(dirname "${CI_PROJECT_PATH}")"
|
|
||||||
PIDD_PROJECT_NAME="$(basename "${CI_PROJECT_PATH}")"
|
|
||||||
else
|
|
||||||
pidd_error_ci "CI_PROJECT_PATH"
|
|
||||||
fi
|
fi
|
||||||
if [ -n "${CI_COMMIT_BRANCH}" ] ; then
|
if [ -n "${CI_COMMIT_BRANCH}" ] ; then
|
||||||
PIDD_PROJECT_BRANCH="${CI_COMMIT_BRANCH}"
|
PIDD_PROJECT_BRANCH="${CI_COMMIT_BRANCH}"
|
||||||
|
@ -389,18 +411,18 @@ Acquire::https::Verify-Peer False;
|
||||||
# unsupported
|
# unsupported
|
||||||
pidd_error_ci "ø"
|
pidd_error_ci "ø"
|
||||||
fi
|
fi
|
||||||
[ -n "${PIDD_SERVER_URL}" ] || pidd_error_ci "PIDD_SERVER_URL"
|
[ -n "${PIDD_PROJECT_ROOT}" ] || pidd_error_ci "PIDD_PROJECT_ROOT"
|
||||||
[ -n "${PIDD_PROJECTS_GROUP}" ] || pidd_error_ci "PIDD_PROJECTS_GROUP"
|
[ -n "${PIDD_PROJECT_PATH}" ] || pidd_error_ci "PIDD_PROJECT_PATH"
|
||||||
[ -n "${PIDD_PROJECT_NAME}" ] || pidd_error_ci "PIDD_PROJECT_NAME"
|
[ -n "${PIDD_PROJECT_NAME}" ] || pidd_error_ci "PIDD_PROJECT_NAME"
|
||||||
[ -n "${PIDD_PROJECT_BRANCH}" ] || pidd_error_ci "PIDD_PROJECT_BRANCH"
|
[ -n "${PIDD_PROJECT_BRANCH}" ] || pidd_error_ci "PIDD_PROJECT_BRANCH"
|
||||||
#
|
#
|
||||||
PIDD_PROJECTS_URL="${PIDD_SERVER_URL}/${PIDD_PROJECTS_GROUP}"
|
PIDD_PROJECTS_URL="${PIDD_PROJECT_ROOT}/${PIDD_PROJECT_PATH}"
|
||||||
#
|
#
|
||||||
pidd_split
|
pidd_split
|
||||||
pidd_echo "PIDD_CA"
|
pidd_echo "PIDD_CA"
|
||||||
pidd_split
|
pidd_split
|
||||||
pidd_echo "PIDD_SERVER_URL" \
|
pidd_echo "PIDD_PROJECT_ROOT" \
|
||||||
"PIDD_PROJECTS_GROUP" "PIDD_PROJECT_NAME" "PIDD_PROJECT_BRANCH"
|
"PIDD_PROJECT_PATH" "PIDD_PROJECT_NAME" "PIDD_PROJECT_BRANCH"
|
||||||
pidd_split
|
pidd_split
|
||||||
pidd_echo "PIDD_PROJECTS_URL"
|
pidd_echo "PIDD_PROJECTS_URL"
|
||||||
# TODO move to Python
|
# TODO move to Python
|
||||||
|
|
Loading…
Reference in a new issue