Support multiple Devfiles in one project from the UI

Problem to solve

Currently, creating a workspace requires two primary things: A valid agent and a project configured with a .devfile.yaml at the repository root.

Technically, there is no reason to limit a project to a single Devfile. In fact (as illustrated below) there are many reasons in which you may want multiple Devfiles in a project, even in the same directory.

Given the current convention in the UI, though, we presume the default Devfile is the one named .devfile.yaml and we don't offer a way to select a different one. However, creating a workspace from the GraphQL API does not enforce the same convention. You can specify a different Devfile to pass into the API and generate a valid workspace.

The work here would be to expose this same functionality in the UI, unblocking those who want to maintain multiple Devfiles for a project but want to manage their workspaces in the UI.

Why should we support multiple Devfiles in the project?

Scenario 1: Project as a place for workspace definitions

Below I use the term Detached workspace to talk about a workspace that doesn't have its configuration file stored in GitLab Git repository. I'm talking about the infamous free-text option.

Scenario 1 is my answer to "Why we don't have to allow creating detached Workspaces". If you want to have workspaces that are used for some data analysis and don't necessarily need a full repository, you could put them all in one project:

.
└── data-analysis-workspaces
    ├── yearly-total-usage.Devfile
    ├── anylising-monthly-foobars.Devfile
    ├── security-analysis.Devfile
    └── month-on-month-revenue.Devfile

Scenario 2: Monorepo

It's possible that multiple services don't need the same workspace. In the example below, java backend developers might not need to include android-related code in their workspace. I'm a bit less sure about the usefulness of this scenario. Maybe nobody uses workspaces this way.

.
└── super-useful-app
    ├── backend
    │   ├── Main.java
    │   └── Devfile
    ├── frontend
    │   ├── package.json
    │   └── Devfile
    └── android
        ├── Main.kt
        └── Devfile

🔴 Conversation on this topic is in this thread 🔴

Related: Display Workspace’s project repository current ... (#408129 - closed)

Edited by Eric Schurter