Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Ci Pkg
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
Ci Pkg
Commits
f9053fd6
Commit
f9053fd6
authored
4 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
2021-04-13 v1.1 add support for custom config
parent
c943c9ba
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
shellscripts/getfile.sh
+28
-6
28 additions, 6 deletions
shellscripts/getfile.sh
with
28 additions
and
6 deletions
shellscripts/getfile.sh
+
28
−
6
View file @
f9053fd6
...
@@ -4,7 +4,8 @@
...
@@ -4,7 +4,8 @@
# API CLIENT :: GET A CI FILE FROM PACKAGE SERVER
# API CLIENT :: GET A CI FILE FROM PACKAGE SERVER
#
#
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# 2021-03-31 v0.0 <axel.hahn@iml.unibe.ch> init
# 2021-03-31 v1.0 <axel.hahn@iml.unibe.ch> init
# 2021-04-13 v1.1 <axel.hahn@iml.unibe.ch> add support for custom config
# ======================================================================
# ======================================================================
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
...
@@ -13,6 +14,7 @@
...
@@ -13,6 +14,7 @@
line
=
"----------------------------------------------------------------------"
line
=
"----------------------------------------------------------------------"
bDebug
=
0
bDebug
=
0
customconfig
=
.
$0
.cfg
.
$0
.cfg
...
@@ -33,6 +35,7 @@ SYNTAX:
...
@@ -33,6 +35,7 @@ SYNTAX:
OPTIONS:
OPTIONS:
-c CFGFILE load custom config file after defaults in
$self
.cfg
-d enable debug infos
-d enable debug infos
-e PHASE phase; overrides env variable IMLCI_PHASE
-e PHASE phase; overrides env variable IMLCI_PHASE
-f FILE filename to get (without path); overrides env variable IMLCI_FILE
-f FILE filename to get (without path); overrides env variable IMLCI_FILE
...
@@ -43,7 +46,9 @@ OPTIONS:
...
@@ -43,7 +46,9 @@ OPTIONS:
-u URL URL of iml ci server without trailing /; overrides env variable IMLCI_URL
-u URL URL of iml ci server without trailing /; overrides env variable IMLCI_URL
VALUES:
VALUES:
CFGFILE custom config file. It is useful to handle files of different
projects on a server.
PHASE is a phase of the ci server; one of preview|stage|live
PHASE is a phase of the ci server; one of preview|stage|live
FILE is a filename without path that was created by ci server.
FILE is a filename without path that was created by ci server.
OUTFILE Output file. It can countain a path. If none is given the filename
OUTFILE Output file. It can countain a path. If none is given the filename
...
@@ -54,6 +59,7 @@ VALUES:
...
@@ -54,6 +59,7 @@ VALUES:
ITEM type what to list; one of phases|projects|files
ITEM type what to list; one of phases|projects|files
To list projects a phase must be set.
To list projects a phase must be set.
To list files a phase and a project must be set.
To list files a phase and a project must be set.
DEFAULTS:
DEFAULTS:
You don't need to set all values by command line. Use a config to set defaults
You don't need to set all values by command line. Use a config to set defaults
...
@@ -166,8 +172,9 @@ if [ $# -lt 1 ]; then
...
@@ -166,8 +172,9 @@ if [ $# -lt 1 ]; then
fi
fi
while
getopts
"de:f:l:o:p:s:u:"
option
;
do
while
getopts
"
c:
de:f:l:o:p:s:u:"
option
;
do
case
${
option
}
in
case
${
option
}
in
c
)
customconfig
=
"
$OPTARG
"
;;
d
)
bDebug
=
1
;;
d
)
bDebug
=
1
;;
e
)
export
IMLCI_PHASE
=
$OPTARG
;;
e
)
export
IMLCI_PHASE
=
$OPTARG
;;
f
)
export
IMLCI_FILE
=
$OPTARG
;;
f
)
export
IMLCI_FILE
=
$OPTARG
;;
...
@@ -203,20 +210,35 @@ while getopts "de:f:l:o:p:s:u:" option; do
...
@@ -203,20 +210,35 @@ while getopts "de:f:l:o:p:s:u:" option; do
esac
esac
done
done
if
[
!
-z
"
$customconfig
"
]
;
then
if
[
-r
"
$customconfig
"
]
;
then
.
"
$customconfig
"
||
exit
2
else
echo
"ERROR: unable to read custom config [
$customconfig
]."
exit
2
fi
fi
test
-z
${
IMLCI_OUTFILE
}
&&
IMLCI_OUTFILE
=
$IMLCI_FILE
test
-z
${
IMLCI_OUTFILE
}
&&
IMLCI_OUTFILE
=
$IMLCI_FILE
if
[
$bDebug
=
1
]
;
then
if
[
$bDebug
=
1
]
;
then
pre
=
">>>>>> "
echo
$line
echo
$line
echo
echo
echo
DEBUG INFOS
echo
DEBUG INFOS
echo
echo
echo
-----
defaults
in
$0
.cfg
echo
"
${
pre
}
defaults in
$0
.cfg
"
cat
$0
.cfg 2>/dev/null
cat
$0
.cfg 2>/dev/null
echo
echo
echo
'----- Params (override default values)'
if
[
!
-z
"
$customconfig
"
]
;
then
echo
"
${
pre
}
custom config
$customconfig
"
cat
"
$customconfig
"
echo
fi
echo
"
${
pre
}
Params (override default values)"
echo
$*
echo
$*
echo
echo
echo
-----
effective values
echo
"
${
pre
}
effective values
"
echo
"IMLCI_URL =
$IMLCI_URL
"
echo
"IMLCI_URL =
$IMLCI_URL
"
echo
"IMLCI_PKG_SECRET =
$IMLCI_PKG_SECRET
"
echo
"IMLCI_PKG_SECRET =
$IMLCI_PKG_SECRET
"
echo
"IMLCI_PROJECT =
$IMLCI_PROJECT
"
echo
"IMLCI_PROJECT =
$IMLCI_PROJECT
"
...
...
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