Skip to content
Snippets Groups Projects
Commit 2d209549 authored by Jan Frenzel's avatar Jan Frenzel
Browse files

Merge branch 'merge-p-in-m' into 'main'

Merge preview into main

See merge request !366
parents 144f00c8 649405dd
No related branches found
No related tags found
4 merge requests!392Merge preview into contrib guide for browser users,!376Merge preview into main,!375Rotscher tu dresden.de main patch 90987,!366Merge preview into main
...@@ -465,6 +465,8 @@ should be highlighted, etc. Code examples, longer than half screen height should ...@@ -465,6 +465,8 @@ should be highlighted, etc. Code examples, longer than half screen height should
**TODO** Guide [Issue #14](#14) **TODO** Guide [Issue #14](#14)
* Capitalize headings, e.g. *Exclusive Reservation of Hardware* * Capitalize headings, e.g. *Exclusive Reservation of Hardware*
* Give keywords in link texts, e.g. [Code Blocks](#code-blocks-and-syntax-highlighting) is more
descriptive than [this subsection](#code-blocks-and-syntax-highlighting)
### Spelling and Technical Wording ### Spelling and Technical Wording
......
...@@ -13,7 +13,8 @@ For more information on our VPN and how to set it up, please visit the correspon ...@@ -13,7 +13,8 @@ For more information on our VPN and how to set it up, please visit the correspon
## Connecting from Linux ## Connecting from Linux
Please use an up-to-date SSH client. The login nodes accept the following encryption algorithms: SSH establishes secure connections using authentication and encryption. Thus, please use an
up-to-date SSH client. The login nodes accept the following encryption algorithms:
* `aes128-ctr` * `aes128-ctr`
* `aes192-ctr` * `aes192-ctr`
...@@ -23,58 +24,111 @@ Please use an up-to-date SSH client. The login nodes accept the following encryp ...@@ -23,58 +24,111 @@ Please use an up-to-date SSH client. The login nodes accept the following encryp
* `chacha20-poly1305@openssh.com` * `chacha20-poly1305@openssh.com`
* `chacha20-poly1305@openssh.com` * `chacha20-poly1305@openssh.com`
### SSH Session ### Before Your First Connection
If your workstation is within the campus network, you can connect to the HPC login nodes directly. We suggest to create an SSH key pair before you work with the ZIH systems. This ensures high
connection security.
```console ```console
marie@local$ ssh <zih-login>@taurus.hrsk.tu-dresden.de marie@local$ mkdir -p ~/.ssh
marie@local$ ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519
Generating public/private ed25519 key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
[...]
``` ```
If you connect for the fist time, the client will ask you to verify the host by its fingerprint: Type in a passphrase for the protection of your key. The passphrase should be **non-empty**.
Copy the public key to the ZIH system (Replace placeholder `marie` with your ZIH login):
```console ```console
marie@local$: ssh <zih-login>@taurus.hrsk.tu-dresden.de marie@local$ ssh-copy-id -i ~/.ssh/id_ed25519.pub marie@taurus.hrsk.tu-dresden.de
The authenticity of host 'taurus.hrsk.tu-dresden.de (141.30.73.104)' can't be established. The authenticity of host 'taurus.hrsk.tu-dresden.de (141.30.73.104)' can't be established.
RSA key fingerprint is SHA256:HjpVeymTpk0rqoc8Yvyc8d9KXQ/p2K0R8TJ27aFnIL8. RSA key fingerprint is SHA256:HjpVeymTpk0rqoc8Yvyc8d9KXQ/p2K0R8TJ27aFnIL8.
Are you sure you want to continue connecting (yes/no)? Are you sure you want to continue connecting (yes/no)?
``` ```
Compare the shown fingerprint with the [documented fingerprints](key_fingerprints.md). Make sure Compare the shown fingerprint with the [documented fingerprints](key_fingerprints.md). Make sure
they match. Than you can accept by typing `y` or `yes`. they match. Then you can accept by typing `yes`.
### X11-Forwarding !!! info
If `ssh-copy-id` is not available, you need to do additional steps:
If you plan to use an application with graphical user interface (GUI), you need to enable ```console
X11-forwarding for the connection. Add the option `-X` or `-XC` to your SSH command. The `-C` enables marie@local$ scp ~/.ssh/id_ed25519.pub marie@taurus.hrsk.tu-dresden.de:
compression which usually improves usability in this case). The authenticity of host 'taurus.hrsk.tu-dresden.de (141.30.73.104)' can't be established.
RSA key fingerprint is SHA256:HjpVeymTpk0rqoc8Yvyc8d9KXQ/p2K0R8TJ27aFnIL8.
Are you sure you want to continue connecting (yes/no)?
```
After that, you need to manually copy the key to the right place:
```console
marie@local$ ssh marie@taurus.hrsk.tu-dresden.de
[...]
marie@login$ mkdir -p ~/.ssh
marie@login$ touch ~/.ssh/authorized_keys
marie@login$ cat id_ed25519.pub >> ~/.ssh/authorized_keys
```
#### Configuring Default Parameters for SSH
After you have copied your key to the ZIH system, you should be able to connect using:
```console ```console
marie@local$ ssh -XC <zih-login>@taurus.hrsk.tu-dresden.de marie@local$ ssh marie@taurus.hrsk.tu-dresden.de
[...]
marie@login$ exit
``` ```
!!! info However, you can make this more comfortable if you prepare an SSH configuration on your local
workstation. Navigate to the subdirectory `.ssh` in your home directory and open the file `config`
(`~/.ssh/config`) in your favorite editor. If it does not exist, create it. Put the following lines
in it (you can omit lines starting with `#`):
```bash
Host taurus
HostName taurus.hrsk.tu-dresden.de
#Put your ZIH-Login after keyword "User":
User marie
#Path to private key:
IdentityFile ~/.ssh/id_ed25519
#Don't try other keys if you have more:
IdentitiesOnly yes
#Enable X11 forwarding for graphical applications and compression. You don't need parameter -X and -C when invoking ssh then.
ForwardX11 yes
Compression yes
```
Also consider to use a [DCV session](desktop_cloud_visualization.md) for remote desktop Afterwards, you can connect to the ZIH system using:
visualization at ZIH systems.
### Password-Less SSH ```console
marie@local$ ssh taurus
```
### X11-Forwarding
Of course, password-less SSH connecting is supported at ZIH. All public SSH keys for ZIH systems If you plan to use an application with graphical user interface (GUI), you need to enable
have to be generated following these rules: X11-forwarding for the connection. If you use the SSH configuration described above, everything is
already prepared and you can simply use:
* The **ED25519** algorithm has to be used, e.g., `ssh-keygen -t ed25519` ```console
* A **non-empty** passphrase for the private key must be set. marie@local$ ssh taurus
```
The generated public key is usually saved at `~/.ssh/id_ed25519` at your local system. To allow for If you have omitted the last two lines in the default configuration above, you need to add the
password-less SSH connection to ZIH systems, it has to be added to the file `.ssh/authorized_keys` within option `-X` or `-XC` to your SSH command. The `-C` enables compression which usually improves
your home directory `/home/<zih-login>/` at ZIH systems. usability in this case:
```console ```console
marie@local$ ssh -i id-ed25519 <zih-login>@taurus.hrsk.tu-dresden.de marie@local$ ssh -XC taurus
Enter passphrase for key 'id-ed25519':
``` ```
!!! info
Also consider to use a [DCV session](desktop_cloud_visualization.md) for remote desktop
visualization at ZIH systems.
## Connecting from Windows ## Connecting from Windows
We recommend one of the following applications: We recommend one of the following applications:
......
...@@ -4,13 +4,13 @@ Storage systems differ in terms of capacity, streaming bandwidth, IOPS rate, etc ...@@ -4,13 +4,13 @@ Storage systems differ in terms of capacity, streaming bandwidth, IOPS rate, etc
efficiency don't allow to have it all in one. That is why fast parallel filesystems at ZIH have efficiency don't allow to have it all in one. That is why fast parallel filesystems at ZIH have
restrictions with regards to **age of files** and [quota](quotas.md). The mechanism of workspaces restrictions with regards to **age of files** and [quota](quotas.md). The mechanism of workspaces
enables users to better manage their HPC data. enables users to better manage their HPC data.
<!--Workspaces are primarily login-related.-->
The concept of "workspaces" is common and used at a large number of HPC centers. The concept of workspaces is common and used at a large number of HPC centers.
!!! note !!! note
A workspace is a directory, with an associated expiration date, created on behalf of a user in a A **workspace** is a directory, with an associated expiration date, created on behalf of a user
certain storage system. in a certain filesystem.
Once the workspace has reached its expiration date, it gets moved to a hidden directory and enters a Once the workspace has reached its expiration date, it gets moved to a hidden directory and enters a
grace period. Once the grace period ends, the workspace is deleted permanently. The maximum lifetime grace period. Once the grace period ends, the workspace is deleted permanently. The maximum lifetime
...@@ -30,8 +30,8 @@ times. ...@@ -30,8 +30,8 @@ times.
To list all available filesystems for using workspaces use: To list all available filesystems for using workspaces use:
```bash ```console
zih$ ws_find -l marie@login$ ws_find -l
Available filesystems: Available filesystems:
scratch scratch
warm_archive warm_archive
...@@ -43,8 +43,8 @@ beegfs_global0 ...@@ -43,8 +43,8 @@ beegfs_global0
To list all workspaces you currently own, use: To list all workspaces you currently own, use:
```bash ```console
zih$ ws_list marie@login$ ws_list
id: test-workspace id: test-workspace
workspace directory : /scratch/ws/0/marie-test-workspace workspace directory : /scratch/ws/0/marie-test-workspace
remaining time : 89 days 23 hours remaining time : 89 days 23 hours
...@@ -59,8 +59,8 @@ id: test-workspace ...@@ -59,8 +59,8 @@ id: test-workspace
To create a workspace in one of the listed filesystems use `ws_allocate`. It is necessary to specify To create a workspace in one of the listed filesystems use `ws_allocate`. It is necessary to specify
a unique name and the duration of the workspace. a unique name and the duration of the workspace.
```bash ```console
ws_allocate: [options] workspace_name duration marie@login$ ws_allocate: [options] workspace_name duration
Options: Options:
-h [ --help] produce help message -h [ --help] produce help message
...@@ -74,13 +74,12 @@ Options: ...@@ -74,13 +74,12 @@ Options:
-u [ --username ] arg username -u [ --username ] arg username
-g [ --group ] group workspace -g [ --group ] group workspace
-c [ --comment ] arg comment -c [ --comment ] arg comment
``` ```
!!! example !!! example
```bash ```console
zih$ ws_allocate -F scratch -r 7 -m marie.testuser@tu-dresden.de test-workspace 90 marie@login$ ws_allocate -F scratch -r 7 -m marie.testuser@tu-dresden.de test-workspace 90
Info: creating workspace. Info: creating workspace.
/scratch/ws/marie-test-workspace /scratch/ws/marie-test-workspace
remaining extensions : 10 remaining extensions : 10
...@@ -95,22 +94,22 @@ days with an email reminder for 7 days before the expiration. ...@@ -95,22 +94,22 @@ days with an email reminder for 7 days before the expiration.
Setting the reminder to `7` means you will get a reminder email on every day starting `7` prior Setting the reminder to `7` means you will get a reminder email on every day starting `7` prior
to expiration date. to expiration date.
### Extention of a Workspace ### Extension of a Workspace
The lifetime of a workspace is finite. Different filesystems (storage systems) have different The lifetime of a workspace is finite. Different filesystems (storage systems) have different
maximum durations. A workspace can be extended multiple times, depending on the filesystem. maximum durations. A workspace can be extended multiple times, depending on the filesystem.
| Storage system (use with parameter -F ) | Duration, days | Extensions | Remarks | | Filesystem (use with parameter `-F`) | Duration, days | Extensions | Remarks |
|:------------------------------------------:|:----------:|:-------:|:---------------------------------------------------------------------------------------:| |:------------------------------------:|:----------:|:-------:|:-----------------------------------:|
| `ssd` | 30 | 10 | High-IOPS filesystem (`/lustre/ssd`) on SSDs. | | `ssd` | 30 | 2 | High-IOPS filesystem (`/lustre/ssd`) on SSDs. |
| `beegfs` | 30 | 2 | High-IOPS filesystem (`/lustre/ssd`) onNVMes. | | `beegfs` | 30 | 2 | High-IOPS filesystem (`/lustre/ssd`) on NVMes. |
| `scratch` | 100 | 2 | Scratch filesystem (/scratch) with high streaming bandwidth, based on spinning disks | | `scratch` | 100 | 10 | Scratch filesystem (`/scratch`) with high streaming bandwidth, based on spinning disks |
| `warm_archive` | 365 | 2 | Capacity filesystem based on spinning disks | | `warm_archive` | 365 | 2 | Capacity filesystem based on spinning disks |
To extend your workspace use the following command: To extent your workspace use the following command:
``` ```console
zih$ ws_extend -F scratch test-workspace 100 #extend the workspace for 100 days marie@login$ ws_extend -F scratch test-workspace 100
Info: extending workspace. Info: extending workspace.
/scratch/ws/marie-test-workspace /scratch/ws/marie-test-workspace
remaining extensions : 1 remaining extensions : 1
...@@ -122,39 +121,46 @@ remaining time in days: 100 ...@@ -122,39 +121,46 @@ remaining time in days: 100
With the `ws_extend` command, a new duration for the workspace is set. The new duration is not With the `ws_extend` command, a new duration for the workspace is set. The new duration is not
added! added!
This means when you extend a workspace that expires in 90 days with the `ws_extend -F scratch This means when you extend a workspace that expires in 90 days with the command
my-workspace 40`, it will now expire in 40 days **not** 130 days.
```console
marie@login$ ws_extend -F scratch my-workspace 40
```
it will now expire in 40 days **not** 130 days.
### Deletion of a Workspace ### Deletion of a Workspace
To delete a workspace use the `ws_release` command. It is mandatory to specify the name of the To delete a workspace use the `ws_release` command. It is mandatory to specify the name of the
workspace and the filesystem in which it is located: workspace and the filesystem in which it is located:
`ws_release -F <filesystem> <workspace name>` ```console
marie@login$ ws_release -F <filesystem> <workspace name>
```
### Restoring Expired Workspaces ### Restoring Expired Workspaces
At expiration time your workspace will be moved to a special, hidden directory. For a month (in At expiration time your workspace will be moved to a special, hidden directory. For a month (in
warm_archive: 2 months), you can still restore your data into an existing workspace. warm_archive: 2 months), you can still restore your data into an existing workspace.
!!!Warning !!! warning
When you release a workspace **by hand**, it will not receive a grace period and be When you release a workspace **by hand**, it will not receive a grace period and be
**permanently deleted** the **next day**. The advantage of this design is that you can create **permanently deleted** the **next day**. The advantage of this design is that you can create
and release workspaces inside jobs and not swamp the filesystem with data no one needs anymore and release workspaces inside jobs and not swamp the filesystem with data no one needs anymore
in the hidden directories (when workspaces are in the grace period). in the hidden directories (when workspaces are in the grace period).
Use: Use
``` ```console
ws_restore -l -F scratch marie@login$ ws_restore -l -F scratch
``` ```
to get a list of your expired workspaces, and then restore them like that into an existing, active to get a list of your expired workspaces, and then restore them like that into an existing, active
workspace 'new_ws': workspace 'new_ws':
``` ```console
ws_restore -F scratch marie-test-workspace-1234567 new_ws marie@login$ ws_restore -F scratch marie-test-workspace-1234567 new_ws
``` ```
The expired workspace has to be specified by its full name as listed by `ws_restore -l`, including The expired workspace has to be specified by its full name as listed by `ws_restore -l`, including
...@@ -174,8 +180,8 @@ workspaces within in the directory `DIR`. Calling this command will do the follo ...@@ -174,8 +180,8 @@ workspaces within in the directory `DIR`. Calling this command will do the follo
- The directory `DIR` will be created if necessary. - The directory `DIR` will be created if necessary.
- Links to all personal workspaces will be managed: - Links to all personal workspaces will be managed:
- Create links to all available workspaces if not already present. - Create links to all available workspaces if not already present.
- Remove links to released workspaces. - Remove links to released workspaces.
**Remark**: An automatic update of the workspace links can be invoked by putting the command **Remark**: An automatic update of the workspace links can be invoked by putting the command
`ws_register DIR` in your personal `shell` configuration file (e.g., `.bashrc`). `ws_register DIR` in your personal `shell` configuration file (e.g., `.bashrc`).
...@@ -198,8 +204,9 @@ A batch job needs a directory for temporary data. This can be deleted afterwards ...@@ -198,8 +204,9 @@ A batch job needs a directory for temporary data. This can be deleted afterwards
#SBATCH --ntasks=1 #SBATCH --ntasks=1
#SBATCH --cpus-per-task=24 #SBATCH --cpus-per-task=24
module load modenv/classic module purge
module load gaussian module load modenv/hiera
module load Gaussian
COMPUTE_DIR=gaussian_$SLURM_JOB_ID COMPUTE_DIR=gaussian_$SLURM_JOB_ID
export GAUSS_SCRDIR=$(ws_allocate -F ssd $COMPUTE_DIR 7) export GAUSS_SCRDIR=$(ws_allocate -F ssd $COMPUTE_DIR 7)
...@@ -218,8 +225,8 @@ Likewise, other jobs can use temporary workspaces. ...@@ -218,8 +225,8 @@ Likewise, other jobs can use temporary workspaces.
For a series of jobs or calculations that work on the same data, you should allocate a workspace For a series of jobs or calculations that work on the same data, you should allocate a workspace
once, e.g., in `scratch` for 100 days: once, e.g., in `scratch` for 100 days:
``` ```console
zih$ ws_allocate -F scratch my_scratchdata 100 marie@login$ ws_allocate -F scratch my_scratchdata 100
Info: creating workspace. Info: creating workspace.
/scratch/ws/marie-my_scratchdata /scratch/ws/marie-my_scratchdata
remaining extensions : 2 remaining extensions : 2
...@@ -234,8 +241,8 @@ chmod g+wrx /scratch/ws/marie-my_scratchdata ...@@ -234,8 +241,8 @@ chmod g+wrx /scratch/ws/marie-my_scratchdata
And verify it with: And verify it with:
``` ```console
zih $ ls -la /scratch/ws/marie-my_scratchdata marie@login$ ls -la /scratch/ws/marie-my_scratchdata
total 8 total 8
drwxrwx--- 2 marie hpcsupport 4096 Jul 10 09:03 . drwxrwx--- 2 marie hpcsupport 4096 Jul 10 09:03 .
drwxr-xr-x 5 operator adm 4096 Jul 10 09:01 .. drwxr-xr-x 5 operator adm 4096 Jul 10 09:01 ..
...@@ -247,8 +254,8 @@ For data that seldom changes but consumes a lot of space, the warm archive can b ...@@ -247,8 +254,8 @@ For data that seldom changes but consumes a lot of space, the warm archive can b
this is mounted read-only on the compute nodes, so you cannot use it as a work directory for your this is mounted read-only on the compute nodes, so you cannot use it as a work directory for your
jobs! jobs!
``` ```console
zih$ ws_allocate -F warm_archive my_inputdata 365 marie@login$ ws_allocate -F warm_archive my_inputdata 365
/warm_archive/ws/marie-my_inputdata /warm_archive/ws/marie-my_inputdata
remaining extensions : 2 remaining extensions : 2
remaining time in days: 365 remaining time in days: 365
...@@ -259,10 +266,10 @@ remaining time in days: 365 ...@@ -259,10 +266,10 @@ remaining time in days: 365
The warm archive is not built for billions of files. There The warm archive is not built for billions of files. There
is a quota for 100.000 files per group. Please archive data. is a quota for 100.000 files per group. Please archive data.
To see your active quota use: To see your active quota use
``` ```console
qinfo quota /warm_archive/ws/ marie@login$ qinfo quota /warm_archive/ws/
``` ```
Note that the workspaces reside under the mountpoint `/warm_archive/ws/` and not `/warm_archive` Note that the workspaces reside under the mountpoint `/warm_archive/ws/` and not `/warm_archive`
......
...@@ -230,7 +230,7 @@ Module ORCA/4.2.1-gompi-2019b and 11 dependencies loaded. ...@@ -230,7 +230,7 @@ Module ORCA/4.2.1-gompi-2019b and 11 dependencies loaded.
## Siesta ## Siesta
[Siesta](https://www.uam.es/siesta) (Spanish Initiative for Electronic Simulations with [Siesta](https://siesta-project.org/siesta) (Spanish Initiative for Electronic Simulations with
Thousands of Atoms) is both a method and its computer program implementation, Thousands of Atoms) is both a method and its computer program implementation,
to perform electronic structure calculations and ab initio to perform electronic structure calculations and ab initio
molecular dynamics simulations of molecules and solids. molecular dynamics simulations of molecules and solids.
......
#!/bin/bash
set -euo pipefail
scriptpath=${BASH_SOURCE[0]}
basedir=`dirname "$scriptpath"`
basedir=`dirname "$basedir"`
function usage () {
echo "$0 [options]"
echo "Search for bash files that have an invalid syntax."
echo ""
echo "Options:"
echo " -a Search in all bash files (default: git-changed files)"
echo " -f=FILE Search in a specific bash file"
echo " -s Silent mode"
echo " -h Show help message"
}
# Options
all_files=false
silent=false
file=""
while getopts ":ahsf:" option; do
case $option in
a)
all_files=true
;;
f)
file=$2
shift
;;
s)
silent=true
;;
h)
usage
exit;;
\?) # Invalid option
echo "Error: Invalid option."
usage
exit;;
esac
done
branch="origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-preview}"
if [ $all_files = true ]; then
echo "Search in all bash files."
files=$(git ls-tree --full-tree -r --name-only HEAD $basedir/docs/ | grep .sh)
elif [[ ! -z $file ]]; then
files=$file
else
echo "Search in git-changed files."
files=`git diff --name-only "$(git merge-base HEAD "$branch")" | grep .sh`
fi
cnt=0
for f in $files; do
if ! bash -n $f; then
if [ $silent = false ]; then
echo "Bash file $f has invalid syntax"
fi
((cnt=cnt+1))
fi
done
case $cnt in
1)
echo "Bash files with invalid syntax: 1 match found"
;;
*)
echo "Bash files with invalid syntax: $cnt matches found"
;;
esac
if [ $cnt -gt 0 ]; then
exit 1
fi
...@@ -18,12 +18,14 @@ i file \+system HDFS ...@@ -18,12 +18,14 @@ i file \+system HDFS
i \<taurus\> taurus\.hrsk /taurus /TAURUS i \<taurus\> taurus\.hrsk /taurus /TAURUS
i \<hrskii\> i \<hrskii\>
i hpc[ -]\+da\> i hpc[ -]\+da\>
i ATTACHURL
i \(alpha\|ml\|haswell\|romeo\|gpu\|smp\|julia\|hpdlf\|scs5\)-\?\(interactive\)\?[^a-z]*partition i \(alpha\|ml\|haswell\|romeo\|gpu\|smp\|julia\|hpdlf\|scs5\)-\?\(interactive\)\?[^a-z]*partition
i \[\s\?\(documentation\|here\|this \(link\|page\|subsection\)\|slides\?\|manpage\)\s\?\]
i work[ -]\+space" i work[ -]\+space"
# Whitelisted files will be ignored # Whitelisted files will be ignored
# Whitespace separated list with full path # Whitespace separated list with full path
whitelist=(doc.zih.tu-dresden.de/docs/contrib/content_rules.md) whitelist=(doc.zih.tu-dresden.de/README.md doc.zih.tu-dresden.de/docs/contrib/content_rules.md doc.zih.tu-dresden.de/docs/access/ssh_login.md)
function grepExceptions () { function grepExceptions () {
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then
...@@ -87,7 +89,7 @@ fi ...@@ -87,7 +89,7 @@ fi
echo "... $files ..." echo "... $files ..."
cnt=0 cnt=0
for f in $files; do for f in $files; do
if [ "$f" != doc.zih.tu-dresden.de/README.md -a "${f: -3}" == ".md" -a -f "$f" ]; then if [ "${f: -3}" == ".md" -a -f "$f" ]; then
if (printf '%s\n' "${whitelist[@]}" | grep -xq $f); then if (printf '%s\n' "${whitelist[@]}" | grep -xq $f); then
echo "Skip whitelisted file $f" echo "Skip whitelisted file $f"
continue continue
......
#!/bin/bash #!/bin/bash
exit_ok=yes
files=$(git diff-index --cached --name-only HEAD)
function testPath(){ function testPath(){
path_to_test=doc.zih.tu-dresden.de/docs/$1 path_to_test=doc.zih.tu-dresden.de/docs/$1
test -f "$path_to_test" || echo $path_to_test does not exist test -f "$path_to_test" || echo $path_to_test does not exist
...@@ -15,29 +12,39 @@ fi ...@@ -15,29 +12,39 @@ fi
export -f testPath export -f testPath
for file in $files exit_ok=yes
do branch="origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-preview}"
if [ $file == doc.zih.tu-dresden.de/mkdocs.yml ] if [ -f "$GIT_DIR/MERGE_HEAD" ]
then
source_hash=`git merge-base HEAD "$branch"`
else
source_hash=`git rev-parse HEAD`
fi
#Remove everything except lines beginning with --- or +++
files=`git diff $source_hash | sed -E -n 's#^(---|\+\+\+) ((/|./)[^[:space:]]+)$#\2#p'`
#Assume that we have pairs of lines (starting with --- and +++).
while read oldfile; do
read newfile
if [ "$newfile" == doc.zih.tu-dresden.de/mkdocs.yml ]
then then
echo Testing $file echo Testing "$newfile"
sed -n '/^ *- /s#.*: \([A-Za-z_/]*.md\).*#\1#p' doc.zih.tu-dresden.de/mkdocs.yml | xargs -L1 -I {} bash -c "testPath '{}'" sed -n '/^ *- /s#.*: \([A-Za-z_/]*.md\).*#\1#p' doc.zih.tu-dresden.de/mkdocs.yml | xargs -L1 -I {} bash -c "testPath '{}'"
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
exit_ok=no exit_ok=no
fi fi
elif [[ $file =~ ^doc.zih.tu-dresden.de/(.*.md)$ ]] elif [[ "$newfile" =~ ^b/doc.zih.tu-dresden.de/(.*.md)$ ]]
then then
filepattern=${BASH_REMATCH[1]} filepattern=${BASH_REMATCH[1]}
#lint echo "Linting..."
echo "Checking linter..."
docker run --name=hpc-compendium --rm -w /docs --mount src="$(pwd)"/doc.zih.tu-dresden.de,target=/docs,type=bind hpc-compendium markdownlint $filepattern docker run --name=hpc-compendium --rm -w /docs --mount src="$(pwd)"/doc.zih.tu-dresden.de,target=/docs,type=bind hpc-compendium markdownlint $filepattern
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
exit_ok=no exit_ok=no
fi fi
#link-check
echo "Checking links..." echo "Checking links..."
docker run --name=hpc-compendium --rm -w /docs --mount src="$(pwd)"/doc.zih.tu-dresden.de,target=/docs,type=bind hpc-compendium markdown-link-check $filepattern docker run --name=hpc-compendium --rm -w /docs --mount src="$(pwd)"/doc.zih.tu-dresden.de,target=/docs,type=bind hpc-compendium markdown-link-check $filepattern
if [ $? -ne 0 ] if [ $? -ne 0 ]
...@@ -45,9 +52,15 @@ do ...@@ -45,9 +52,15 @@ do
exit_ok=no exit_ok=no
fi fi
fi fi
done done <<< "$files"
echo "Testing syntax of bash files..."
docker run --name=hpc-compendium --rm -w /docs --mount src="$(pwd)",target=/docs,type=bind hpc-compendium ./doc.zih.tu-dresden.de/util/check-bash-syntax.sh
if [ $? -ne 0 ]
then
exit_ok=no
fi
#spell-check
echo "Spell-checking..." echo "Spell-checking..."
docker run --name=hpc-compendium --rm -w /docs --mount src="$(pwd)",target=/docs,type=bind hpc-compendium ./doc.zih.tu-dresden.de/util/check-spelling.sh docker run --name=hpc-compendium --rm -w /docs --mount src="$(pwd)",target=/docs,type=bind hpc-compendium ./doc.zih.tu-dresden.de/util/check-spelling.sh
if [ $? -ne 0 ] if [ $? -ne 0 ]
...@@ -55,7 +68,6 @@ then ...@@ -55,7 +68,6 @@ then
exit_ok=no exit_ok=no
fi fi
#forbidden words checking
echo "Forbidden words checking..." echo "Forbidden words checking..."
docker run --name=hpc-compendium --rm -w /docs --mount src="$(pwd)",target=/docs,type=bind hpc-compendium ./doc.zih.tu-dresden.de/util/grep-forbidden-words.sh docker run --name=hpc-compendium --rm -w /docs --mount src="$(pwd)",target=/docs,type=bind hpc-compendium ./doc.zih.tu-dresden.de/util/grep-forbidden-words.sh
if [ $? -ne 0 ] if [ $? -ne 0 ]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment