glab ci view crashes when trying to display an unrun child pipeline

Checklist

  • I'm using the latest version of the extension (Run glab --version)
    • Extension version: 1.33.0
  • Operating system and version: Arch Linux
  • Gitlab.com or self-managed instance? gitlab.com
  • I have performed glab auth status to check for authentication issues

Summary

When in glab ci view crashes when trying to view un-run manual child pipelines.

Steps to reproduce

  • create a cicd pipeline which uses extends like this example:
.deploy-me:
  trigger:
    strategy: depend
    include:
      - project: 'shared-components/components'
        ref: 'main'
        file: 'pipelines/my-shared.yml'

stages:
  - deploy:dev
  - deploy:preprod

Deploy To Dev:
  stage: deploy:dev
  extends: .deploy-me
  environment: dev

Deploy To Preprod:
  stage: deploy:preprod
  extends: .deploy-me
  when: manual
  environment: preprod
  • run glab ci view in a project with child pipelines
  • navigate with the error keys to a manual job which has not been run
  • press Enter and the application will crash

What is the current bug behavior?

When in glab ci view and clicking on a child pipeline which has not been not been run (manual job) the application crashes. Already run child pipelines do not error out when clicked.

What is the expected correct behavior?

I should see the child pipeline details (image example below of a working child view)

Relevant logs and/or screenshots

Error message

2023/10/13 12:21:07 runtime error: index out of range [6] with length 3
goroutine 1 [running]:
runtime/debug.Stack()
	runtime/debug/stack.go:24 +0x5e
gitlab.com/gitlab-org/cli/commands/ci/view.recoverPanic(0x55ca6d37cc00?)
	gitlab.com/gitlab-org/cli/commands/ci/view/view.go:673 +0x45
panic({0x55ca6d306420?, 0xc00093af60?})
	runtime/panic.go:914 +0x21f
github.com/rivo/tview.(*Application).Run.func1()
	github.com/rivo/tview@v0.0.0-20230621164836-6cc0565babaf/application.go:251 +0x45
panic({0x55ca6d306420?, 0xc00093af60?})
	runtime/panic.go:914 +0x21f
gitlab.com/gitlab-org/cli/commands/ci/view.(*navigator).Navigate(0x0?, {0xc0008d8cc0?, 0xc0009901e0?, 0xc00028d520?}, 0xc00028d598?)
	gitlab.com/gitlab-org/cli/commands/ci/view/view.go:400 +0x5e6
gitlab.com/gitlab-org/cli/commands/ci/view.drawView.inputCapture.func2(0xc00028d870?)
	gitlab.com/gitlab-org/cli/commands/ci/view/view.go:238 +0x24e
github.com/rivo/tview.(*Application).Run(0xc00073e000)
	github.com/rivo/tview@v0.0.0-20230621164836-6cc0565babaf/application.go:327 +0x3f8
gitlab.com/gitlab-org/cli/commands/ci/view.drawView({{0xc0004af6ea, 0x4}, {0xc0004e9480, 0x39}, 0xc0001d5ef0, {0xc0007e8060, 0x28}, 0xc0001fc480, {0x55ca6d37c848, 0xc00006e048}})
	gitlab.com/gitlab-org/cli/commands/ci/view/view.go:197 +0x8f4
gitlab.com/gitlab-org/cli/commands/ci/view.NewCmdView.func1(0xc000111900?, {0x55ca6dabdea0, 0x0, 0x55ca6ced21f0?})
	gitlab.com/gitlab-org/cli/commands/ci/view/view.go:159 +0x278
github.com/spf13/cobra.(*Command).execute(0xc000524900, {0x55ca6dabdea0, 0x0, 0x0})
	github.com/spf13/cobra@v1.7.0/command.go:940 +0x87c
github.com/spf13/cobra.(*Command).ExecuteC(0xc000004900)
	github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3a5
main.main()
	./main.go:155 +0x9d5

Main pipeline view (navigating to Deploy:preprod and pressing Enter causes crash): main-view

Already run Deploy:dev stage child view (working): child-view

Possible fixes

Only option is to use the UI and run the pipeline

Similar issues

#225 (closed)

Edited by Edward Holmes