-
Notifications
You must be signed in to change notification settings - Fork 66
Draft: Licensing #1149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hvelab
wants to merge
42
commits into
EESSI:main
Choose a base branch
from
hvelab:licenses
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Draft: Licensing #1149
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
d71d2df
cleaner PR
957a892
fix
5a17a45
test
ccc76ad
change eb loading
9d93837
change eb loading
8f86fa4
now add an installation
9e0475b
only get modified easystacks
3e22835
now without using gh
f4870dc
debugging purposes
8081eae
fixed typo
0191252
debugging purposes
b3e9508
debugging purposes
045163c
fixed commit hash
0baa570
debugging purposes
ad96592
debugging purposes
d98392d
rookie mistake
053c97f
indentation matters
9ee00dd
typo
4e7525b
debug & bugfix
4cbb842
debug & bugfix 2
a2d934b
making variables global
10dc7e3
making variables global part 2
370b78c
refining the puzzle
03547d7
another rookie mistake
3607f27
solving environment
cb1390f
solving incosistency
a34bc01
fixing typos
42b382c
fixes before testing
0a127de
fixing environment
3bb8032
missing file
31f4284
fix
3462e07
testing more things
2ce9ef5
Update .github/workflows/check_licenses.yml
hvelab 4b26b2f
testing with matrix
91cb66c
checking if --robot makes a difference
c0fa34b
robot deleted, fail-fast added
a0e0a67
tiny fixes
f002228
yet another tiny fix
d13b1bd
rework on missing modules file
22c192a
typo fix
a0bf545
fixing format and adding .yaml files
e37a01f
first tests with new taml syntax and pipeline adaptation
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,149 @@ | ||
| name: Check and update licenses | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ "main" ] | ||
| pull_request: | ||
| branches: [ "main" ] | ||
| # types: [opened, synchronized] | ||
| permissions: | ||
| contents: read # we dont need to write | ||
|
|
||
| jobs: | ||
| license_update: | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| # we just do these two architectures for now as they are ones causing more discrepancies | ||
| include: | ||
| - runs_on: ubuntu-24.04-arm | ||
| EESSI_SOFTWARE_SUBDIR_OVERRIDE: aarch64/generic | ||
| - runs_on: ubuntu-24.04 | ||
| EESSI_SOFTWARE_SUBDIR_OVERRIDE: x86_64/generic | ||
|
|
||
| runs-on: ${{ matrix.runs_on }} | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: eessi/github-action-eessi@v3 | ||
|
|
||
| - name: Check for missing installlations | ||
| env: | ||
| PR_NUMBER: ${{ github.event.number }} | ||
|
|
||
| run: | | ||
| export EESSI_SOFTWARE_SUBDIR_OVERRIDE=${{matrix.EESSI_SOFTWARE_SUBDIR_OVERRIDE}} | ||
| source /cvmfs/software.eessi.io/versions/${EESSI_VERSION}/init/bash | ||
|
|
||
| # set $EESSI_CPU_FAMILY to the CPU architecture that corresponds to $EESSI_SOFTWARE_SUBDIR_OVERRIDE (part before the first slash), | ||
| # to prevent issues with checks in the Easybuild configuration that use this variable | ||
| export EESSI_CPU_FAMILY=${EESSI_SOFTWARE_SUBDIR_OVERRIDE%%/*} | ||
| export EESSI_PREFIX=/cvmfs/software.eessi.io/versions/${EESSI_VERSION} | ||
| export EESSI_OS_TYPE=linux | ||
| env | grep ^EESSI | sort | ||
| module load EasyBuild | ||
|
|
||
| # create a temporary directory to store the output | ||
| LOCAL_TMPDIR=$(mktemp -d) | ||
| eb_missing_out=$LOCAL_TMPDIR/eb_missing.out | ||
| echo "eb_missing_out=$LOCAL_TMPDIR/eb_missing.out" >> $GITHUB_ENV | ||
| echo "Temporary directory created: ${eb_missing_out}" | ||
| file_list=$(curl -sS \ | ||
| -H "Accept: application/vnd.github+json" \ | ||
| "https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}/files?per_page=100" | | ||
| jq -r '.[].filename | select(test("easystack"))') | ||
| echo "Files to check:" | ||
| echo $file_list | ||
|
|
||
| for easystack_file in $file_list; do | ||
| eb_version=$(echo ${easystack_file} | sed 's/.*eb-\([0-9.]*\).*.yml/\1/g') | ||
| echo "check missing installations for ${easystack_file} with EasyBuild ${eb_version}..." | ||
| module purge | ||
| module load EasyBuild/${eb_version} | ||
| module load EESSI-extend/${EESSI_VERSION}-easybuild | ||
| which eb | ||
| ${EB:-eb} --version | ||
| ${EB:-eb} --missing --easystack ${easystack_file} 2>&1 | tee ${eb_missing_out} | ||
hvelab marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| exit_code=${PIPESTATUS[0]} | ||
| #echo "exit code for eb --missing --easystack ${easystack_file} is ${exit_code}" | ||
| grep " required modules missing:" ${eb_missing_out} # > /dev/null | ||
| exit_code=$? | ||
|
|
||
| if [[ ${exit_code} -eq 0 ]]; then echo "missing installations found for ${easystack_file}!" >&2; | ||
| else | ||
| echo "no missing installations found for ${easystack_file}." | ||
| exit 0 | ||
| fi | ||
| done | ||
|
|
||
| - name: Check for software existing in licenses.yaml file | ||
| run: | | ||
| # double check this | ||
| if [ -s licenses/licenses.yml ]; then | ||
| echo "licenses.yml file exists, checking for software versions that are not in the file..." | ||
| echo "tmp file check: ${eb_missing_out}" | ||
| # cat ${eb_missing_out} | ||
| grep -oP '^\* \K[^ ]+' "${eb_missing_out}" | sort -u > missing.txt | ||
| echo "Modules to check" | ||
| cat missing.txt | ||
|
|
||
| # Check if software exists as key in YAML | ||
|
|
||
| while IFS= read -r module; do | ||
| # module format: NAME/VERSION-TOOLCHAIN | ||
| # e.g. ALL/0.9.2-foss-2023a | ||
|
|
||
| name="${module%%/*}" # ALL | ||
| rest="${module#*/}" # 0.9.2-foss-2023a | ||
| version="${rest%%-*}" # 0.9.2 | ||
|
|
||
| # Check if licenses.yaml has: NAME -> VERSION | ||
| if ! yq -e ".\"$name\".\"$version\"" "$LICENSES_YAML" >/dev/null 2>&1; then | ||
| echo "$module" >> missing_modules.txt | ||
| fi | ||
| done < missing.txt | ||
|
|
||
| echo "Modules not in licenses.json: " | ||
| cat missing_modules.txt | ||
|
|
||
| else | ||
| echo "licenses.yml file does not exist? what happened?" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name : Search sources for missing modules | ||
| run: | | ||
| if [ -s missing_modules.txt ]; then | ||
| echo "Searching sources for missing modules..." | ||
| # Generates a "modules_results.json" file | ||
| module load Python-bundle-PyPI/2023.06-GCCcore-12.3.0 | ||
| python licenses/parsing_easyconfigs.py missing_modules.txt | ||
| cat modules_results.json | ||
| fi | ||
|
|
||
| - name : Try to fetch the license | ||
| run: | | ||
| if [ -s modules_results.json ]; then | ||
| echo "modules_results.json file exists, trying to fetch the license..." | ||
| module load Python-bundle-PyPI/2023.06-GCCcore-12.3.0 | ||
| module load BeautifulSoup/4.12.2-GCCcore-12.3.0 | ||
| python licenses/parse_licenses.py modules_results.json | ||
| cat licenses_test.json | ||
| else | ||
| echo "modules_results.json file does not exist, skipping license fetch." | ||
| fi | ||
|
|
||
| - name: Check for missing licenses | ||
| run: | | ||
| grep -3 "not found" licenses_test.json | ||
| exit_code=$? | ||
| if [[ ${exit_code} -ne 0 ]]; then | ||
| echo "No missing licenses found." | ||
| else | ||
| echo "Missing licenses found, please check the licenses.json file." | ||
hvelab marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| #exit 1 | ||
| fi | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| see https://spdx.org/licenses | ||
|
|
||
| Python function to download SPDX list of licenses is available in `spdx.py` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.