Skip to content

Commit fc28a9d

Browse files
committed
ci - ensure zuul-client installation in src_dir/bin instead of user home_dir
This change avoids the interaction with the user home directory by installing zuul-client at a controlled version in the local project bin/ directory. Change-Id: Ia02f0adf5ff21cc91384ba4d26f29d3ab1943b84
1 parent e557b0a commit fc28a9d

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
162162
ENVTEST ?= $(LOCALBIN)/setup-envtest
163163
OPERATOR_SDK ?= $(LOCALBIN)/operator-sdk
164164
MKDOCS ?= $(LOCALBIN)/mkdocs/bin/mkdocs
165+
ZC ?= $(LOCALBIN)/zc/bin/zuul-client
165166

166167
## Tool Versions
167168
KUSTOMIZE_VERSION ?= v5.3.0
@@ -170,12 +171,18 @@ OPERATOR_SDK_VERSION ?= 1.34.2
170171
STATICCHECK_VERSION ?= 2023.1.7
171172
MKDOCS_VERSION ?= 1.5.3
172173
SETUP_ENVTEST_VERSION ?= v0.0.0-20240320141353-395cfc7486e6
174+
ZUUL_CLIENT_VERSION ?= 10.0.0
173175

174176
.PHONY: mkdocs
175177
mkdocs: $(MKDOCS) ## Install material for mkdocs locally if necessary
176178
$(MKDOCS): $(LOCALBIN)
177179
( 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 )
178180

181+
.PHONY: zuul-client
182+
zuul-client: $(ZC) ## Install zuul-client locally if necessary
183+
$(ZC): $(LOCALBIN)
184+
( 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 )
185+
179186
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/kustomize/${KUSTOMIZE_VERSION}/hack/install_kustomize.sh"
180187
.PHONY: kustomize
181188
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.

flake.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
];
2424
shellHook = ''
2525
echo "Welcome in $name"
26+
export LC_ALL=C.UTF-8
2627
export GOPATH=$(go env GOPATH)
2728
export GOBIN=$(go env GOPATH)/bin
2829
'';

roles/health-check/zuul-client-api/tasks/main.yaml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
- name: Ensure zuul-client installation
2+
community.general.make:
3+
target: "zuul-client"
4+
chdir: "{{ zuul.project.src_dir }}"
5+
6+
- set_fact:
7+
zuul_client: "{{ zuul.project.src_dir }}/bin/zc/bin/zuul-client"
8+
19
- name: Create a zuul-client configuration file
210
ansible.builtin.shell: >
311
go run ./main.go --config playbooks/files/sf-operator-cli.yaml zuul create client-config --insecure
@@ -12,18 +20,16 @@
1220

1321
- name: Create a autohold request with zuul-client and the generated config
1422
ansible.builtin.command: |
15-
zuul-client -c /tmp/zuul-client.conf --use-config internal autohold --project config --job config-update --reason CI_TEST
16-
args:
17-
chdir: "{{ zuul.project.src_dir }}"
23+
{{ zuul_client }} -c /tmp/zuul-client.conf --use-config internal autohold --project config --job config-update --reason CI_TEST
1824
1925
- name: Ensure autohold was set properly
2026
ansible.builtin.command: |
21-
zuul-client -c /tmp/zuul-client.conf --use-config internal autohold-list
27+
{{ zuul_client }} -c /tmp/zuul-client.conf --use-config internal autohold-list
2228
register: _ah_list
2329
failed_when: '"CI_TEST" not in _ah_list.stdout'
2430

2531
- name: Remove autohold
2632
ansible.builtin.shell: >
2733
echo "{{ _ah_list.stdout }}" |
2834
grep -oE "0000[0-9]+" |
29-
xargs zuul-client -c /tmp/zuul-client.conf --use-config internal autohold-delete
35+
xargs {{ zuul_client }} -c /tmp/zuul-client.conf --use-config internal autohold-delete

roles/setup-env/tasks/main.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,3 @@
7878
- kubernetes
7979
- oauthlib>=3.2.2
8080
- websocket-client
81-
- zuul-client

0 commit comments

Comments
 (0)