I've a git runner setup in my gcloud instance. It is running and showing up in my runners' list. Problem occurs when my go project I'm trying to build is using a private github module.
Here are the steps I've followed:
- exposed environment variable: GOPRIVATE=github.com/<MY_ORG>/<MY_REPO>
- git config --global url."https://<PRIAVTE_ACCESS_TOKEN>:[email protected]/".insteadOf "https://github.com/"
But I'm still getting the following error when I'm trying to access the private module: remote: Repository not found. fatal: Authentication failed for 'https://github.com/<MY_ORG>/<MY_REPO>/'
My github action workflow file looks like this:
name: CICD
on:
workflow_dispatch:
inputs:
ENV:
description: 'ENV'
required: true
default: 'poc'
DOCKER_TAG:
description: 'docker image tag'
required: true
default: 'latest'
env:
NS: ${{ vars.NS }}
ENV: ${{ github.event.inputs.ENV }}
DOCKER_TAG: ${{ github.event.inputs.DOCKER_TAG }}
GOOS: ${{ vars.GOOS }}
GOARCH: ${{ vars.GOARCH }}
CGO_ENABLED: ${{ vars.CGO_ENABLED }}
GKE_SA_KEY: ${{ secrets.GKE_SA_KEY }}
GKE_CLUSTER: ${{ vars.GKE_CLUSTER }}
GKE_ZONE : ${{ vars.GKE_ZONE }}
DOCKER_REG: ${{ vars.DOCKER_REG }}
PROJECT_ID: ${{ vars.PROJECT_ID }}
DOCKER_REPO: ${{ vars.DOCKER_REPO }}
APP_NAME: ${{ vars.APP_NAME }}
DOMAIN: ${{ vars.DOMAIN }}
URL: ${{ vars.URL }}
GOPRIVATE : ${{ vars.GOPRIVATE }}
TOKEN: ${{ secrets.GITPAT }}
jobs:
app-build:
environment: ${{ github.event.inputs.ENV }}
runs-on: my-self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Configure git for private modules
run: git config --global url."https://$TOKEN:[email protected]/".insteadOf "https://github.com/"
- name: Build
run: go build -o main main.go <---- FAILING OVER HERE
Here the project I'm trying to build depends upon a private github repo.