Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
Imldeployment Client
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
Imldeployment Client
Commits
b2f76eda
Commit
b2f76eda
authored
4 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
add detection if download is an update
parent
db6791cc
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
deploy_app.sh
+43
-16
43 additions, 16 deletions
deploy_app.sh
with
43 additions
and
16 deletions
deploy_app.sh
+
43
−
16
View file @
b2f76eda
...
@@ -58,6 +58,9 @@ function setprofile(){
...
@@ -58,6 +58,9 @@ function setprofile(){
exit
12
exit
12
fi
fi
echo
"OK, profile [
${
profile
}
] was set."
echo
"OK, profile [
${
profile
}
] was set."
downloadfile
=
"
${
tmpdir
}
/
${
IMLCI_PROJECT
}
.tgz"
downloadtmp
=
"
${
tmpdir
}
/
${
IMLCI_PROJECT
}
.tgz.tmp"
}
}
# output a colored infoline with date and given message
# output a colored infoline with date and given message
...
@@ -65,15 +68,15 @@ function setprofile(){
...
@@ -65,15 +68,15 @@ function setprofile(){
function
header
(){
function
header
(){
local
COLOR
=
"
\0
33[34m"
local
COLOR
=
"
\0
33[34m"
local
NO_COLOR
=
"
\0
33[0m"
local
NO_COLOR
=
"
\0
33[0m"
echo
echo
-en
"
${
COLOR
}
"
echo
-en
"
${
COLOR
}
"
echo
______________________________________________________________________
echo
______________________________________________________________________
echo
echo
-n
">>>>>>>>>>
$(
date
)
"
echo
-n
">>>>>>>>>>
$(
date
)
"
test
!
-z
"
$profile
"
&&
echo
-n
"
${
profile
}
:: "
test
!
-z
"
$profile
"
&&
echo
-n
"
${
profile
}
:: "
echo
-n
"
-
$*
"
echo
-n
"
$*
"
echo
-en
"
${
NO_COLOR
}
"
echo
-en
"
${
NO_COLOR
}
"
if
[
"
$wait
"
=
"1"
]
;
then
if
[
"
$wait
"
=
"1"
]
;
then
echo
-n
"RETURN"
;
read
dummy
;
echo
-n
"
RETURN"
;
read
dummy
;
fi
fi
echo
echo
}
}
...
@@ -84,9 +87,11 @@ function header(){
...
@@ -84,9 +87,11 @@ function header(){
function
run_task
(){
function
run_task
(){
local
taskscript
=
$1
local
taskscript
=
$1
if
[
-x
"
${
taskscript
}
"
]
;
then
if
[
-x
"
${
taskscript
}
"
]
;
then
echo
"INFO: starting script
${
taskscript
}
..."
.
"
${
taskscript
}
"
||
exit
10
.
"
${
taskscript
}
"
||
exit
10
else
else
echo
"SKIP: task script
${
taskscript
}
does not exist."
test
-f
"
${
taskscript
}
"
&&
(
echo
"SKIP: task script
${
taskscript
}
is not executable."
;
ls
-l
"
${
taskscript
}
"
)
test
-f
"
${
taskscript
}
"
||
echo
"SKIP: task script
${
taskscript
}
does not exist."
fi
fi
}
}
...
@@ -96,11 +101,6 @@ function run_task(){
...
@@ -96,11 +101,6 @@ function run_task(){
cd
$(
dirname
$0
)
cd
$(
dirname
$0
)
echo
echo
echo
"<<<<<<<<<<##########| POC :: DEPLOYMENT SCRIPT |##########>>>>>>>>>>"
echo
if
[
$#
-eq
0
]
;
then
if
[
$#
-eq
0
]
;
then
header
"looping over all profiles"
header
"looping over all profiles"
getprofiles
getprofiles
...
@@ -109,9 +109,17 @@ if [ $# -eq 0 ]; then
...
@@ -109,9 +109,17 @@ if [ $# -eq 0 ]; then
do
do
$0
$myprofile
$0
$myprofile
done
done
rc
=
$?
profile
=
header
"loop over projects is finished"
exit
$?
exit
$?
fi
fi
echo
echo
echo
"<<<<<<<<<<##########| POC :: DEPLOYMENT SCRIPT |##########>>>>>>>>>>"
echo
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
header
"Set profile [
$1
]"
header
"Set profile [
$1
]"
...
@@ -120,15 +128,34 @@ setprofile $1
...
@@ -120,15 +128,34 @@ setprofile $1
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
header
"Download
${
IMLCI_PROJECT
}
.tgz"
header
"Download
${
IMLCI_PROJECT
}
.tgz"
cd
$tmpdir
isupdate
=
0
${
selfdir
}
/bin/getfile.sh
-f
${
IMLCI_PROJECT
}
.tgz
||
exit
1
${
selfdir
}
/bin/getfile.sh
-f
${
IMLCI_PROJECT
}
.tgz
-o
${
downloadtmp
}
||
exit
1
# ----------------------------------------------------------------------
header
"Detect if download is newer than last download."
if
[
-f
${
downloadfile
}
]
;
then
# ls -l "${downloadfile}" "${downloadtmp}"
diff
"
${
downloadfile
}
"
"
${
downloadtmp
}
"
if
[
$?
-eq
0
]
;
then
echo
"INFO: the downloaded file is the same like last download."
rm
-f
"
${
downloadtmp
}
"
else
echo
"OK: donwload contains an update."
isupdate
=
1
mv
"
${
downloadtmp
}
"
"
${
downloadfile
}
"
fi
else
echo
"INFO: last download not available - first install or a forced update."
isupdate
=
1
mv
"
${
downloadtmp
}
"
"
${
downloadfile
}
"
fi
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
header
"
Go
into install dir
${
installdir
}
"
header
"
Switch
into install dir
${
installdir
}
...
"
test
-d
"
${
installdir
}
"
||
mkdir
-p
"
${
installdir
}
"
test
-d
"
${
installdir
}
"
||
mkdir
-p
"
${
installdir
}
"
cd
${
installdir
}
||
exit
2
cd
${
installdir
}
||
exit
2
pwd
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
...
@@ -141,14 +168,14 @@ run_task "${profiledir}/tasks_preinstall.sh"
...
@@ -141,14 +168,14 @@ run_task "${profiledir}/tasks_preinstall.sh"
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
header
"Extract
${
IMLCI_PROJECT
}
.tgz"
header
"Extract
${
IMLCI_PROJECT
}
.tgz
into
$(
pwd
)
"
tar
-xzf
${
tmpdir
}
/
${
IMLCI_PROJECT
}
.tgz
.
||
exit
3
tar
-xzf
${
tmpdir
}
/
${
IMLCI_PROJECT
}
.tgz
.
||
exit
3
ls
-l
ls
-l
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
header
"Remove download archive
${
IMLCI_PROJECT
}
.tgz"
#
header "Remove download archive ${IMLCI_PROJECT}.tgz"
echo rm
-f
${
IMLCI_PROJECT
}
.tgz
#
echo rm -f ${IMLCI_PROJECT}.tgz
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
...
...
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