OSPOOL-158: Add NRP OSPool EP image builds - #308
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new osg-htc/nrp-ospool-ep container image (and supporting init/entrypoint scripts) intended for NRP OSPool EP usage, and updates the GitHub Actions container build workflow to detect images under osg-htc/ in addition to opensciencegrid/.
Changes:
- Introduces a new
nrp-ospool-epimage (Dockerfile + build-config) with custom entrypoint behavior and HTCondor/pilot configuration scripts. - Adds wrapper scripts for singularity/apptainer to strip
--pid/-pand adjusts runtime validation scripts. - Updates
.github/workflows/build-containers.ymlto includeosg-htc/...image directories when building the image list.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
osg-htc/nrp-ospool-ep/Dockerfile |
Defines the new EP-derived image and wires in runtime/init scripts. |
osg-htc/nrp-ospool-ep/build-config.json |
Declares build matrix inputs (OS/series/repos) for the new image. |
osg-htc/nrp-ospool-ep/scripts/entrypoint.sh |
New entrypoint wrapper to run image-config hooks and supervise the pilot process. |
osg-htc/nrp-ospool-ep/scripts/check_master.sh |
Adds condor_master monitoring/diagnostics for termination/restart handling. |
osg-htc/nrp-ospool-ep/scripts/singularity_npid.sh |
Wrapper to drop --pid/-p and rewrite related flags. |
osg-htc/nrp-ospool-ep/scripts/apptainer_npid.sh |
Wrapper to drop --pid/-p and rewrite related flags. |
osg-htc/nrp-ospool-ep/scripts/01_token.sh |
Exposes the pilot token as an env var for osgvo-pilot. |
osg-htc/nrp-ospool-ep/scripts/01_no_condor_host.sh |
Unsets CONDOR_HOST to satisfy osgvo-pilot expectations. |
osg-htc/nrp-ospool-ep/scripts/02_validate_singularity.sh |
Adds a basic singularity execution validation at init time. |
osg-htc/nrp-ospool-ep/scripts/02_validate_apptainer.sh |
Adds a basic apptainer execution validation at init time. |
osg-htc/nrp-ospool-ep/scripts/11_set_OSGInstitutionID.sh |
Attempts to derive OSG_INSTITUTION_ID from k8s node labels. |
osg-htc/nrp-ospool-ep/scripts/19_set_resources.sh |
Sets advertised CPU/memory/disk/GPU slot/resource config. |
osg-htc/nrp-ospool-ep/scripts/20_advertise_glidein.sh |
Advertises glidein attribute(s) into the pilot config. |
osg-htc/nrp-ospool-ep/scripts/20_advertise_k8s_domain.sh |
Advertises k8s pod/domain/namespace/physical host into the pilot config. |
osg-htc/nrp-ospool-ep/scripts/21_advertise_k8s_provisioner.sh |
Advertises k8s provisioner name/type into the pilot config. |
osg-htc/nrp-ospool-ep/scripts/22_set_requirements.sh |
Adds matching/provisioning requirements expressions into the pilot config. |
.github/workflows/build-containers.yml |
Expands image discovery to include osg-htc/... directories. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if [ $npids -gt 1 ]; then | ||
| echo "condor_master restrated" 1>&2 | ||
| break | ||
| fi | ||
|
|
||
| if [ $nprocs -ne 1 ]; then | ||
| echo "condor_master not running" 1>&2 | ||
| break | ||
| fi |
There was a problem hiding this comment.
check_master.sh computes nprocs once (line 25) but then uses it inside the monitoring loop (line 49) without recomputing it after each sleep. This means the loop may never detect a restarted/dead condor_master based on process state. Recompute the process check inside the loop (and consider using ps -p "$orgpid" or similar to avoid grep-based matching).
| trap 'echo signal received!; kill $(jobs -p); wait' SIGINT SIGTERM | ||
|
|
||
| export HOME=/pilot | ||
| su osg -p -c "/usr/local/sbin/entrypoint.osg.sh $@" & |
There was a problem hiding this comment.
su ... -c "/usr/local/sbin/entrypoint.osg.sh $@" builds a shell command by interpolating the container's arguments into a string. This is fragile (breaks on spaces/quoting) and can allow shell metacharacters in args to be interpreted by the shell invoked by su -c. Prefer passing arguments without re-parsing (e.g., use su's ability to pass additional args to the shell, or switch to runuser/gosu/setpriv so you can exec the target with a proper "$@" argument vector).
| su osg -p -c "/usr/local/sbin/entrypoint.osg.sh $@" & | |
| su osg -p -s /bin/bash -c 'exec /usr/local/sbin/entrypoint.osg.sh "$@"' -- "$@" & |
34374da to
f09cdf3
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…fixed condor config
f09cdf3 to
7311aae
Compare
|
I've removed the osg-htc push support since we added that in #317 |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
Suppressed comments (11)
osg-htc/nrp-ospool-ep/scripts/check_master.sh:52
nprocsis only computed once (before the loop) but is used inside the monitoring loop, so the "condor_master not running" check never reflects current state. Recomputenprocsinside the loop (preferps -pto avoid matching the grep process itself).
if [ $nprocs -ne 1 ]; then
echo "condor_master not running" 1>&2
break
fi
osg-htc/nrp-ospool-ep/scripts/check_master.sh:19
- Spelling: "restrated" -> "restarted".
echo "condor_master restrated at first step" 1>&2
osg-htc/nrp-ospool-ep/scripts/check_master.sh:45
- Spelling: "restrated" -> "restarted".
echo "condor_master restrated" 1>&2
osg-htc/nrp-ospool-ep/scripts/entrypoint.sh:10
su -c "/usr/local/sbin/entrypoint.osg.sh $@"expands$@in the current shell, which can break argument quoting and allow shell metacharacters in args to be re-interpreted by thesu -cshell. Pass args viabash -cpositional parameters instead.
su osg -p -c "/usr/local/sbin/entrypoint.osg.sh $@" &
osg-htc/nrp-ospool-ep/scripts/entrypoint.sh:13
- Spelling/grammar in comment: "terminate oby itself" -> "terminate on its own".
# protection in case it does not terminate oby itself when condor dies or restarts
osg-htc/nrp-ospool-ep/scripts/check_master.sh:61
- Typo in the StartLog path:
/pilotl/log/StartLogwill fail and hide useful diagnostics. This should be/pilot/log/StartLog.
tail -100 /pilotl/log/StartLog
osg-htc/nrp-ospool-ep/scripts/02_validate_apptainer.sh:14
- Comment says "if singularity is present" but this script is validating apptainer.
# only test for apptainer functionality if singularity is present
# may not be in all pods
osg-htc/nrp-ospool-ep/scripts/01_token.sh:7
- If the token file is missing/unreadable, this silently exports an empty
TOKENand failures happen later. Fail fast with a clear error and avoid backticks/UUOC.
export TOKEN=`cat /etc/condor/tokens.d/prp-wn.token`
osg-htc/nrp-ospool-ep/scripts/01_no_condor_host.sh:4
- Spelling/grammar in comment: "does not like is CONDOR_HOST is set" -> "does not like it if CONDOR_HOST is set".
# osgvo pilot does not like is CONDOR_HOST is set
osg-htc/nrp-ospool-ep/Dockerfile:66
- This repo’s Dockerfiles consistently use uppercase instructions (e.g.,
ENV ...). Usingenvhere is inconsistent and can be confusing; switch toENVfor both variables.
env ACCEPT_JOBS_FOR_HOURS=24
# keep default idle time low, as we may over-provision certain kinds of resources
# but others may be waiting
env ACCEPT_IDLE_MINUTES=20
osg-htc/nrp-ospool-ep/Dockerfile:24
- The Docker build downloads whatever kubectl version is current at build time and does not verify its integrity (checksum/signature). This is a supply-chain risk and makes builds non-reproducible; pin a version and verify the download (or install from a trusted package repo).
# Add kubectl, to be able to interact with the k8s cluster
RUN curl -L "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" -o /usr/sbin/kubectl && \
chmod u+x /usr/sbin/kubectl
| if [ "x${OSG_INSTITUTION_ID}" == "x" ]; then | ||
| OSG_INSTITUTION_ID=`/usr/sbin/kubectl get node ${PHYSICAL_HOSTNAME} -L nautilus.io/OSGInstitutionID | tail -1 | awk '{print $6}'` | ||
| if [ "x${OSG_INSTITUTION_ID}" != "x" ]; then | ||
| export OSG_INSTITUTION_ID | ||
| fi | ||
| fi |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
matyasselmeci
left a comment
There was a problem hiding this comment.
Here's a couple of typos noticed by copilot that it didn't make suggestions for.
Co-authored-by: Matyas Selmeci <mselmeci@wisc.edu>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
|
||
| # else do nothing, let Condor figure it out | ||
|
|
||
| if [ -f "/usr/bin/apptainer" ]; then |
There was a problem hiding this comment.
Not sure why this check: the Dockerfile explicitly creates /usr/bin/apptainer, so this is always true.
|
|
||
| # else do nothing, let Condor figure it out | ||
|
|
||
| if [ -f "/usr/bin/singularity" ]; then |
There was a problem hiding this comment.
Not sure why this check: the Dockerfile explicitly creates /usr/bin/singularity, so this is always true.
|
Note that this image depends on CVMFS because the apptainer/singularity checks (which must pass) use apptainer and singularity from OASIS, and the image from /cvmfs/singularity.opensciencegrid.org. That's fine, but we should probably make that check explicit to save us some debugging time if CVMFS fails. |
|
One notable difference between this and the ospool-ep image is that in this image, if apptainer/singularity fail validation, the entire container aborts (as opposed to continuing without singularity/apptainer support). |
@ashtongraves @djw8605 @jthiltges is running user payloads in apptainer a requirement on the NRP side?
We should probably just change this since HTCondor explicitly packages apptainer now. We may as well rely on that since there's a bunch of testing that goes into version compat upstream. |
No not a requirement on NRP side, moreso OSG side. We're currently running a modified version of the EP image that lets it fail on the apptainer check and run without apptainer while we're waiting. |
Hrm, we don't have that requirement in the base OSPool images so I think we can just rip it out! @matyasselmeci if this looks good enough, then I think we should just merge this and rip out the failure in a follow-on PR |
|
How do you feel about adding a |
|
@matyasselmeci sounds good to me but I think that means that step 1 is still merging this PR unless there are other blockers? |
|
Right, I think this is OK to merge. We can save some of my other comments for subsequent PRs. |
matyasselmeci
left a comment
There was a problem hiding this comment.
Approving this; we'll fix remaining issues in separate PRs.
I bet this will fail, at the very least because the Harbor user for pushing images probably doesn't have permissions to push to the
osg-htcproject.