Skip to content

Commit bc0741a

Browse files
authored
build: Fix devbox run errors due to piped commands (#773)
Piping from and to devbox commands leads to errors like `Text file busy` or `No file found` as they attempt to write their respective commands to temporary files. Moving these to devbox scripts should fix this and bring CI back to stable.
1 parent 22c5f0f commit bc0741a

File tree

5 files changed

+19
-18
lines changed

5 files changed

+19
-18
lines changed

.github/workflows/checks.yml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ jobs:
191191

192192
lint-test-helm:
193193
runs-on: ubuntu-22.04
194+
env:
195+
KIND_CLUSTER_NAME: chart-testing
194196
steps:
195197
- name: Checkout
196198
uses: actions/checkout@v4
@@ -220,34 +222,26 @@ jobs:
220222
221223
- if: steps.list-changed.outputs.changed == 'true'
222224
name: Create kind cluster
223-
run: |
224-
devbox run -- \
225-
kind create cluster \
226-
--image=ghcr.io/mesosphere/kind-node:"$(devbox run -- kubectl version --output=json --client | devbox run -- gojq --raw-output .clientVersion.gitVersion)" \
227-
--name=chart-testing
225+
run: devbox run -- make kind.create
228226
env:
229227
KUBECONFIG: ct-kind-kubeconfig
230228

231229
- if: steps.list-changed.outputs.changed == 'true'
232230
name: Build Docker images
233-
run: |
234-
devbox run -- \
235-
make release-snapshot
231+
run: devbox run -- make release-snapshot
236232

237233
- if: steps.list-changed.outputs.changed == 'true'
238234
name: Sideload docker image
239235
run: |
240236
devbox run -- \
241237
kind load docker-image \
242-
--name chart-testing \
238+
--name "${KIND_CLUSTER_NAME}" \
243239
"ko.local/cluster-api-runtime-extensions-nutanix:$(devbox run -- gojq -r .version dist/metadata.json)" \
244240
"ghcr.io/nutanix-cloud-native/caren-helm-reg:$(devbox run -- gojq -r .version dist/metadata.json)-$(devbox run -- go env GOARCH)"
245241
246242
- if: steps.list-changed.outputs.changed == 'true'
247243
name: Setup Cluster API and cert-manager
248-
run: |
249-
devbox run -- \
250-
make clusterctl.init
244+
run: devbox run -- make clusterctl.init
251245
env:
252246
KIND_KUBECONFIG: ct-kind-kubeconfig
253247

@@ -264,8 +258,7 @@ jobs:
264258
- if: steps.list-changed.outputs.changed == 'true' && always()
265259
name: Delete chart-testing KinD cluster
266260
run: |
267-
devbox run -- \
268-
kind delete cluster --name chart-testing || true
261+
devbox run -- make kind.delete
269262
270263
govulncheck:
271264
runs-on: ubuntu-22.04

.github/workflows/e2e.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ jobs:
8181
id: get-control-plane-endpoint-ip
8282
if: inputs.provider == 'Nutanix'
8383
run: |
84-
CONTROL_PLANE_ENDPOINT_RANGE_START="${{ vars.NUTANIX_CONTROL_PLANE_ENDPOINT_RANGE_START }}"
85-
CONTROL_PLANE_ENDPOINT_RANGE_END="${{ vars.NUTANIX_CONTROL_PLANE_ENDPOINT_RANGE_END }}"
86-
control_plane_endpoint_ip="$(devbox run -- fping -g -u "${CONTROL_PLANE_ENDPOINT_RANGE_START}" "${CONTROL_PLANE_ENDPOINT_RANGE_END}" | devbox run -- shuf --head-count=1)"
84+
export CONTROL_PLANE_ENDPOINT_RANGE_START="${{ vars.NUTANIX_CONTROL_PLANE_ENDPOINT_RANGE_START }}"
85+
export CONTROL_PLANE_ENDPOINT_RANGE_END="${{ vars.NUTANIX_CONTROL_PLANE_ENDPOINT_RANGE_END }}"
86+
control_plane_endpoint_ip="$(devbox run -- make nutanix-cp-endpoint-ip)"
8787
echo "control_plane_endpoint_ip=${control_plane_endpoint_ip}" >> "${GITHUB_OUTPUT}"
8888
8989
- name: Check Control Plane endpoint IP

.github/workflows/github-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
env:
5656
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5757
run: |
58-
mapfile -t releases < <( devbox run -- gh release list --json tagName | devbox run -- gojq -r .[].tagName )
58+
mapfile -t releases < <( devbox run -- make list-releases )
5959
for release in "${releases[@]}"; do
6060
if devbox run -- gh release download "${release}" \
6161
--pattern 'cluster-api-runtime-extensions-nutanix-*.tgz' \

make/dev.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,7 @@ endif
5555
gojq --yaml-input --raw-output '.variables | to_entries | map("export \(.key)=\(.value|tostring)")|.[]' < test/e2e/config/caren.yaml | envsubst > .envrc.e2e
5656
setup-envtest use -p env $(ENVTEST_VERSION) >> .envrc.e2e
5757
direnv reload
58+
59+
.PHONY: nutanix-cp-endpoint-ip
60+
nutanix-cp-endpoint-ip: ## Gets a random IP from the control plane endpoint range.
61+
shuf --head-count=1 < <(fping -g -u "$(CONTROL_PLANE_ENDPOINT_RANGE_START)" "$(CONTROL_PLANE_ENDPOINT_RANGE_END)")

make/goreleaser.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,7 @@ release-snapshot: go-generate ; $(info $(M) building snapshot release $*)
3737
--clean \
3838
--parallelism=$(GORELEASER_PARALLELISM) \
3939
--timeout=60m
40+
41+
.PHONY: list-releases
42+
list-releases: ## List releases from GitHub
43+
gh release list --json tagName | gojq -r .[].tagName

0 commit comments

Comments
 (0)