Skip to content

Fail more quickly if the deb argument is wrong. - #2964

Open
3405691582 wants to merge 1 commit into
google:mainfrom
3405691582:baseimage_1
Open

Fail more quickly if the deb argument is wrong.#2964
3405691582 wants to merge 1 commit into
google:mainfrom
3405691582:baseimage_1

Conversation

@3405691582

Copy link
Copy Markdown
Collaborator

If there's a mistake or issue with the linux_image_deb argument, then this only gets detected later in the process after several minutes. This hopefully should check the argument earlier, failing a little more quicker.

@3405691582
3405691582 requested a review from ser-io August 4, 2026 19:21
If there's a mistake or issue with the linux_image_deb argument, then
this only gets detected later in the process after several minutes. This
hopefully should check the argument earlier, failing a little more
quicker.
@rmuthiah
rmuthiah enabled auto-merge August 4, 2026 23:36
@rmuthiah rmuthiah added kokoro:force-run Trigger a presubmit build unconditionally. kokoro:run Run e2e tests. labels Aug 4, 2026
@GoogleCuttlefishTesterBot GoogleCuttlefishTesterBot removed kokoro:run Run e2e tests. kokoro:force-run Trigger a presubmit build unconditionally. labels Aug 4, 2026
echo "CREATE IMAGE FAILED!!!"
echo "Package not found: ${linux_image_deb}"
exit 1
fi

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea, let's just make this logic part of the Golang binary. I think we can do a check just by pinging the debian endpoint:

        url := "https://packages.debian.org/[trixie|bookworm]/{linux_image_deb}"
        resp, err := http.Head(url)
        if err == nil && resp.StatusCode == http.StatusOK {
            fmt.Println("Exists (200 OK)")
        } else {
            fmt.Printf("Does not exist or error: %v (Status: %d)\n", err, resp.StatusCode)
        }

This way we would fail way faster as we won't need to create VM/disks and all of that stuff.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could do something like that, but that becomes brittle if the path changes or the apt/package mechanism changes.

also, https://packages.debian.org/trixie/foo returns 200 OK.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can rather use the /search endpoint:

curl -s "https://packages.debian.org/search?keywords=linux-image-6.12.101&suite=trixie&section=main" | grep -q "linux-image-6.12.100+deb13-cloud-amd64" && echo "Available" || echo "Not Available"

Given how ad-hoc this script is and how un-frequent is meant to be run I think is fine to rely on https://packages.debian.org/search in order to exit right away without engage on GCP resources. Verifying wether the package is valid via "chroot" and "apt" in this case would give us a better error message, however I think the delay for failing would almost be the same as we still need to create the vms, disks and so on which is the what takes the most when running this scripts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants