Skip to content

Commit

Permalink
Merge pull request #215 from trz42/enhancement/single_src_for_defaults
Browse files Browse the repository at this point in the history
use separate script to determine EESSI pilot version and CVMFS repo
  • Loading branch information
boegel authored Feb 1, 2023
2 parents dc0c10a + 4d5cbce commit d7446ab
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 8 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/tests_readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# documentation: https://help.github.com/en/articles/workflow-syntax-for-github-actions
name: Tests for consistency of README.md
on:
push:
paths:
- README.md
- init/eessi_defaults

pull_request:
branches:
- main
paths:
- README.md
- init/eessi_defaults
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Check out software-layer repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0

- name: verify if README.md is consistent with EESSI_PILOT_VERSION from init/eessi_defaults
run: |
source init/eessi_defaults
grep "${EESSI_PILOT_VERSION}" README.md
- name: verify if README.md is consistent with EESSI_CVMFS_REPO from init/eessi_defaults
run: |
source init/eessi_defaults
grep "${EESSI_CVMFS_REPO}" README.md
2 changes: 1 addition & 1 deletion EESSI-pilot-install-software.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Script to install EESSI pilot software stack (version 2021.12)
# Script to install EESSI pilot software stack (version set through init/eessi_defaults)

# see example parsing of command line arguments at
# https://wiki.bash-hackers.org/scripting/posparams#using_a_while_loop
Expand Down
10 changes: 8 additions & 2 deletions build_container.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

base_dir=$(dirname $(realpath $0))

BUILD_CONTAINER="docker://ghcr.io/eessi/build-node:debian11"

if [ $# -lt 2 ]; then
Expand Down Expand Up @@ -39,9 +41,13 @@ if [ -z $SINGULARITY_HOME ]; then
export SINGULARITY_HOME="$EESSI_TMPDIR/home:/home/$USER"
fi

source ${base_dir}/init/eessi_defaults
# strip "/cvmfs/" from default setting
repo_name=${EESSI_CVMFS_REPO/\/cvmfs\//}

# set environment variables for fuse mounts in Singularity container
export EESSI_PILOT_READONLY="container:cvmfs2 pilot.eessi-hpc.org /cvmfs_ro/pilot.eessi-hpc.org"
export EESSI_PILOT_WRITABLE_OVERLAY="container:fuse-overlayfs -o lowerdir=/cvmfs_ro/pilot.eessi-hpc.org -o upperdir=$EESSI_TMPDIR/overlay-upper -o workdir=$EESSI_TMPDIR/overlay-work /cvmfs/pilot.eessi-hpc.org"
export EESSI_PILOT_READONLY="container:cvmfs2 ${repo_name} /cvmfs_ro/${repo_name}"
export EESSI_PILOT_WRITABLE_OVERLAY="container:fuse-overlayfs -o lowerdir=/cvmfs_ro/${repo_name} -o upperdir=$EESSI_TMPDIR/overlay-upper -o workdir=$EESSI_TMPDIR/overlay-work ${EESSI_CVMFS_REPO}"

# pass $EESSI_SOFTWARE_SUBDIR_OVERRIDE into build container (if set)
if [ ! -z ${EESSI_SOFTWARE_SUBDIR_OVERRIDE} ]; then
Expand Down
5 changes: 4 additions & 1 deletion create_tarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -e

base_dir=$(dirname $(realpath $0))

if [ $# -ne 4 ]; then
echo "ERROR: Usage: $0 <EESSI tmp dir (example: /tmp/$USER/EESSI)> <pilot version (example: 2021.03)> <CPU arch subdir (example: x86_64/amd/zen2)> <path to tarball>" >&2
exit 1
Expand All @@ -15,7 +17,8 @@ tmpdir=`mktemp -d`
echo ">> tmpdir: $tmpdir"

os="linux"
cvmfs_repo="/cvmfs/pilot.eessi-hpc.org"
source ${base_dir}/init/eessi_defaults
cvmfs_repo=${EESSI_CVMFS_REPO}

software_dir="${cvmfs_repo}/versions/${pilot_version}/software/${os}/${cpu_arch_subdir}"
if [ ! -d ${software_dir} ]; then
Expand Down
13 changes: 13 additions & 0 deletions init/eessi_defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# define default values for some EESSI_* environment variables
#
# This file is part of the EESSI software layer,
# see https://github.com/EESSI/software-layer
#
# author: Thomas Roeblitz (@trz42)
#
# license: GPLv2
#

export EESSI_CVMFS_REPO="${EESSI_CVMFS_REPO_OVERRIDE:=/cvmfs/pilot.eessi-hpc.org}"
export EESSI_PILOT_VERSION="${EESSI_PILOT_VERSION_OVERRIDE:=2021.12}"

10 changes: 8 additions & 2 deletions init/minimal_eessi_env
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# define minimal EESSI environment, without relying on external scripts
#
# this script is *sourced*, not executed, so can't rely on $0 to determine path to self
# $BASH_SOURCE points to correct path, see also http://mywiki.wooledge.org/BashFAQ/028
EESSI_INIT_DIR_PATH=$(dirname $(realpath $BASH_SOURCE))

# set up defaults: EESSI_CVMFS_REPO, EESSI_PILOT_VERSION
# script takes *_OVERRIDEs into account
source ${EESSI_INIT_DIR_PATH}/eessi_defaults

export EESSI_CVMFS_REPO="/cvmfs/pilot.eessi-hpc.org"
export EESSI_PILOT_VERSION="${EESSI_PILOT_VERSION_OVERRIDE:=2021.12}"
export EESSI_PREFIX=$EESSI_CVMFS_REPO/versions/$EESSI_PILOT_VERSION

if [[ $(uname -s) == 'Linux' ]]; then
Expand Down
3 changes: 2 additions & 1 deletion install_software_layer.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
export EESSI_PILOT_VERSION='2021.12'
base_dir=$(dirname $(realpath $0))
source ${base_dir}/init/eessi_defaults
./run_in_compat_layer_env.sh ./EESSI-pilot-install-software.sh "$@"
6 changes: 5 additions & 1 deletion run_in_compat_layer_env.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#!/bin/bash

base_dir=$(dirname $(realpath $0))
source ${base_dir}/init/eessi_defaults

if [ -z $EESSI_PILOT_VERSION ]; then
echo "ERROR: \$EESSI_PILOT_VERSION must be set!" >&2
exit 1
fi
EESSI_COMPAT_LAYER_DIR="/cvmfs/pilot.eessi-hpc.org/versions/${EESSI_PILOT_VERSION}/compat/linux/$(uname -m)"
EESSI_COMPAT_LAYER_DIR="${EESSI_CVMFS_REPO}/versions/${EESSI_PILOT_VERSION}/compat/linux/$(uname -m)"
if [ ! -d ${EESSI_COMPAT_LAYER_DIR} ]; then
echo "ERROR: ${EESSI_COMPAT_LAYER_DIR} does not exist!" >&2
exit 1
Expand Down

0 comments on commit d7446ab

Please sign in to comment.