rajatjindal / krew-release-bot

bot to bump version of plugin in krew-index on new releases
Apache License 2.0
48 stars 17 forks source link

Krew GITHUB_REF failure #79

Closed AlexsJones closed 2 weeks ago

AlexsJones commented 3 weeks ago

Hello, recently we have noticed in the K8sGPT release pipeline a new type of error from krew. https://github.com/k8sgpt-ai/k8sgpt/actions/runs/11763964917/job/32768577152

To my knowledge we have not changed anything:

Error

Digest: sha256:cb2a5cd92097ac4a92846833d7a9340d20ed247435fa447ccd3fef5499c65793
Status: Downloaded newer image for ghcr.io/rajatjindal/krew-release-bot:v0.0.46
time="2024-11-10T09:47:19Z" level=fatal msg="GITHUB_REF expected to be of format refs/tags/<tag> but found \"refs/heads/main\""

The ref is correct as we are releasing the main branch on a merge of the goreleaser PR set.

Here is the .krew.yaml:

apiVersion: krew.googlecontainertools.github.com/v1alpha2
kind: Plugin
metadata:
  name: gpt
spec:
  version: {{ .TagName }}
  homepage: https://github.com/k8sgpt-ai/k8sgpt
  shortDescription: "Giving Kubernetes Superpowers to everyone"
  description: |
    A tool for scanning your Kubernetes clusters, diagnosing, and triaging issues in simple English.
  platforms:
    ##########
    # Darwin #
    ##########
    - selector:
        matchLabels:
          os: darwin
          arch: amd64
      {{addURIAndSha "https://github.com/k8sgpt-ai/k8sgpt/releases/download/{{ .TagName }}/k8sgpt_Darwin_x86_64.tar.gz" .TagName | indent 6 }}
      files:
        - from: "k8sgpt"
          to: "kubectl-gpt"
        - from: "LICENSE"
          to: "."
      bin: kubectl-gpt
    - selector:
        matchLabels:
          os: darwin
          arch: arm64
      {{addURIAndSha "https://github.com/k8sgpt-ai/k8sgpt/releases/download/{{ .TagName }}/k8sgpt_Darwin_arm64.tar.gz" .TagName | indent 6 }}
      files:
        - from: "k8sgpt"
          to: "kubectl-gpt"
        - from: "LICENSE"
          to: "."
      bin: kubectl-gpt

    #########
    # Linux #
    #########
    - selector:
        matchLabels:
          os: linux
          arch: amd64
      {{addURIAndSha "https://github.com/k8sgpt-ai/k8sgpt/releases/download/{{ .TagName }}/k8sgpt_Linux_x86_64.tar.gz" .TagName | indent 6 }}
      files:
        - from: "k8sgpt"
          to: "kubectl-gpt"
        - from: "LICENSE"
          to: "."
      bin: kubectl-gpt
    - selector:
        matchLabels:
          os: linux
          arch: arm64
      {{addURIAndSha "https://github.com/k8sgpt-ai/k8sgpt/releases/download/{{ .TagName }}/k8sgpt_Linux_arm64.tar.gz" .TagName | indent 6 }}
      files:
        - from: "k8sgpt"
          to: "kubectl-gpt"
        - from: "LICENSE"
          to: "."
      bin: kubectl-gpt
    - selector:
        matchLabels:
          os: linux
          arch: "386"
      {{addURIAndSha "https://github.com/k8sgpt-ai/k8sgpt/releases/download/{{ .TagName }}/k8sgpt_Linux_i386.tar.gz" .TagName | indent 6 }}
      files:
        - from: "k8sgpt"
          to: "kubectl-gpt"
        - from: "LICENSE"
          to: "."
      bin: kubectl-gpt

    ###########
    # Windows #
    ###########
    - selector:
        matchLabels:
          os: windows
          arch: amd64
      {{addURIAndSha "https://github.com/k8sgpt-ai/k8sgpt/releases/download/{{ .TagName }}/k8sgpt_Windows_x86_64.zip" .TagName | indent 6 }}
      files:
        - from: "k8sgpt"
          to: "kubectl-gpt"
        - from: "LICENSE"
          to: "."
      bin: kubectl-gpt
    - selector:
        matchLabels:
          os: windows
          arch: arm64
      {{addURIAndSha "https://github.com/k8sgpt-ai/k8sgpt/releases/download/{{ .TagName }}/k8sgpt_Windows_arm64.zip" .TagName | indent 6 }}
      files:
        - from: "k8sgpt"
          to: "kubectl-gpt"
        - from: "LICENSE"
          to: "."
      bin: kubectl-gpt
    - selector:
        matchLabels:
          os: windows
          arch: "386"
      {{addURIAndSha "https://github.com/k8sgpt-ai/k8sgpt/releases/download/{{ .TagName }}/k8sgpt_Windows_i386.zip" .TagName | indent 6 }}
      files:
        - from: "k8sgpt"
          to: "kubectl-gpt"
        - from: "LICENSE"
          to: "."
      bin: kubectl-gpt

Help appreciated!

rajatjindal commented 3 weeks ago

Hi @AlexsJones,

Thank you for reporting this. I am taking a look now. thanks

rajatjindal commented 3 weeks ago

IIUC, The GitHub release for the k8sgpt plugin works as follows:

The issue is that krew-release-bot expects to run on a workflow which was triggered when a release is tagged (rather then merge to main). But I can also see that we can improve this by identifying the tag like goreleaser did.

I'll take a look at it, and will also see if I can provide a temporary workaround.

thanks again for the detailed report.

AlexsJones commented 3 weeks ago

Thanks for the explanation and taking a look, we really appreciate it :-)

rajatjindal commented 3 weeks ago

This should be fixed now. Could you please retry and let me know if this works (or not). thanks

AlexsJones commented 3 weeks ago

Thanks, running a release now - will let you know

AlexsJones commented 3 weeks ago

Do I haveto update the action? https://github.com/k8sgpt-ai/k8sgpt/actions/runs/11768445187/job/32778289480

rajatjindal commented 3 weeks ago

Hi @AlexsJones, sorry I should have mentioned that. Yes, you need to update to release v0.0.47 for that. (if you want to use commit sha: 3d9faef30a82761d610544f62afddca00993eef9)

rajatjindal commented 3 weeks ago

Also, have you already submitted this plugin to krew-index repository? The bot expects the first version of the plugin to be released manually.

rajatjindal commented 2 weeks ago

I am going to close this issue, but pls feel free to reopen if this does not work.