Skip to content

Re-organize Bash scripts #20856

@ivanvc

Description

@ivanvc

What would you like to be added?

This is a follow-up on #20850 (comment).

Currently, our Bash scripts follow a custom convention of defining the Makefile targets as "passes" that are in the scripts/{test,build,etc}.sh files. This custom (and undocumented) way of maintaining the scripts is difficult to follow by new contributors. Because of this, we currently don't have a standard and have a lot of duplication in our Makefile, spread across different files, and approaches to run these targets/functionality.

Examples of fragmented architecture

  1. Custom "PASSES" framework:

    etcd/Makefile

    Lines 109 to 111 in 855c9ba

    .PHONY: verify-bom
    verify-bom:
    PASSES="bom" ./scripts/test.sh
  2. Executing a Bash script:

    etcd/Makefile

    Lines 229 to 231 in 855c9ba

    .PHONY: sync-toolchain-directive
    sync-toolchain-directive:
    ./scripts/sync_go_toolchain_directive.sh
  3. Embedded scripts in the Makefile target:

    etcd/Makefile

    Lines 171 to 178 in 855c9ba

    YAMLFMT_VERSION = $(shell cd tools/mod && go list -m -f '{{.Version}}' github.com/google/yamlfmt)
    .PHONY: fix-yamllint
    fix-yamllint:
    ifeq (, $(shell command -v yamlfmt))
    $(shell go install github.com/google/yamlfmt/cmd/yamlfmt@$(YAMLFMT_VERSION))
    endif
    yamlfmt -conf tools/.yamlfmt .

We want to simplify and standardize this, without creating a difficult custom framework to implement and maintain.

Why is this needed?

To improve the maintainability of our Bash scripts.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions