hi y'all, has anyone had trouble getting stack ref...
# general
b
hi y'all, has anyone had trouble getting stack references working in GitHub Actions? When I run
pulumi up
locally it works, but it fails with this error whenever the provider is used on my GitHub action.
THING creating error: configured Kubernetes cluster is unreachable: unable to load Kubernetes client configuration from kubeconfig file: invalid configuration: no configuration has been provided
This is my infra code on a repo called "api"
Copy code
const sharedInfrastructure = new pulumi.StackReference(sharedInfraStackName)
const provider = new k8s.Provider('k8s', {
  kubeconfig: sharedInfrastructure.getOutput('kubeConfig'),
})
// use provider...
Action
Copy code
name: Infrastructure push
on:
  push:
    branches:
      - main
    paths:
      - 'infrastructure/**'

jobs:
  apply:
    name: Apply infrastructure
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: 14.x
      - run: cd infrastructure && npm install
      - uses: pulumi/actions@v3
        with:
          command: up
          stack-name: dev
          work-dir: ./infrastructure
        env:
          PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
          DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }}
Here's how I create my kubernetes cluster in another shared infra repo:
Copy code
import * as digitalocean from '@pulumi/digitalocean'
import * as k8s from '@pulumi/kubernetes'

const cluster = new digitalocean.KubernetesCluster('cluster', {
  region: digitalocean.Region.LON1,
  version: 'latest',
  nodePool: {
    name: 'default',
    size: digitalocean.DropletSlug.DropletS2VCPU2GB,
    nodeCount: 1,
  },
})

export const kubeConfig = cluster.kubeConfigs[0].rawConfig
Does anyone have any tips to solve this?
b
hey @broad-kilobyte-43768 - does your
KUBECONFIG
generated use any specific credentials? did you get this working?
b
My workaround was to move all my infrastructure code into one repo. It was too much hassle dealing with undefined values from the external references.