fix: add config
This commit is contained in:
@@ -39,13 +39,27 @@ jobs:
|
|||||||
- name: Setup OpenTofu
|
- name: Setup OpenTofu
|
||||||
uses: opentofu/setup-opentofu@v1
|
uses: opentofu/setup-opentofu@v1
|
||||||
|
|
||||||
- name: Configure Git Auth for Private Modules
|
- name: Configure and Debug Authentication
|
||||||
run: |
|
run: |
|
||||||
# Strip the protocol (https:// or http://) from the server URL
|
echo "=== Debug: Variable Check ==="
|
||||||
GITEA_HOST=$(echo "${{ gitea.server_url }}" | sed -e 's|^[^/]*//||')
|
echo "Raw Server URL: ${{ gitea.server_url }}"
|
||||||
|
|
||||||
# Tell Git to use the actor and token for any request matching your server
|
# Extract just the hostname (e.g., git.itlab-ffeks.dnu.edu.ua)
|
||||||
git config --global url."https://${{ gitea.actor }}:${{ secrets.GITEA_TOKEN }}@$GITEA_HOST/".insteadOf "${{ gitea.server_url }}/"
|
GITEA_HOST=$(echo "${{ gitea.server_url }}" | awk -F/ '{print $3}')
|
||||||
|
echo "Extracted Hostname: $GITEA_HOST"
|
||||||
|
|
||||||
|
# Write it to .netrc (Git and cURL use this automatically for auth)
|
||||||
|
echo "machine $GITEA_HOST login ${{ gitea.actor }} password ${{ secrets.GITEA_TOKEN }}" > ~/.netrc
|
||||||
|
chmod 600 ~/.netrc
|
||||||
|
|
||||||
|
echo "=== Debug: .netrc Check ==="
|
||||||
|
ls -la ~/.netrc
|
||||||
|
# Print the file contents but mask the password to avoid leaking it in logs
|
||||||
|
cat ~/.netrc | sed 's/password .*/password ****/'
|
||||||
|
|
||||||
|
echo "=== Debug: Testing Git Connection directly ==="
|
||||||
|
# Try to reach the module repo directly using Git to see if auth works
|
||||||
|
git ls-remote "https://$GITEA_HOST/infrastructure/proxmox-vm.git" HEAD || echo "Git test failed, but continuing to see Tofu output..."
|
||||||
|
|
||||||
- name: OpenTofu Init & Apply
|
- name: OpenTofu Init & Apply
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in New Issue
Block a user