kubernetes-sigs / kubernetes-sigs/image-builder

Ensure functions don't check for the correct version of binaries

Open
#374 2 comments 0 reactions 0 assignees View on GitHub
lifecycle/frozen
Dominant language
Go Template
Stars
550
Forks
508
Avg merge
7d 10h
Merged PRs (30d)
8

Description

Received an error during building the an image. The `ensure-ansible` checks for Ansible to be installed but doesn't check the minimum version like the [ensure-goss.sh script does](https://github.com/kubernetes-sigs/image-builder/blob/62a757e8a547b976e97f5491140a4e48e461f42a/images/capi/hack/ensure-goss.sh#L45-L50). The output had `Right version of binary present` so I didn't initially notice that I had an older version of Packer:

```
make build-azure-vhd-ubuntu-1804
hack/ensure-ansible.sh
hack/ensure-packer.sh
hack/ensure-jq.sh
hack/ensure-azure-cli.sh
hack/ensure-goss.sh
Right version of binary present
./image-builder/images/capi/packer/azure/scripts/init-vhd.sh && packer build -var-file="/image-builder/images/capi/packer/config/kubernetes.json" -var-file="/image-builder/images/capi/packer/config/cni.json" -var-file="/image-builder/images/capi/packer/config/containerd.json" -var-file="/image-builder/images/capi/packer/config/ansible-args.json" -var-file="/image-builder/images/capi/packer/config/goss-args.json" -var-file="/image-builder/images/capi/packer/config/common.json" -color=true -var-file="/image-builder/images/capi/packer/azure/azure-config.json" -var-file="/image-builder/images/capi/packer/azure/azure-vhd.json" -var-file="/image-builder/images/capi/packer/azure/ubuntu-1804.json" -only="vhd-ubuntu-1804" packer/azure/packer.json


Error initializing core: error interpolating default value for 'containerd_url': template: root:1:71: executing "root" at : error calling user: test
make: *** [Makefile:254: build-azure-vhd-ubuntu-1804] Error 1
```

After upgrading to 1.6 this error went away.

## Reproduce
```
# install older version of package
sudo apt install packer=1.3.4+dfsg-4 -V
# build an image
make build-azure-vhd-ubuntu-1804
```
## Other info
The ensure scripts haver [versions ](https://github.com/kubernetes-sigs/image-builder/blob/62a757e8a547b976e97f5491140a4e48e461f42a/images/capi/hack/ensure-ansible.sh#L23) in them. Is there a minimum of each tool or should there be a hard check for the versions that are in the ensure scripts?

Contributor guide

Open the contributing guide

Research direction

Start with hack/ensure-ansible.sh and compare its version handling with hack/ensure-goss.sh, then review the other ensure scripts invoked by the build-azure-vhd-ubuntu-1804 Makefile target. Reproduce with the older Packer version shown in the issue and verify that outdated binaries are detected clearly before the image build proceeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
ansible, shell
Domain
build-system, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.