Skip to content

Conversation

@trz42
Copy link
Collaborator

@trz42 trz42 commented Feb 18, 2023

This adds changes that are in use for the NESSI bot instances. Among the changes

  • new arg -l | --list-repos to obtain a list of configured CernVM-FS repository identifiers
  • args to specify HTTP(S) proxies
  • http(s)_proxy env vars are used if set
  • if http_proxy is set, the default.local is augmented with CVMFS_HTTP_PROXY="${http_proxy}|PROXY_USING_IPv4" (the PROXY_USING_IPv4 uses the IPv4 address instead of the host name in http_proxy; it is determined by the script)
  • for easier parsing of --resume arguments it prints RESUME_FROM_DIR _DIR_ or RESUME_FROM_TGZ _PATH_TO_TGZ_
  • it stores repository information in the temporary storage to facilitate easier debugging of bot jobs

truib added 19 commits February 18, 2023 20:14
cherry-picked via commit b5bf008
ONLY picked chages to eessi_container.sh
cherry-picked via commit b5c07ee
NOTE, only applied changes to eessi_container.sh
fixed bugs

- determining IP address for proxy host was wrong
- handling of positional parameters for executing commands with arguments was wrong
NOTE only applied changes to eessi_container.sh
cherry-picked via commit fce504f
NOTE, only changed eessi_container.sh
cherry-picked via commit 23e773c
NOTE only applied changes to eessi_container.sh
cherry-picked via commit bfb1b29
Note, only part for eessi_container.sh included here
EESSI_HOST_STORAGE=$(mktemp -d --tmpdir eessi.XXXXXXXXXX)
echo "Using ${EESSI_HOST_STORAGE} as tmp storage (add '--resume ${EESSI_HOST_STORAGE}' to resume where this session ended)."
fi
echo "RESUME_FROM_DIR ${EESSI_HOST_STORAGE}"
Copy link
Contributor

Choose a reason for hiding this comment

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

No need for this imho, we can just grep line above?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed.

fi
[[ ${VERBOSE} -eq 1 ]] && echo "SINGULARITY_CACHEDIR=${SINGULARITY_CACHEDIR}"

# pull & convert image and reset CONTAINER
Copy link
Contributor

Choose a reason for hiding this comment

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

clarify this comment a bit?

explain that we want to ensure that same container was used as last time?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done that plus significantly improved it. Should also handle much better when we are resuming from a previous session. And also handles the case that CONTAINER was already pointing to an image file.


# pull & convert image and reset CONTAINER
CONTAINER_URL_FMT=".*://(.*)"
if [[ ${CONTAINER} == ${CONTAINER_URL_FMT} ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

should be using =~ here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because we use wildcards only, == should work too. However, using =~ might be safer anyway. Will change it.

cfg_load ${EESSI_REPOS_CFG_FILE}

# copy repos.cfg to job directory --> makes it easier to inspect the job
cp ${EESSI_REPOS_CFG_FILE} ${EESSI_TMPDIR}/repos_cfg/.
Copy link
Contributor

Choose a reason for hiding this comment

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

cp -a ${EESSI_REPOS_CFG_FILE} ${EESSI_TMPDIR}/repos_cfg/

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

[[ ${VERBOSE} -eq 1 ]] && echo "HTTP_PROXY_IPV4='${HTTP_PROXY_IPV4}'"
echo "CVMFS_HTTP_PROXY=\"${http_proxy}|http://${HTTP_PROXY_IPV4}:${PROXY_PORT}\"" \
>> ${EESSI_TMPDIR}/repos_cfg/default.local
cat ${EESSI_TMPDIR}/repos_cfg/default.local
Copy link
Contributor

Choose a reason for hiding this comment

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

if VERBOSE, also add echo "contents of .../default.local

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added and only printing when VERBOSE is set.

fi
tar cf ${TGZ} -C ${EESSI_TMPDIR} .
echo "Saved contents of '${EESSI_TMPDIR}' to '${TGZ}' (to resume, add '--resume ${TGZ}')"
echo "RESUME_FROM_TGZ ${TGZ}"
Copy link
Contributor

Choose a reason for hiding this comment

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

no need for this, we can grep for --resume in line above

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed.

echo "[EESSI/2021.12]" > cfg/repos.cfg
echo "repo_version = 2021.12" >> cfg/repos.cfg
echo "[EESSI/2023.02]" >> cfg/repos.cfg
echo "repo_version = 2023.02" >> cfg/repos.cfg
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe use 20XY.AB instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed.

@trz42
Copy link
Collaborator Author

trz42 commented Feb 21, 2023

Implemented first round of requested changes in commit 47cc1c6

# pull container to ${EESSI_TMPDIR} if it is not there yet (i.e. when
# resuming from a previous session)
if [[ ! -x ${EESSI_TMPDIR}/${CONTAINER_IMG} ]]; then
singularity pull ${EESSI_TMPDIR}/${CONTAINER_IMG} ${CONTAINER}
Copy link
Contributor

Choose a reason for hiding this comment

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

There will be situations in which you do want to re-pull the container image rather than using the existing one, for example if a fix was deployed for the container image.

So we should have a separate option for this, to enforce re-pulling the image? (future work, not in this PR)

Copy link
Contributor

Choose a reason for hiding this comment

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

Make sure that quiet option is also used here unless --verbose was used?

# pull container to ${EESSI_TMPDIR} if it is not there yet (i.e. when
# resuming from a previous session)
if [[ ! -x ${EESSI_TMPDIR}/${CONTAINER_IMG} ]]; then
singularity pull ${EESSI_TMPDIR}/${CONTAINER_IMG} ${CONTAINER}
Copy link
Contributor

Choose a reason for hiding this comment

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

Make sure that quiet option is also used here unless --verbose was used?

@boegel boegel force-pushed the update_for_eessi_container_sh branch from 9a615bf to c001fea Compare February 24, 2023 12:58
@boegel boegel force-pushed the update_for_eessi_container_sh branch from c001fea to a4cea9a Compare February 24, 2023 13:19
@boegel boegel changed the title Update for script eessi_container.sh enhancements/fixes for eessi_container.sh script Feb 24, 2023
@boegel boegel merged commit 7ea7058 into EESSI:main Feb 24, 2023
@trz42 trz42 deleted the update_for_eessi_container_sh branch March 16, 2023 10:44
TopRichard added a commit to TopRichard/software-layer that referenced this pull request Jan 19, 2024
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.

3 participants