Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
validate_workflows
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Digital Preservation
validate_workflows
Commits
11ccd143
Commit
11ccd143
authored
2 years ago
by
Andreas Romeyke
Browse files
Options
Downloads
Patches
Plain Diff
- added --pipe (wished by Joerg)
parent
07fecb6d
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
DESIGN.asciidoc
+1
-0
1 addition, 0 deletions
DESIGN.asciidoc
validate_workflow.sh
+71
-38
71 additions, 38 deletions
validate_workflow.sh
with
72 additions
and
38 deletions
DESIGN.asciidoc
+
1
−
0
View file @
11ccd143
...
@@ -31,6 +31,7 @@ A cli tool which uses different validators to validate workflows.
...
@@ -31,6 +31,7 @@ A cli tool which uses different validators to validate workflows.
* --daemon - starts a daemon, works only with delete mode
* --daemon - starts a daemon, works only with delete mode
* --stage=[current,upcoming,any] - valides with current or upcoming profile
* --stage=[current,upcoming,any] - valides with current or upcoming profile
/validator or any if any is valid
/validator or any if any is valid
* --pipe - use program as a filter
== related files
== related files
...
...
This diff is collapsed.
Click to expand it.
validate_workflow.sh
+
71
−
38
View file @
11ccd143
...
@@ -26,19 +26,19 @@
...
@@ -26,19 +26,19 @@
#hh
#hh
#hh -h, --help
#hh -h, --help
#hh help output
#hh help output
#hh -w,
-i,
--watch-folder <DIR>
#hh -w, --watch-folder <DIR>
#hh watches folder for files which should be evaluated
#hh watches folder for files which should be evaluated
#hh -r,
-o,
--result-folder <DIR>
#hh -r, --result-folder <DIR>
#hh target folder to store validation results
#hh target folder to store validation results
#hh -f, --files-mode [sort|delete|nothing]
#hh -f, --files-mode [sort|delete|nothing]
#hh mode=sort it sorts files to valid- and invalid-folder,
#hh mode=sort it sorts files to valid- and invalid-folder,
#hh mode=delete it deletes already checked files from watch-folder
#hh mode=delete it deletes already checked files from watch-folder
#hh mode=nothing files in watch-folder are untouched
#hh mode=nothing files in watch-folder are untouched
#hh The mode=delete is default.
#hh The mode=delete is default.
#hh -
p
, --valid-folder <DIR>
#hh -
v
, --valid-folder <DIR>
#hh only needed if files-mode=sort, moves valid files from
#hh only needed if files-mode=sort, moves valid files from
#hh watch-folder to valid-folder
#hh watch-folder to valid-folder
#hh -
n
, --invalid-folder <DIR>
#hh -
i
, --invalid-folder <DIR>
#hh only needed if files-mode=sort, moves invalid files from
#hh only needed if files-mode=sort, moves invalid files from
#hh watch-folder to invalid folder
#hh watch-folder to invalid folder
#hh -s, --statistics
#hh -s, --statistics
...
@@ -51,16 +51,24 @@
...
@@ -51,16 +51,24 @@
#hh -t, --stage [current,upcoming,any]
#hh -t, --stage [current,upcoming,any]
#hh valides with current or upcoming profile/validator
#hh valides with current or upcoming profile/validator
#hh or any if any is valid
#hh or any if any is valid
#hh -p, --pipe
#hh validates a single filestream from STDIN, writes result to STDOUT
#hh no daemon, no folder nor filemode params needed
#hh
#hh
#hh
#hh
#DEFAULTS
#DEFAULTS
WITH_DAEMON
=
0
WITH_DAEMON
=
0
WITH_PIPE
=
0
STAGE
=
any
STAGE
=
any
MODE
=
auto
MODE
=
auto
FILES_MODE
=
nothing
FILES_MODE
=
nothing
STATFILE
=
${
HOME
}
/.cache/validate_workflows/statistics.cnt
STATFILE
=
${
HOME
}
/.cache/validate_workflows/statistics.cnt
LOCKFILE
=
/var/run/lock/validate_workflows.lock
LOCKFILE
=
/var/run/lock/validate_workflows.lock
WATCH_FOLDER
=
""
RESULT_FOLDER
=
""
VALID_FOLDER
=
""
INVALID_FOLDER
=
""
set
-o
nounset
# Treat unset variables as an error
set
-o
nounset
# Treat unset variables as an error
...
@@ -84,22 +92,22 @@ get_cli_args() {
...
@@ -84,22 +92,22 @@ get_cli_args() {
print_statistics
print_statistics
exit
0
exit
0
;;
;;
-w
|
-i
|
--watch-folder
)
-w
|
--watch-folder
)
WATCH_FOLDER
=
"
${
2
}
"
WATCH_FOLDER
=
"
${
2
}
"
shift
shift
shift
shift
;;
;;
-r
|
-o
|
--result-folder
)
-r
|
--result-folder
)
RESULT_FOLDER
=
"
${
2
}
"
RESULT_FOLDER
=
"
${
2
}
"
shift
shift
shift
shift
;;
;;
-
p
|
--valid-folder
)
-
v
|
--valid-folder
)
VALID_FOLDER
=
"
${
2
}
"
VALID_FOLDER
=
"
${
2
}
"
shift
shift
shift
shift
;;
;;
-
n
|
--invalid-folder
)
-
i
|
--invalid-folder
)
INVALID_FOLDER
=
"
${
2
}
"
INVALID_FOLDER
=
"
${
2
}
"
shift
shift
shift
shift
...
@@ -123,6 +131,10 @@ get_cli_args() {
...
@@ -123,6 +131,10 @@ get_cli_args() {
shift
shift
shift
shift
;;
;;
-p
|
--pipe
)
WITH_PIPE
=
1
shift
;;
*
)
*
)
>
&2
echo
"'
${
1
}
' ist kein gültiger Parameter. Bitte benutzen Sie '
$(
basename
"
${
0
}
"
)
--help'."
>
&2
echo
"'
${
1
}
' ist kein gültiger Parameter. Bitte benutzen Sie '
$(
basename
"
${
0
}
"
)
--help'."
exit
1
exit
1
...
@@ -138,6 +150,19 @@ get_cli_args() {
...
@@ -138,6 +150,19 @@ get_cli_args() {
>
&2
echo
"param --mode must be 'auto', 'mediathek', 'fotothek', 'save', 'kitodo' or 'lfulg'!"
>
&2
echo
"param --mode must be 'auto', 'mediathek', 'fotothek', 'save', 'kitodo' or 'lfulg'!"
exit
1
exit
1
fi
fi
if
[
"
$WITH_PIPE
"
-eq
1
]
;
then
if
[
"
$WITH_DAEMON
"
-eq
1
]
\
||
[
"
$WATCH_FOLDER
"
]
\
||
[
"
$RESULT_FOLDER
"
]
\
||
[
"
$VALID_FOLDER
"
]
\
||
[
"
$INVALID_FOLDER
"
]
\
||
[
"
$FILES_MODE
"
=
"sort"
]
\
;
then
>
&2
echo
"param --pipe not combineable with params --daemon, --result-folder, --watch-folder, --valid-folder, --invalid-folder, --files-mode"
exit
1
fi
else
if
[
"
$WITH_DAEMON
"
-eq
1
-a
"
$FILES_MODE
"
=
"sort"
]
;
then
if
[
"
$WITH_DAEMON
"
-eq
1
-a
"
$FILES_MODE
"
=
"sort"
]
;
then
>
&2
echo
"param --daemon does only work with param --mode='delete' or --mode='nothing'!"
>
&2
echo
"param --daemon does only work with param --mode='delete' or --mode='nothing'!"
exit
1
exit
1
...
@@ -164,7 +189,7 @@ get_cli_args() {
...
@@ -164,7 +189,7 @@ get_cli_args() {
exit
1
exit
1
fi
fi
fi
fi
fi
}
}
scan_file
()
{
scan_file
()
{
...
@@ -181,6 +206,13 @@ scan_dir() {
...
@@ -181,6 +206,13 @@ scan_dir() {
#### MAIN
#### MAIN
get_cli_args
"
$@
"
get_cli_args
"
$@
"
if
[
"
$WITH_PIPE
"
-eq
1
]
;
then
#cli mode, use stdin
echo
"checking stream"
filename
=
$(
mktemp
validate_wrg.XXXX
)
scan_file
"
$filename
"
rm
-f
$filename
else
if
[
"
$WITH_DAEMON
"
-eq
1
]
;
then
if
[
"
$WITH_DAEMON
"
-eq
1
]
;
then
# echo daemon mode, use inotify to watch changes
# echo daemon mode, use inotify to watch changes
echo
"starting daemon"
echo
"starting daemon"
...
@@ -190,3 +222,4 @@ else
...
@@ -190,3 +222,4 @@ else
echo
"checking dir
$WATCH_FOLDER
"
echo
"checking dir
$WATCH_FOLDER
"
scan_dir
"
$WATCH_FOLDER
"
scan_dir
"
$WATCH_FOLDER
"
fi
fi
fi
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment