init: seed framework reference content from agent-runtimes main repo
This commit is contained in:
29
harnesses/contexts/gitea-https/v1/init.sh
Executable file
29
harnesses/contexts/gitea-https/v1/init.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
# Configure git to use GITEA_TOKEN for HTTPS cloning/pushing to gitea.oreillyit.nz
|
||||
#
|
||||
# Uses a credential helper script that reads the token from the environment.
|
||||
# This avoids embedding the token in clone URLs (which would appear in logs).
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
CRED_HELPER="/opt/harness/contexts/gitea-https/v1/git-credential-gitea.sh"
|
||||
|
||||
# Create the credential helper script
|
||||
cat > "$CRED_HELPER" << 'HELPER_EOF'
|
||||
#!/bin/bash
|
||||
# Git credential helper that provides GITEA_TOKEN for gitea.oreillyit.nz
|
||||
if [ -z "${GITEA_TOKEN:-}" ]; then
|
||||
exit 1
|
||||
fi
|
||||
echo "protocol=https"
|
||||
echo "host=gitea.oreillyit.nz"
|
||||
echo "username=token"
|
||||
echo "password=${GITEA_TOKEN}"
|
||||
HELPER_EOF
|
||||
|
||||
chmod +x "$CRED_HELPER"
|
||||
|
||||
# Configure git to use this credential helper for gitea.oreillyit.nz
|
||||
git config --global credential.https://gitea.oreillyit.nz.helper "$CRED_HELPER"
|
||||
|
||||
echo "Git HTTPS credential helper configured for gitea.oreillyit.nz"
|
||||
Reference in New Issue
Block a user