Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
Imldeployment
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
Container registry
Model registry
Operate
Environments
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
Commits
e4522513
Commit
e4522513
authored
1 year ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
add helper script to
parent
fcb6b504
No related branches found
No related tags found
1 merge request
!62
V2.0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
shellscripts/goto_build_dir.sh
+97
-0
97 additions, 0 deletions
shellscripts/goto_build_dir.sh
with
97 additions
and
0 deletions
shellscripts/goto_build_dir.sh
0 → 100755
+
97
−
0
View file @
e4522513
#!/bin/bash
# ======================================================================
#
# HELPER :: GO TO A BUILD DIRECTORY
#
# Jump to a build directory to debug build errors.
#
# ----------------------------------------------------------------------
# 2024-01-19 v1.0 <axel.hahn@iml.unibe.ch> first lines
# ======================================================================
cd
$(
dirname
$0
)
/..
CI_APPROOT
=
$(
pwd
)
# ----------------------------------------------------------------------
# header
# ----------------------------------------------------------------------
cat
<<
HEADEREND
+----------------------------------------------------------------------
| CI SERVER * helper script
| Jump to a build directory to debug build errors
:
HEADEREND
# ----------------------------------------------------------------------
# detect workdir
# ----------------------------------------------------------------------
datadefault
=
$(
grep
"'workDir'.*=>"
config/config_defaults.php |
cut
-f
2
-d
'>'
|
cut
-f
2
-d
"'"
)
datacustom
=
$(
grep
"'workDir'.*=>"
config/config_custom.php |
cut
-f
2
-d
'>'
|
cut
-f
2
-d
"'"
)
CI_WORKDIR
=
${
datacustom
:-
$datadefault
}
if
[
-z
"
$CI_WORKDIR
"
]
;
then
echo
"ERROR: Unable to parse working dir from config/config_*.php."
echo
" Sorry ... it is Bash here :-/"
exit
1
fi
builddir
=
"
$CI_WORKDIR
/build/"
# ----------------------------------------------------------------------
# detect builds on error
# ----------------------------------------------------------------------
ls
$builddir
>
/dev/null
||
exit
1
echo
"Searching for builds im
$builddir
..."
founddirs
=
$(
find
$builddir
-maxdepth
2
-type
d |
grep
'2[0-1][0-9][0-9][0-1][0-9][0-3][0-9]'
|
sort
)
if
[
-z
"
$founddirs
"
]
;
then
echo
"Good news: No build dirs (builds on error) were found. Aborting."
echo
exit
0
fi
# ----------------------------------------------------------------------
# enter my directory
# ----------------------------------------------------------------------
cat
<<
ENDINFO
Found error builds:
$(
echo
"
$founddirs
"
|
wc
-l
)
The latest error is the last entry per project.
Select a directory to jump in or press just RETURN to abort:
$(
echo
"
$founddirs
"
|
sed
's,^, ,g'
)
ENDINFO
echo
-n
"I want to jump to > "
read
-r
DIR_APPROOT
test
-z
"
$DIR_APPROOT
"
&&
exit
1
# DIR_APPROOT="/var/imldeployment/build/$DIR_APPROOT"
ls
"
$DIR_APPROOT
"
>
/dev/null
||
exit
2
# ----------------------------------------------------------------------
# prepare environment an GO!
# ----------------------------------------------------------------------
export
DIR_APPROOT
export
GIT_SSH
=
"
$CI_APPROOT
/shellscripts/gitsshwrapper.sh"
export
DIR_SSH_KEYS
=
"
$CI_WORKDIR
/data/sshkeys"
export
NVMINIT
=
"
$CI_APPROOT
/shellscripts/nvm_init.sh"
;
export
RVMSCRIPT
=
"/usr/local/rvm/scripts/rvm"
;
cd
"
$DIR_APPROOT
"
cat
<<
EOF
* Switching now into build dir
$(
pwd
)
* The environment for the CI server is set
You can go to the ./hooks/ directory to execute the command of your onbuild actions.
EOF
echo
bash
--rcfile
<
(
cat
~/.bashrc 2>/dev/null
;
echo
'PS1="CI|$PS1"'
)
# ----------------------------------------------------------------------
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