Skip to content

ci: verify MidnightBSD prerequisites after installation - #23293

Open
manwwe wants to merge 2 commits into
curl:masterfrom
manwwe:ci-midnightbsd-prereqs
Open

manwwe wants to merge 2 commits into
curl:masterfrom
manwwe:ci-midnightbsd-prereqs

Conversation

@manwwe

@manwwe manwwe commented Oct 6, 2026

Copy link
Copy Markdown

MidnightBSD CI can continue after a prerequisite fails to install, producing a misleading error later, such as cmake: not found. Since mport also returns nonzero after successful installations, check that every requested package is installed using mport -U info.

If a package is missing, print the installation log, list the missing prerequisites, and stop the job.

Fixes #23291

Validation on MidnightBSD 4.0.4:

  • Fresh and repeat prerequisite installations passed.
  • A nonexistent prerequisite failed with the expected diagnostics.
  • Shell syntax, YAML syntax, and git diff --check passed.

Full GitHub Actions execution and an actual download failure remain untested.

AI disclosure: Codex helped investigate, implement, and test this change. I’m responsible for the contribution.

@github-actions github-actions Bot added the CI Continuous Integration label Oct 6, 2026
sudo mport install pkgconf brotli libnghttp2 ${MATRIX_INSTALL} | grep -v -E '(Downloading.+%|^/usr/local)' || true
log=$(mktemp) || exit $?
sudo mport install pkgconf brotli libnghttp2 ${MATRIX_INSTALL} > "${log}" 2>&1 || true
# mport can return nonzero after success; check installed packages.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this simply the case? That explains a lot.

Comment thread .github/workflows/non-native.yml Outdated
sudo mport install pkgconf brotli libnghttp2 ${MATRIX_INSTALL} > "${log}" 2>&1 || true
# mport can return nonzero after success; check installed packages.
missing=''
for package in pkgconf brotli libnghttp2 ${MATRIX_INSTALL}; do

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't like the package list being duplicated here.

Comment thread .github/workflows/non-native.yml Outdated
done
if [ -n "${missing}" ]; then
cat "${log}"
rm -f "${log}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This isn't really needed; the container will be destroyed in a moment already.

echo "Missing prerequisites:${missing}" >&2
exit 1
fi
grep -v -E '(Downloading.+%|^/usr/local)' "${log}" || true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The grep will always succeed if we make it here, right? Then the || true can be dropped.

Comment thread .github/workflows/non-native.yml Outdated
sudo mport upgrade | grep -v -E '(Downloading.+%|^/usr/local)'
fi
sudo mport install pkgconf brotli libnghttp2 ${MATRIX_INSTALL} | grep -v -E '(Downloading.+%|^/usr/local)' || true
log=$(mktemp) || exit $?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The exit shouldn't be needed here; the error status should already cause the workflow to fail.

Comment thread .github/workflows/non-native.yml Outdated
if [ -n "${missing}" ]; then
cat "${log}"
rm -f "${log}"
echo "Missing prerequisites:${missing}" >&2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This could be simplified by checking immediately after each mport info command rather than storing a list of failures in $missing. The exact packages having failed aren't that interesting, only that at least one has failed. The log will show everything once it's cat'ed.

@manwwe

manwwe commented Oct 7, 2026

Copy link
Copy Markdown
Author

Hi there!

I updated the workflow in f222215]

  • Reused one package list for installation and verification.
  • Stopped at the first failed package check and printed the installation log.
  • Removed temporary-file cleanup and the explicit exit after mktemp.

I kept grep … || true because grep returns 1 when every line is filtered out, which could fail an otherwise successful installation.

I also confirmed that mport returns 1 after successfully installing all prerequisites and on a repeat run with everything already installed.

I tested the revised block on MidnightBSD 4.0.4: installed prerequisites passed, and a nonexistent prerequisite failed as expected.

Changed test to workflow for accuracy, added I before tested, and formatted commands as code.

@vszakats

vszakats commented Oct 7, 2026

Copy link
Copy Markdown
Member

My (non-LLM), one-liner proposal: #23294

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

Labels

CI Continuous Integration

Development

Successfully merging this pull request may close these issues.

*BSD CI workflow runs despite package install failing

3 participants