Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Action Failing with Error in Tailscale Setup #137

Open
rexdivakar opened this issue Aug 18, 2024 · 3 comments
Open

GitHub Action Failing with Error in Tailscale Setup #137

rexdivakar opened this issue Aug 18, 2024 · 3 comments

Comments

@rexdivakar
Copy link

The TS_OAUTH_CLIENT_ID and TS_OAUTH_SECRET secrets are confirmed to be set correctly, as indicated by the "Debug Secrets" step.

The error occurs specifically during the "Set up Tailscale" step.

Please provide guidance on resolving this issue or suggest modifications to the workflow to ensure it works correctly.

on:
  push:
    branches:
      - main

jobs:
  connect:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v3

      - name: Debug Secrets
        run: |
          echo "Checking TS_OAUTH_CLIENT_ID"
          if [ -z "${{ secrets.TS_OAUTH_CLIENT_ID }}" ]; then
            echo "::error::TS_OAUTH_CLIENT_ID is empty"
            exit 1
          else
            echo "TS_OAUTH_CLIENT_ID is set"
          fi
          echo "Checking TS_OAUTH_SECRET"
          if [ -z "${{ secrets.TS_OAUTH_SECRET }}" ]; then
            echo "::error::TS_OAUTH_SECRET is empty"
            exit 1
          else
            echo "TS_OAUTH_SECRET is set"
          fi


      - name: Set up Tailscale
        uses: tailscale/github-action@v2
        with:
          oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
          oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
          # tags: tag:ci
          version: 1.52.0

      - name: Verify Tailscale connection
        run: |
          tailscale ping <IP ADDRESS>
image
@xLionTamer
Copy link

I am having the same issue. My secrets are set, but I am getting the message that I need to populate them for my workflow. My secrets are at the organizational level, and these worked when I set them up 2 months ago

@rexdivakar
Copy link
Author

Hey @xLionTamer I got them figured out you can use my template and try it by setting up TS_OAUTH_CLIENT_ID

name: Tailscale_deploy
on:
  push:
    branches:
      - main

jobs:
  deploy-via-tailscale:
    runs-on: ubuntu-latest
    steps:
      - name: Check out code
        uses: actions/checkout@v2

      - name: Debug Secrets
        run: |
          echo "Checking TS_OAUTH_CLIENT_ID"
          if [ -z "${{ secrets.TS_OAUTH_CLIENT_ID }}" ]; then
            echo "::error::TS_OAUTH_CLIENT_ID is empty"
            exit 1
          else
            echo "TS_OAUTH_CLIENT_ID is set"
          fi
          echo "Checking TS_OAUTH_SECRET"
          if [ -z "${{ secrets.TS_OAUTH_SECRET }}" ]; then
            echo "::error::TS_OAUTH_SECRET is empty"
            exit 1
          else
            echo "TS_OAUTH_SECRET is set"
          fi

      - name: Setup Tailscale
        uses: tailscale/github-action@v2
        with:
          oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
          oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
          tags: tag:ci

      - name: Verify Tailscale connection
        run: |
          tailscale ping <NODE IP>
        
      - name: Deploy Application
        run: |
            echo "Deploying application..."
            sshpass -p ${{ secrets.HOSTKEY }} ssh -o StrictHostKeyChecking=no debian@<NODE IP> \
            "hostname > /tmp/hostname.txt && echo 'Deployment successful' > /tmp/deploy_status.txt"
        

@caejb
Copy link

caejb commented Sep 19, 2024

The fix is, you must use the tag:cli and define it in the ACL sector at the Tailscale admin page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants