Skip to content

Commit

Permalink
build: Install yq, required to generate manifests
Browse files Browse the repository at this point in the history
Without yq, "inv generatemanifests" fails.

CI has been working because yq is installed on the GitHub Actions
runners. See
https://github.com/actions/runner-images/blob/650fb260cb8ba21ccccaff47470d3f43c94fbb3e/images/ubuntu/Ubuntu2204-Readme.md?plain=1#L105

Signed-off-by: Daniel Lipovetsky <[email protected]>
  • Loading branch information
dlipovetsky authored and fedepaol committed Feb 24, 2025
1 parent 2daaf89 commit e08873d
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
kind_path = os.path.join(build_path, "kind")
ginkgo_path = os.path.join(build_path, "bin", "ginkgo")
controller_gen_path = os.path.join(build_path, "bin", "controller-gen")
yq_path = os.path.join(build_path, "bin", "yq")
kubectl_version = "v1.31.0"
kind_version = "v0.24.0"
yq_version = "v4.45.1"


def _check_architectures(architectures):
Expand Down Expand Up @@ -1466,10 +1468,9 @@ def generate_deepcopy():


def _align_helm_crds(source, output):
fetch_yq()
run(
"""yq eval-all 'select(.kind == "CustomResourceDefinition")' {} > {}""".format(
source, output
)
f"""{yq_path} eval-all 'select(.kind == "CustomResourceDefinition")' {source} > {output}"""
)
run("sed -i 's/metallb-system/{{{{ .Release.Namespace }}}}/g' {}".format(output))

Expand Down Expand Up @@ -1590,6 +1591,22 @@ def fetch_ginkgo():
)


@cache
def fetch_yq():
fetch_command = (
f"GOBIN={build_path}/bin/ GOPATH={build_path} go install github.com/mikefarah"
f"/yq/v4@{yq_version}"
)
get_version_command = f"{yq_path} --version"
fetch_dependency(
yq_path,
yq_version,
fetch_command,
get_version_command,
"yq (https://github.com/mikefarah/yq/) version ",
)


def fetch_dependency(
path: str,
version: str,
Expand Down

0 comments on commit e08873d

Please sign in to comment.