Search code examples
gitlabcontinuous-integrationgitlab-cipipeline.net-6.0

GitLab CI failing due to "jobs config should contain at least one visible job"


I am attempting to setup a pipeline for a .NET 6 project to just run some unit tests. I have a separate project in the same repository (also .NET 6) using xUnit for a unit testing framework. It seems that no matter what I try to change in my .gitlab-ci.yml file, I get the same error from the pipeline job. The error I'm seeing is this: GitLab pipeline error

When putting my configuration into GitLab's CI Lint tool, it tells me the yml is valid.

Here is my configuration:

image: mcr.microsoft.com/dotnet/sdk:6.0

stages:
  - build
  - test

job_compile:
  stage: build
  before_script:
    - "dotnet restore"
  script:
    - "dotnet build --no-restore"

job_run_tests:
  stage: test
  script:
    - "dotnet test --no-restore"

I am having trouble finding the issue here. Any help would be appreciated!


Solution

  • After some playing around with this issue, I have come to a solution.

    I had originally wrote this file using VSCode, then publishing to GitLab. I finally read somewhere that I really should have been using GitLab's CI/CD editor (in browser). I opened my existing config in GitLab's CI/CD editor, added one space to the end and then removed it. The editor now claimed that my configuration was valid (even though there was no net change). I committed my "change", and the jobs ran flawlessly.