diff --git a/Makefile b/Makefile index 9031257a..20f28f02 100644 --- a/Makefile +++ b/Makefile @@ -162,6 +162,7 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen ENVTEST ?= $(LOCALBIN)/setup-envtest OPERATOR_SDK ?= $(LOCALBIN)/operator-sdk MKDOCS ?= $(LOCALBIN)/mkdocs/bin/mkdocs +ZC ?= $(LOCALBIN)/zc/bin/zuul-client ## Tool Versions KUSTOMIZE_VERSION ?= v5.3.0 @@ -170,12 +171,18 @@ OPERATOR_SDK_VERSION ?= 1.34.2 STATICCHECK_VERSION ?= 2023.1.7 MKDOCS_VERSION ?= 1.5.3 SETUP_ENVTEST_VERSION ?= v0.0.0-20240320141353-395cfc7486e6 +ZUUL_CLIENT_VERSION ?= 10.0.0 .PHONY: mkdocs mkdocs: $(MKDOCS) ## Install material for mkdocs locally if necessary $(MKDOCS): $(LOCALBIN) ( test -f $(LOCALBIN)/mkdocs/bin/mkdocs && [[ "$(shell $(LOCALBIN)/mkdocs/bin/mkdocs -V)" =~ "$(MKDOCS_VERSION)" ]] ) || ( python -m venv $(LOCALBIN)/mkdocs && $(LOCALBIN)/mkdocs/bin/pip install --upgrade -r mkdocs-requirements.txt ) +.PHONY: zuul-client +zuul-client: $(ZC) ## Install zuul-client locally if necessary +$(ZC): $(LOCALBIN) + ( test -f $(LOCALBIN)/zc/bin/zuul-client && [[ "$(shell $(LOCALBIN)/zc/bin/zuul-client --version)" =~ "$(ZUUL_CLIENT_VERSION)" ]] ) || ( python -m venv $(LOCALBIN)/zc && $(LOCALBIN)/zc/bin/pip install zuul-client ) + KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/kustomize/${KUSTOMIZE_VERSION}/hack/install_kustomize.sh" .PHONY: kustomize kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. diff --git a/flake.nix b/flake.nix index 6273030e..b4e860ef 100644 --- a/flake.nix +++ b/flake.nix @@ -23,6 +23,7 @@ ]; shellHook = '' echo "Welcome in $name" + export LC_ALL=C.UTF-8 export GOPATH=$(go env GOPATH) export GOBIN=$(go env GOPATH)/bin ''; diff --git a/roles/health-check/zuul-client-api/tasks/main.yaml b/roles/health-check/zuul-client-api/tasks/main.yaml index fca610b9..cd7866d7 100644 --- a/roles/health-check/zuul-client-api/tasks/main.yaml +++ b/roles/health-check/zuul-client-api/tasks/main.yaml @@ -1,3 +1,11 @@ +- name: Ensure zuul-client installation + community.general.make: + target: "zuul-client" + chdir: "{{ zuul.project.src_dir }}" + +- set_fact: + zuul_client: "{{ zuul.project.src_dir }}/bin/zc/bin/zuul-client" + - name: Create a zuul-client configuration file ansible.builtin.shell: > go run ./main.go --config playbooks/files/sf-operator-cli.yaml zuul create client-config --insecure @@ -12,13 +20,11 @@ - name: Create a autohold request with zuul-client and the generated config ansible.builtin.command: | - zuul-client -c /tmp/zuul-client.conf --use-config internal autohold --project config --job config-update --reason CI_TEST - args: - chdir: "{{ zuul.project.src_dir }}" + {{ zuul_client }} -c /tmp/zuul-client.conf --use-config internal autohold --project config --job config-update --reason CI_TEST - name: Ensure autohold was set properly ansible.builtin.command: | - zuul-client -c /tmp/zuul-client.conf --use-config internal autohold-list + {{ zuul_client }} -c /tmp/zuul-client.conf --use-config internal autohold-list register: _ah_list failed_when: '"CI_TEST" not in _ah_list.stdout' @@ -26,4 +32,4 @@ ansible.builtin.shell: > echo "{{ _ah_list.stdout }}" | grep -oE "0000[0-9]+" | - xargs zuul-client -c /tmp/zuul-client.conf --use-config internal autohold-delete + xargs {{ zuul_client }} -c /tmp/zuul-client.conf --use-config internal autohold-delete diff --git a/roles/setup-env/tasks/main.yaml b/roles/setup-env/tasks/main.yaml index b93e67d7..2e68f35b 100644 --- a/roles/setup-env/tasks/main.yaml +++ b/roles/setup-env/tasks/main.yaml @@ -78,4 +78,3 @@ - kubernetes - oauthlib>=3.2.2 - websocket-client - - zuul-client