Skip to content

Makefile: yq invocation lacks -r flag, breaks on host with yq v3 #41

@matthew-on-git

Description

@matthew-on-git

Problem

The reference Makefile reads LANGUAGES via:

```make
LANGUAGES := $(shell yq '.languages[]' $(DEVRAIL_CONFIG) 2>/dev/null)
```

This works correctly when the host has yq v4 (Mike Farah's Go yq), which returns raw scalars. But yq v3 (kislyuk's Python yq) returns JSON-formatted scalars by default — so `yq '.languages[]' .devrail.yml` returns `"ruby"` (with quotes) instead of `ruby`.

Result: `HAS_RUBY := $(filter ruby,$(LANGUAGES))` matches against `"ruby"` and finds nothing, so `RUBY_DOCKER_ENV` doesn't get the `-e BUNDLE_APP_CONFIG=...` flags. Bundler then can't find project gems and lint fails.

Repro

On a host with yq v3 installed (Debian/Ubuntu `apt install yq` typically gives v3):

```bash
yq '.languages[]' .devrail.yml # returns "ruby" (quoted)
yq -r '.languages[]' .devrail.yml # returns ruby (raw)
```

Fix

Add `-r` flag (raw output). Works for both yq v3 and yq v4:

```make
LANGUAGES := $(shell yq -r '.languages[]' $(DEVRAIL_CONFIG) 2>/dev/null)
```

Filed from a downstream tipsyhive Makefile sync to v1.11.0 where this bit. Project-side patch applied at sync; happy to send a PR upstream if helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions